diff --git a/.github/skills/connection-setup/SKILL.md b/.github/skills/connection-setup/SKILL.md index c0e7f09..e3a8da6 100644 --- a/.github/skills/connection-setup/SKILL.md +++ b/.github/skills/connection-setup/SKILL.md @@ -65,7 +65,7 @@ Remove-Item $tempFile -ErrorAction SilentlyContinue ### Step 2: Create Connection -Supported SDK connector names: `arm`, `azuread`, `azureblob`, `azureeventgrid`, `azureiotcentral`, `azuremonitorlogs`, `azurequeues`, `azuretables`, `campfire`, `clicksendsms`, `cloudmersiveconvert`, `documentdb`, `docuware`, `elfsquaddata`, `etsy`, `eventhubs`, `excelonline`, `excelonlinebusiness`, `formstackforms`, `freshservice`, `impexium`, `infusionsoft`, `insightly`, `jedoxodatahub`, `kusto`, `meetingroommap`, `microsoftforms`, `mq`, `msgraphgroupsanduser`, `office365`, `office365users`, `onedriveforbusiness`, `orderful`, `outlook`, `pdfco`, `pipedrive`, `plivo`, `plumsail`, `projectplace`, `replicon`, `revai`, `seismicplanner`, `servicebus`, `sharepointonline`, `signinghub`, `smtp`, `starmind`, `starrezrestv1`, `tallyfy`, `teams`, `textrequest`, `ticketmaster`, `universalprint`, `waywedo`, `wdatp`, `wordonlinebusiness`, `yammer`, `azureautomation`, `azuredatafactory`, `azuredigitaltwins`, `azurevm`, `keyvault`, `microsoftbookings`, `office365groups`, `office365groupsmail`, `onenote`, `planner`, `powerbi`, `shifts`, `todo`, `zohosign` (and any `Microsoft.Web/connections` connector name). +Supported SDK connector names: `arm`, `azuread`, `azureblob`, `azureeventgrid`, `azureiotcentral`, `azuremonitorlogs`, `azurequeues`, `azuretables`, `box`, `campfire`, `clicksendsms`, `cloudmersiveconvert`, `docusign`, `documentdb`, `docuware`, `dropbox`, `dynamicsax`, `elfsquaddata`, `etsy`, `eventbrite`, `eventhubs`, `excelonline`, `excelonlinebusiness`, `formstackforms`, `freshservice`, `ftp`, `github`, `googlecalendar`, `googledrive`, `googletasks`, `impexium`, `infusionsoft`, `insightly`, `jedoxodatahub`, `jira`, `kusto`, `mailchimp`, `meetingroommap`, `microsoftforms`, `monday`, `mq`, `msgraphgroupsanduser`, `office365`, `office365users`, `onedrive`, `onedriveforbusiness`, `orderful`, `outlook`, `pdfco`, `pipedrive`, `plivo`, `plumsail`, `projectplace`, `replicon`, `revai`, `rss`, `salesforce`, `seismicplanner`, `sendgrid`, `servicebus`, `sharepointonline`, `signinghub`, `slack`, `smtp`, `sql`, `starmind`, `starrezrestv1`, `tallyfy`, `teams`, `textrequest`, `ticketmaster`, `trello`, `twitter`, `typeform`, `universalprint`, `waywedo`, `wdatp`, `webex`, `wordpress`, `wordonlinebusiness`, `yammer`, `zendesk`, `azureautomation`, `azuredatafactory`, `azuredigitaltwins`, `azurevm`, `keyvault`, `microsoftbookings`, `office365groups`, `office365groupsmail`, `onenote`, `planner`, `powerbi`, `shifts`, `todo`, `zohosign` (and any `Microsoft.Web/connections` connector name). ```powershell $connectorName = "" # e.g., "arm", "azureblob", "azuremonitorlogs", "kusto", "mq", "msgraphgroupsanduser", "office365", "office365users", "onedriveforbusiness", "sharepointonline", "smtp", "teams" diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c93f3c..78c5daa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,10 +28,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **15 more connector clients (batch 3)** — `DocuwareClient`, `ElfsquadDataClient`, `ImpexiumClient`, `JedoxOdataHubClient`, `MeetingRoomMapClient`, `OrderfulClient`, `PdfCoClient`, `ProjectplaceClient`, `SeismicPlannerClient`, `StarmindClient`, `StarrezRestV1Client`, `TallyfyClient`, `TextRequestClient`, `TicketmasterClient`, `WaywedoClient` (#7) - **13 Microsoft 1st-party connector clients (batch 4)** — `AzureAutomationClient`, `AzureDataFactoryClient`, `AzureDigitalTwinsClient`, `AzureVMClient`, `KeyVaultClient`, `MicrosoftBookingsClient`, `Office365GroupsClient`, `Office365GroupsMailClient`, `OnenoteClient`, `PlannerClient`, `PowerBIClient`, `ShiftsClient`, `TodoClient` (#7) - **11 connector clients (batch 5)** — `AzureADClient`, `AzureIoTCentralClient`, `MicrosoftFormsClient` regenerated with generator bug fixes; plus 8 new clients: `AzureQueuesClient`, `AzureTablesClient`, `DocumentDbClient`, `EventHubsClient`, `ExcelOnlineBusinessClient`, `OutlookClient`, `ServiceBusConnectorClient`, `WordOnlineBusinessClient`; also fixes generator bugs #135, #136, #137, #138, #139 (IPageable property name derived from x-ms-summary; array-typed `$ref` definitions resolved to `` `List` `` instead of undefined class name) +- **25 new connector clients (batch 6)** — `BoxClient`, `DocusignClient`, `DropboxClient`, `DynamicsaxClient`, `EventbriteClient`, `FtpClient`, `GithubClient`, `GooglecalendarClient`, `GoogledriveClient`, `GoogletasksClient`, `JiraClient`, `MailchimpClient`, `MondayClient`, `OnedriveClient` (personal OneDrive), `RssClient`, `SalesforceClient`, `SendgridClient`, `SlackClient`, `SqlClient`, `TrelloClient`, `TwitterClient`, `TypeformClient`, `WebexClient`, `WordpressClient`, `ZendeskClient` ### Changed - **Regenerated all 12 connector clients** from updated CodefulSdkGenerator with PascalCase name overrides and constructor additions +- **Regenerated 15 existing connector clients** with latest generator bug fixes — `AzureMonitorLogsClient`, `AzureTablesClient`, `DocumentDbClient`, `ExcelOnlineBusinessClient`, `ExcelOnlineClient`, `InfusionsoftClient`, `Office365Client`, `Office365GroupsClient`, `Office365UsersClient`, `OneDriveForBusinessClient`, `PipedriveClient`, `PlumsailClient`, `SmtpClient`, `WdatpClient`, `YammerClient` ## [0.9.0-preview.1] - 2026-05-08 diff --git a/README.md b/README.md index ce69903..47baf51 100644 --- a/README.md +++ b/README.md @@ -235,6 +235,31 @@ Authentication uses Azure.Core `TokenCredential` directly — any credential fro | Power BI | 🔄 SDK Generated | ExecuteDatasetQuery, AddRows, RefreshDataset | | Shifts | 🔄 SDK Generated | ListShifts, ListOpenShifts, GetSchedule | | To Do | 🔄 SDK Generated | GetAllTodoLists, CreateToDo, GetToDo | +| Box | 🔄 SDK Generated | GetFileMetadata, CreateFile, CopyFile, ExtractFolder | +| DocuSign | 🔄 SDK Generated | CreateEnvelopeFromTemplate, SendEnvelope, GetRecipientStatus, ListEnvelopes | +| Dropbox | 🔄 SDK Generated | GetFileMetadata, CreateFile, CopyFile, ExtractFolder | +| Dynamics AX | 🔄 SDK Generated | GetTable, GetItems, PostItem, ExecuteProcedure | +| Eventbrite | 🔄 SDK Generated | GetCategories, GetOrganizations, GetOrganizationEvents, CreateEvent | +| FTP | 🔄 SDK Generated | CreateFile, GetFileMetadata, UpdateFile, DeleteFile | +| GitHub | 🔄 SDK Generated | CreateIssue, GetIssues, CreatePullRequest, MergePullRequest | +| Google Calendar | 🔄 SDK Generated | ListCalendars, ListEvents, CreateEvent, UpdateEvent | +| Google Drive | 🔄 SDK Generated | GetFileMetadata, CreateFile, ListFolder, ListRootFolder | +| Google Tasks | 🔄 SDK Generated | ListTaskLists, CreateTaskList, ListTasks | +| Jira | 🔄 SDK Generated | ListIssues, CreateIssue, EditIssue, ListProjects | +| Mailchimp | 🔄 SDK Generated | GetCampaigns, GetLists, AddMembers, Sendcampaign | +| Monday.com | 🔄 SDK Generated | GetBoards, CreateItem, GetItems, CreateBoard | +| OneDrive (Personal) | 🔄 SDK Generated | GetFileMetadata, CreateFile, ListRootFolder, FindFiles, CreateShareLink | +| RSS | 🔄 SDK Generated | ListFeedItems | +| Salesforce | 🔄 SDK Generated | GetItems, PostItem, PatchItem, ExecuteSoqlQuery | +| SendGrid | 🔄 SDK Generated | SendEmail, ListRecipientLists, AddGlobalSuppression | +| Slack | 🔄 SDK Generated | PostMessage, CreateChannel, JoinChannel | +| SQL Server | 🔄 SDK Generated | GetItems, PostItem, PatchItem, ExecuteProcedure, GetDatabases | +| Trello | 🔄 SDK Generated | ListCards, CreateCard, ListBoards, ListLists | +| Twitter | 🔄 SDK Generated | UserTimeline, HomeTimeline, SearchTweet, Tweet | +| Typeform | 🔄 SDK Generated | ListForms | +| Webex | 🔄 SDK Generated | SendMessage, GetMessages, GetSpaces, CreateSpace | +| WordPress | 🔄 SDK Generated | SiteStats, Get, Create, ListSites | +| Zendesk | 🔄 SDK Generated | PostItem, DeleteItem, PatchItem, SearchArticles | ## Related Projects diff --git a/src/Azure.Connectors.Sdk/Generated/AzureMonitorLogsExtensions.cs b/src/Azure.Connectors.Sdk/Generated/AzureMonitorLogsExtensions.cs index e19ad3b..84d5f7f 100644 --- a/src/Azure.Connectors.Sdk/Generated/AzureMonitorLogsExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/AzureMonitorLogsExtensions.cs @@ -152,7 +152,7 @@ public class Table /// Item in value /// [DynamicSchema("QuerySchemaV2")] - public class RowV2 + public class Row { /// /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. @@ -210,20 +210,6 @@ public class VisualizeResults public string AttachmentName { get; set; } } - /// - /// RowV2 - /// - [DynamicSchema("QuerySchemaV2")] - public class Row - { - /// - /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. - /// Populate this dictionary with the properties returned by the schema API. - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); - } - #endregion Types #region Model Factory @@ -466,8 +452,7 @@ public virtual AsyncPageable ListSubscriptionsAsync(CancellationTo public virtual AsyncPageable ListResourceGroupsAsync([DynamicValues("ListSubscriptions")] string subscription, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (subscription != default) - queryParams.Add($"subscriptions={Uri.EscapeDataString(subscription.ToString())}"); + queryParams.Add($"subscriptions={Uri.EscapeDataString(subscription.ToString())}"); var path = $"/listResourceGroups" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), @@ -487,12 +472,9 @@ public virtual AsyncPageable ListResourceGroupsAsync([DynamicValu public virtual AsyncPageable ListResourcesAsync([DynamicValues("ListSubscriptions")] string subscription, [DynamicValues("ListResourceGroups")] string resourceGroup, string resourceType, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (subscription != default) - queryParams.Add($"subscriptions={Uri.EscapeDataString(subscription.ToString())}"); - if (resourceGroup != default) - queryParams.Add($"resourcegroups={Uri.EscapeDataString(resourceGroup.ToString())}"); - if (resourceType != default) - queryParams.Add($"resourcetype={Uri.EscapeDataString(resourceType.ToString())}"); + queryParams.Add($"subscriptions={Uri.EscapeDataString(subscription.ToString())}"); + queryParams.Add($"resourcegroups={Uri.EscapeDataString(resourceGroup.ToString())}"); + queryParams.Add($"resourcetype={Uri.EscapeDataString(resourceType.ToString())}"); var path = $"/listResources" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), @@ -514,14 +496,10 @@ public virtual AsyncPageable ListResourcesAsync([DynamicValues("Li public virtual async Task QueryDataAsync(QueryDataInput input, [DynamicValues("ListSubscriptions")] string subscription, [DynamicValues("ListResourceGroups")] string resourceGroup, string resourceType, [DynamicValues("ListResources")] string resourceName, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (subscription != default) - queryParams.Add($"subscriptions={Uri.EscapeDataString(subscription.ToString())}"); - if (resourceGroup != default) - queryParams.Add($"resourcegroups={Uri.EscapeDataString(resourceGroup.ToString())}"); - if (resourceType != default) - queryParams.Add($"resourcetype={Uri.EscapeDataString(resourceType.ToString())}"); - if (resourceName != default) - queryParams.Add($"resourcename={Uri.EscapeDataString(resourceName.ToString())}"); + queryParams.Add($"subscriptions={Uri.EscapeDataString(subscription.ToString())}"); + queryParams.Add($"resourcegroups={Uri.EscapeDataString(resourceGroup.ToString())}"); + queryParams.Add($"resourcetype={Uri.EscapeDataString(resourceType.ToString())}"); + queryParams.Add($"resourcename={Uri.EscapeDataString(resourceName.ToString())}"); var path = $"/queryDataV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync
(HttpMethod.Post, path, input, cancellationToken) @@ -542,14 +520,10 @@ public virtual async Task
QueryDataAsync(QueryDataInput input, [DynamicVa public virtual async Task QuerySchemaAsync(string input, [DynamicValues("ListSubscriptions")] string subscription, [DynamicValues("ListResourceGroups")] string resourceGroup, string resourceType, [DynamicValues("ListResources")] string resourceName, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (subscription != default) - queryParams.Add($"subscriptions={Uri.EscapeDataString(subscription.ToString())}"); - if (resourceGroup != default) - queryParams.Add($"resourcegroups={Uri.EscapeDataString(resourceGroup.ToString())}"); - if (resourceType != default) - queryParams.Add($"resourcetype={Uri.EscapeDataString(resourceType.ToString())}"); - if (resourceName != default) - queryParams.Add($"resourcename={Uri.EscapeDataString(resourceName.ToString())}"); + queryParams.Add($"subscriptions={Uri.EscapeDataString(subscription.ToString())}"); + queryParams.Add($"resourcegroups={Uri.EscapeDataString(resourceGroup.ToString())}"); + queryParams.Add($"resourcetype={Uri.EscapeDataString(resourceType.ToString())}"); + queryParams.Add($"resourcename={Uri.EscapeDataString(resourceName.ToString())}"); var path = $"/querySchemaV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) @@ -571,16 +545,11 @@ public virtual async Task QuerySchemaAsync(string input, [DynamicV public virtual async Task VisualizeQueryAsync(VisualizeQueryInput input, [DynamicValues("ListSubscriptions")] string subscription, [DynamicValues("ListResourceGroups")] string resourceGroup, string resourceType, [DynamicValues("ListResources")] string resourceName, string chartType, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (subscription != default) - queryParams.Add($"subscriptions={Uri.EscapeDataString(subscription.ToString())}"); - if (resourceGroup != default) - queryParams.Add($"resourcegroups={Uri.EscapeDataString(resourceGroup.ToString())}"); - if (resourceType != default) - queryParams.Add($"resourcetype={Uri.EscapeDataString(resourceType.ToString())}"); - if (resourceName != default) - queryParams.Add($"resourcename={Uri.EscapeDataString(resourceName.ToString())}"); - if (chartType != default) - queryParams.Add($"visType={Uri.EscapeDataString(chartType.ToString())}"); + queryParams.Add($"subscriptions={Uri.EscapeDataString(subscription.ToString())}"); + queryParams.Add($"resourcegroups={Uri.EscapeDataString(resourceGroup.ToString())}"); + queryParams.Add($"resourcetype={Uri.EscapeDataString(resourceType.ToString())}"); + queryParams.Add($"resourcename={Uri.EscapeDataString(resourceName.ToString())}"); + queryParams.Add($"visType={Uri.EscapeDataString(chartType.ToString())}"); var path = $"/visualizeQueryV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) diff --git a/src/Azure.Connectors.Sdk/Generated/AzuretablesExtensions.cs b/src/Azure.Connectors.Sdk/Generated/AzuretablesExtensions.cs index 8496782..0deb54c 100644 --- a/src/Azure.Connectors.Sdk/Generated/AzuretablesExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/AzuretablesExtensions.cs @@ -77,8 +77,8 @@ public class InsertEntityResponse public string RowKey { get; set; } /// Dynamic entity columns returned by the service. - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); + [JsonPropertyName("additionalProperties")] + public string EntityData { get; set; } } /// @@ -123,8 +123,8 @@ public class EntityItem public string RowKey { get; set; } /// Dynamic entity columns returned by the service. - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); + [JsonPropertyName("additionalProperties")] + public string EntityData { get; set; } } /// @@ -145,8 +145,8 @@ public class GetEntityResponse public string RowKey { get; set; } /// Dynamic entity columns returned by the service. - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); + [JsonPropertyName("additionalProperties")] + public string EntityData { get; set; } } /// @@ -254,13 +254,15 @@ public static StorageAccount StorageAccount( public static InsertEntityResponse InsertEntityResponse( string entityMetadataLocation = default, string partitionKey = default, - string rowKey = default) + string rowKey = default, + string entityData = default) { return new InsertEntityResponse { EntityMetadataLocation = entityMetadataLocation, PartitionKey = partitionKey, RowKey = rowKey, + EntityData = entityData, }; } @@ -297,12 +299,14 @@ public static GetEntitiesResponse GetEntitiesResponse( /// public static EntityItem EntityItem( string partitionKey = default, - string rowKey = default) + string rowKey = default, + string entityData = default) { return new EntityItem { PartitionKey = partitionKey, RowKey = rowKey, + EntityData = entityData, }; } @@ -312,13 +316,15 @@ public static EntityItem EntityItem( public static GetEntityResponse GetEntityResponse( string tableMetadataLocation = default, string partitionKey = default, - string rowKey = default) + string rowKey = default, + string entityData = default) { return new GetEntityResponse { TableMetadataLocation = tableMetadataLocation, PartitionKey = partitionKey, RowKey = rowKey, + EntityData = entityData, }; } diff --git a/src/Azure.Connectors.Sdk/Generated/BoxExtensions.cs b/src/Azure.Connectors.Sdk/Generated/BoxExtensions.cs new file mode 100644 index 0000000..691a741 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/BoxExtensions.cs @@ -0,0 +1,472 @@ +// BoxExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Box.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Box.Models +{ + + #region Types + + /// + /// Response for Get file metadata using id + /// + public class BlobMetadata + { + /// The unique id of the file or folder. + [JsonPropertyName("Id")] + public string Id { get; set; } + + /// The name of the file or folder. + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// The display name of the file or folder. + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + + /// The path of the file or folder. + [JsonPropertyName("Path")] + public string Path { get; set; } + + /// The date and time the file or folder was last modified. + [JsonPropertyName("LastModified")] + [JsonInclude] + public DateTime? LastModified { get; internal set; } + + /// The size of the file or folder. + [JsonPropertyName("Size")] + public long? Size { get; set; } + + /// The media type of the file or folder. + [JsonPropertyName("MediaType")] + public string MediaType { get; set; } + + /// A boolean value (true, false) to indicate whether or not the blob is a folder. + [JsonPropertyName("IsFolder")] + public bool? IsFolder { get; set; } + + /// The etag of the file or folder. + [JsonPropertyName("ETag")] + [JsonInclude] + public string ETag { get; internal set; } + + /// The filelocator of the file or folder. + [JsonPropertyName("FileLocator")] + public string FileLocator { get; set; } + + /// The user who last modified the file or folder. + [JsonPropertyName("LastModifiedBy")] + public string LastModifiedBy { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Box models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class BoxModelFactory + { + /// + /// Creates a new instance of . + /// + public static BlobMetadata BlobMetadata( + string id = default, + string name = default, + string displayName = default, + string path = default, + DateTime? lastModified = default, + long? size = default, + string mediaType = default, + bool? isFolder = default, + string eTag = default, + string fileLocator = default, + string lastModifiedBy = default) + { + return new BlobMetadata + { + Id = id, + Name = name, + DisplayName = displayName, + Path = path, + LastModified = lastModified, + Size = size, + MediaType = mediaType, + IsFolder = isFolder, + ETag = eTag, + FileLocator = fileLocator, + LastModifiedBy = lastModifiedBy, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnNewFiles trigger (Box "When a file is created (properties only) (V2)", operationId: OnNewFilesV2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<BoxOnNewFilesTriggerPayload>(body). + /// + public class BoxOnNewFilesTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnUpdatedFiles trigger (Box "When a file is modified (properties only) (V2)", operationId: OnUpdatedFilesV2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<BoxOnUpdatedFilesTriggerPayload>(body). + /// + public class BoxOnUpdatedFilesTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Box connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class BoxTriggers + { + /// + /// Trigger operations with typed payloads for the Box connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnNewFilesV2"] = typeof(BoxOnNewFilesTriggerPayload), + ["OnUpdatedFilesV2"] = typeof(BoxOnUpdatedFilesTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Box +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Box connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class BoxTriggerOperations + { + /// + /// When a file is created (properties only) (V2). + /// Payload type: . + /// + public const string OnNewFiles = "OnNewFilesV2"; + + /// + /// When a file is modified (properties only) (V2). + /// Payload type: . + /// + public const string OnUpdatedFiles = "OnUpdatedFilesV2"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Box connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class BoxTriggerParameters + { + /// + /// Input parameters for the OnNewFiles trigger operation (operationId: OnNewFilesV2). + /// + public static class OnNewFiles + { + /// + /// The unique identifier of the folder. + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// Maximum number of files to return by single trigger run (1-100). Note that 'Split On' setting can force trigger to process each item individually. + /// Default: 10. + /// + public const string MaxFileCount = "maxFileCount"; + + } + + /// + /// Input parameters for the OnUpdatedFiles trigger operation (operationId: OnUpdatedFilesV2). + /// + public static class OnUpdatedFiles + { + /// + /// Select a folder + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// Maximum number of files to return by single trigger run (1-100). Note that 'Split On' setting can force trigger to process each item individually. + /// Default: 10. + /// + public const string MaxFileCount = "maxFileCount"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for box connector. + /// + public class BoxClient : ConnectorClientBase + { + /// + /// Creates a new BoxClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public BoxClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new BoxClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public BoxClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new BoxClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public BoxClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new BoxClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public BoxClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected BoxClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "box"; + + /// + /// Get file metadata using id + /// + /// Retrieves the file metadata from Box using file id. + /// File Id + /// Cancellation token. + /// The Get file metadata using id response. + public virtual async Task GetFileMetadataAsync(string fileId, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(fileId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update file + /// + /// Updates an existing file in Box. + /// File Id + /// The request body. + /// Cancellation token. + /// The Update file response. + public virtual async Task UpdateFileAsync(string fileId, byte[] input, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(fileId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete file + /// + /// Deletes an existing file from Box. + /// File Id + /// Cancellation token. + public virtual async Task DeleteFileAsync(string fileId, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(fileId.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file metadata using path + /// + /// Retrieves the file metadata from Box using path. + /// File Path + /// Cancellation token. + /// The Get file metadata using path response. + public virtual async Task GetFileMetadataByPathAsync(string filePath, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + var path = $"/datasets/default/GetFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file content using path + /// + /// Retrieves the file contents from Box using path. + /// File Path + /// Infer Content Type + /// Cancellation token. + /// The Get file content using path response. + public virtual async Task GetFileContentByPathAsync(string filePath, bool? inferContentType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); + var path = $"/datasets/default/GetFileContentByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file content using id + /// + /// Retrieves the file content from Box using id. + /// File Id + /// Infer Content Type + /// Cancellation token. + /// The Get file content using id response. + public virtual async Task GetFileContentAsync(string fileId, bool? inferContentType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(fileId.ToString())}/content" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create file + /// + /// Uploads a file to Box. + /// The request body. + /// Folder Path + /// File Name + /// Cancellation token. + /// The Create file response. + public virtual async Task CreateFileAsync(byte[] input, string folderPath, string fileName, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"folderPath={Uri.EscapeDataString(folderPath.ToString())}"); + queryParams.Add($"name={Uri.EscapeDataString(fileName.ToString())}"); + var path = $"/datasets/default/files" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copy file + /// + /// Copy a file to a file path in Box. + /// Source Url + /// Destination File Path + /// Overwrite + /// Cancellation token. + /// The Copy file response. + public virtual async Task CopyFileAsync(string sourceUrl, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"source={Uri.EscapeDataString(sourceUrl.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/copyFile" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Extract archive to folder + /// + /// Extracts an archive file into a folder in Box (example: .zip). + /// Source Archive File Path + /// Destination Folder Path + /// Overwrite + /// Cancellation token. + /// The Extract archive to folder response. + public virtual async Task> ExtractFolderAsync(string sourceArchiveFilePath, string destinationFolderPath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"source={Uri.EscapeDataString(sourceArchiveFilePath.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFolderPath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/extractFolderV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/ConnectorNames.cs b/src/Azure.Connectors.Sdk/Generated/ConnectorNames.cs index 7510623..d3ae708 100644 --- a/src/Azure.Connectors.Sdk/Generated/ConnectorNames.cs +++ b/src/Azure.Connectors.Sdk/Generated/ConnectorNames.cs @@ -27,14 +27,14 @@ public static class ConnectorNames public const string AzureAD = "azuread"; /// - /// The azureblob connector. + /// The azureautomation connector. /// - public const string AzureBlob = "azureblob"; + public const string AzureAutomation = "azureautomation"; /// - /// The azureautomation connector. + /// The azureblob connector. /// - public const string AzureAutomation = "azureautomation"; + public const string AzureBlob = "azureblob"; /// /// The azuredatafactory connector. @@ -76,6 +76,11 @@ public static class ConnectorNames /// public const string AzureVM = "azurevm"; + /// + /// The box connector. + /// + public const string Box = "box"; + /// /// The campfire connector. /// @@ -96,11 +101,26 @@ public static class ConnectorNames /// public const string DocumentDb = "documentdb"; + /// + /// The docusign connector. + /// + public const string DocuSign = "docusign"; + /// /// The docuware connector. /// public const string Docuware = "docuware"; + /// + /// The dropbox connector. + /// + public const string Dropbox = "dropbox"; + + /// + /// The dynamicsax connector. + /// + public const string DynamicsAX = "dynamicsax"; + /// /// The elfsquaddata connector. /// @@ -111,6 +131,11 @@ public static class ConnectorNames /// public const string Etsy = "etsy"; + /// + /// The eventbrite connector. + /// + public const string Eventbrite = "eventbrite"; + /// /// The eventhubs connector. /// @@ -136,6 +161,31 @@ public static class ConnectorNames /// public const string FreshService = "freshservice"; + /// + /// The ftp connector. + /// + public const string Ftp = "ftp"; + + /// + /// The github connector. + /// + public const string GitHub = "github"; + + /// + /// The googlecalendar connector. + /// + public const string GoogleCalendar = "googlecalendar"; + + /// + /// The googledrive connector. + /// + public const string GoogleDrive = "googledrive"; + + /// + /// The googletasks connector. + /// + public const string GoogleTasks = "googletasks"; + /// /// The impexium connector. /// @@ -157,9 +207,9 @@ public static class ConnectorNames public const string JedoxOdataHub = "jedoxodatahub"; /// - /// The kusto connector. + /// The jira connector. /// - public const string Kusto = "kusto"; + public const string Jira = "jira"; /// /// The keyvault connector. @@ -167,14 +217,19 @@ public static class ConnectorNames public const string KeyVault = "keyvault"; /// - /// The meetingroommap connector. + /// The kusto connector. /// - public const string MeetingRoomMap = "meetingroommap"; + public const string Kusto = "kusto"; /// - /// The mq connector. + /// The mailchimp connector. /// - public const string Mq = "mq"; + public const string MailChimp = "mailchimp"; + + /// + /// The meetingroommap connector. + /// + public const string MeetingRoomMap = "meetingroommap"; /// /// The microsoftbookings connector. @@ -186,6 +241,16 @@ public static class ConnectorNames /// public const string MicrosoftForms = "microsoftforms"; + /// + /// The monday connector. + /// + public const string Monday = "monday"; + + /// + /// The mq connector. + /// + public const string Mq = "mq"; + /// /// The msgraphgroupsanduser connector. /// @@ -211,6 +276,11 @@ public static class ConnectorNames /// public const string Office365Users = "office365users"; + /// + /// The onedrive connector. + /// + public const string OneDrive = "onedrive"; + /// /// The onedriveforbusiness connector. /// @@ -276,11 +346,26 @@ public static class ConnectorNames /// public const string Revai = "revai"; + /// + /// The rss connector. + /// + public const string Rss = "rss"; + + /// + /// The salesforce connector. + /// + public const string Salesforce = "salesforce"; + /// /// The seismicplanner connector. /// public const string SeismicPlanner = "seismicplanner"; + /// + /// The sendgrid connector. + /// + public const string SendGrid = "sendgrid"; + /// /// The servicebus connector. /// @@ -301,11 +386,21 @@ public static class ConnectorNames /// public const string SigningHub = "signinghub"; + /// + /// The slack connector. + /// + public const string Slack = "slack"; + /// /// The smtp connector. /// public const string Smtp = "smtp"; + /// + /// The sql connector. + /// + public const string Sql = "sql"; + /// /// The starmind connector. /// @@ -326,20 +421,35 @@ public static class ConnectorNames /// public const string Teams = "teams"; + /// + /// The textrequest connector. + /// + public const string TextRequest = "textrequest"; + + /// + /// The ticketmaster connector. + /// + public const string Ticketmaster = "ticketmaster"; + /// /// The todo connector. /// public const string Todo = "todo"; /// - /// The textrequest connector. + /// The trello connector. /// - public const string TextRequest = "textrequest"; + public const string Trello = "trello"; /// - /// The ticketmaster connector. + /// The twitter connector. /// - public const string Ticketmaster = "ticketmaster"; + public const string Twitter = "twitter"; + + /// + /// The typeform connector. + /// + public const string Typeform = "typeform"; /// /// The universalprint connector. @@ -356,16 +466,31 @@ public static class ConnectorNames /// public const string Wdatp = "wdatp"; + /// + /// The webex connector. + /// + public const string Webex = "webex"; + /// /// The wordonlinebusiness connector. /// public const string WordOnlineBusiness = "wordonlinebusiness"; + /// + /// The wordpress connector. + /// + public const string WordPress = "wordpress"; + /// /// The yammer connector. /// public const string Yammer = "yammer"; + /// + /// The zendesk connector. + /// + public const string Zendesk = "zendesk"; + /// /// The zohosign connector. /// diff --git a/src/Azure.Connectors.Sdk/Generated/DocuSignExtensions.cs b/src/Azure.Connectors.Sdk/Generated/DocuSignExtensions.cs new file mode 100644 index 0000000..4c92797 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/DocuSignExtensions.cs @@ -0,0 +1,3967 @@ +// DocuSignExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.DocuSign.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.DocuSign.Models +{ + + #region Types + + /// + /// Response for Get document generation form fields from envelope + /// + public class DocGenFormFieldsResponse + { + /// Docgen Fields + [JsonPropertyName("docgenFields")] + public List DocgenFields { get; set; } + } + + /// + /// Item in Docgen Fields + /// + public class DocGenFormField + { + /// Document Id. + [JsonPropertyName("documentId")] + public string DocumentId { get; set; } + + /// Label. + [JsonPropertyName("label")] + public string Label { get; set; } + + /// Type. + [JsonPropertyName("type")] + public string Type { get; set; } + + /// Name. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Value. + [JsonPropertyName("value")] + public string Value { get; set; } + } + + /// + /// Response for Void the envelope + /// + public class EnvelopeVoidResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Resend the envelope + /// + public class EnvelopeResendResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Add reminders for an envelope + /// + public class AddRemindersResponse + { + /// Reminder enabled + [JsonPropertyName("reminderEnabled")] + public string ReminderEnabled { get; set; } + } + + /// + /// Response for Get document tabs from envelope + /// + public class ListTabsResponse + { + /// Tabs + [JsonPropertyName("tabs")] + public List Tabs { get; set; } + } + + /// + /// Item in Tabs + /// + public class Tab + { + /// The name of the tab. + [JsonPropertyName("name")] + public string TabName { get; set; } + + /// The type of the tab. + [JsonPropertyName("tabType")] + public string TabType { get; set; } + + /// The label of the tab. + [JsonPropertyName("tabLabel")] + public string TabLabel { get; set; } + + /// The value of the tab. + [JsonPropertyName("value")] + public string TabValue { get; set; } + + /// The id of the tab. + [JsonPropertyName("tabId")] + public string TabId { get; set; } + + /// The id of the document. + [JsonPropertyName("documentId")] + public string DocumentId { get; set; } + + /// The id of the recipient. + [JsonPropertyName("recipientId")] + public string RecipientId { get; set; } + + /// Indicates whether the tab is of prefill type. + [JsonPropertyName("prefill")] + public bool? IsPrefill { get; set; } + + /// If tabs is checkbox, indicates whether the tab is selected. + [JsonPropertyName("selected")] + public string Selected { get; set; } + } + + /// + /// Response for Get document custom fields from envelope + /// + public class ListEnvelopeDocumentFieldsResponse + { + /// Document Custom Fields + [JsonPropertyName("envelopeDocumentFields")] + public List CustomField { get; set; } + } + + /// + /// Item in Document Custom Fields + /// + public class EnvelopeDocumentField + { + /// The name of the custom field. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// The value of the custom field. + [JsonPropertyName("value")] + public string Value { get; set; } + } + + /// + /// Response for Create envelope + /// + public class CreateEnvelopeResponse + { + /// The id of the envelope. + [JsonPropertyName("envelopeId")] + public string EnvelopeId { get; set; } + + /// The id of the template. + [JsonPropertyName("templateId")] + public string TemplateId { get; set; } + + /// The status of the envelope. + [JsonPropertyName("status")] + public string Status { get; set; } + + /// The datetime the status was set. + [JsonPropertyName("statusDateTime")] + [JsonInclude] + public string StatusDateTime { get; internal set; } + + /// The URI for the envelope in DocuSign. + [JsonPropertyName("uri")] + public string URI { get; set; } + } + + /// + /// Response for Create envelope using composite templates + /// + public class CompositeTemplatesResponse + { + /// The id of the envelope. + [JsonPropertyName("envelopeId")] + public string EnvelopeId { get; set; } + + /// The status of the envelope. + [JsonPropertyName("status")] + public string Status { get; set; } + + /// The datetime the status was set. + [JsonPropertyName("statusDateTime")] + [JsonInclude] + public string StatusDateTime { get; internal set; } + + /// The URI for the envelope in DocuSign. + [JsonPropertyName("uri")] + public string URI { get; set; } + } + + /// + /// Response for Copilot: Get related activities + /// + public class ActivityListResponseEnvelope + { + /// Related activies + [JsonPropertyName("value")] + public List RelatedActivities { get; set; } + + /// hasMoreResults + [JsonPropertyName("hasMoreResults")] + public bool? HasMoreResults { get; set; } + } + + /// + /// Item in Related activies + /// + public class Activity + { + /// This output indicates the title of the activity in the citation card. + [JsonPropertyName("title")] + public string Title { get; set; } + + /// This output indicates the description of the insight. + [JsonPropertyName("description")] + public string Description { get; set; } + + /// This output indicates the time associated with the insight. + [JsonPropertyName("dateTime")] + public DateTime? DateTime { get; set; } + + /// This output indicates the URL to open insight. + [JsonPropertyName("url")] + public string URL { get; set; } + + /// This output indicates additional properties displayed in the detailed view of the insight. + [JsonPropertyName("additionalProperties")] + public object AdditionalProperties { get; set; } + } + + /// + /// Response for Copilot: Get related records + /// + public class DocumentRecordListResponseEnvelope + { + /// Related records + [JsonPropertyName("value")] + public List RelatedRecords { get; set; } + + /// hasMoreResults + [JsonPropertyName("hasMoreResults")] + public bool? HasMoreResults { get; set; } + } + + /// + /// Item in Related records + /// + public class DocumentRecord + { + /// This output uniquely identifies each related record returned by the action. + [JsonPropertyName("recordId")] + public string RecordId { get; set; } + + /// This output indicates the display name of record type of each related record returned by the action. + [JsonPropertyName("recordTypeDisplayName")] + public string RecordTypeDisplayName { get; set; } + + /// This output indicates the plural display name of the record type of each related record returned by the action. + [JsonPropertyName("recordTypePluralDisplayName")] + public string RecordTypeDisplayNameInPlural { get; set; } + + /// This output indicates the type of each related record returned by the action. + [JsonPropertyName("recordType")] + public string RecordType { get; set; } + + /// This output indicates the title of each related record returned by the action. + [JsonPropertyName("recordTitle")] + public string RecordTitle { get; set; } + + /// This output indicates the URL of each related record returned by the action. + [JsonPropertyName("url")] + public string UrlOfTheEnvelope { get; set; } + + /// Additional Properties + [JsonPropertyName("additionalProperties")] + public object AdditionalProperties { get; set; } + } + + /// + /// Response for Copilot for Sales: Get key sales + /// + public class KeySalesResponse + { + /// Key Sales + [JsonPropertyName("value")] + public List KeySales { get; set; } + + /// hasMoreResults + [JsonPropertyName("hasMoreResults")] + public bool? HasMoreResults { get; set; } + } + + /// + /// Item in Key Sales + /// + public class KeySales + { + /// This output indicates the title of citation card for the insight. + [JsonPropertyName("Title")] + public string Title { get; set; } + + /// This output indicates the text of the insight to be included in key sales info. + [JsonPropertyName("description")] + public string Description { get; set; } + + /// This output indicates the URL to learn more about the insight. + [JsonPropertyName("url")] + public string UrlOfTheEnvelope { get; set; } + + /// This output indicates the time associated with the insight. + [JsonPropertyName("dateTime")] + public string TimeAssociatedWithTheInsight { get; set; } + + /// This output indicates additional properties as name-value pairs of each related insight returned by the action. + [JsonPropertyName("additionalProperties")] + public object AdditionalProperties { get; set; } + } + + /// + /// Response for Copilot for Sales: Get email summary + /// + public class EmailSummaryResponse + { + /// Key Sales + [JsonPropertyName("value")] + public List EmailSummary { get; set; } + + /// hasMoreResults + [JsonPropertyName("hasMoreResults")] + public bool? HasMoreResults { get; set; } + } + + /// + /// Item in Key Sales + /// + public class EmailSummary + { + /// This output indicates the title of the partner section and should include only the partner's name. + [JsonPropertyName("Title")] + public string Title { get; set; } + + /// This output indicates the text you would like to be included in the email summary. + [JsonPropertyName("Description")] + public string Description { get; set; } + } + + /// + /// Response for Copilot: List envelopes + /// + public class FilteredEnvelopeListResponse + { + /// Filtered envelopes + [JsonPropertyName("value")] + public List FilteredEnvelopes { get; set; } + + /// Shows if envelopes exceed the specified number in the Return envelopes field + [JsonPropertyName("hasMoreResults")] + public bool? MoreEnvelopeResults { get; set; } + } + + /// + /// Item in Filtered envelopes + /// + public class FilteredEnvelopes + { + /// Title of the envelope + [JsonPropertyName("title")] + public string Title { get; set; } + + /// Description of the envelope activity + [JsonPropertyName("description")] + public string Description { get; set; } + + /// Envelope ID + [JsonPropertyName("envelopeId")] + public string EnvelopeId { get; set; } + + /// List of document names + [JsonPropertyName("documents")] + public string Documents { get; set; } + + /// List of recipient names + [JsonPropertyName("recipients")] + public string RecipientNames { get; set; } + + /// Sender name + [JsonPropertyName("sender")] + public string SenderName { get; set; } + + /// Status of the envelope + [JsonPropertyName("status")] + public string Status { get; set; } + + /// Last status update of the activity + [JsonPropertyName("statusDate")] + public string StatusDate { get; set; } + + /// Envelope sent date + [JsonPropertyName("dateSent")] + public DateTime? DateSent { get; set; } + + /// URL of the envelope + [JsonPropertyName("url")] + public string URL { get; set; } + } + + /// + /// Response for Copilot for Sales: List envelopes + /// + public class FilteredSalesCopilotEnvelopeListResponse + { + /// Filtered envelopes + [JsonPropertyName("value")] + public List FilteredEnvelopes { get; set; } + + /// hasMoreResults + [JsonPropertyName("hasMoreResults")] + public bool? HasMoreResults { get; set; } + } + + /// + /// Item in Filtered envelopes + /// + public class SalesCopilotFilteredEnvelopes + { + /// Title of the envelope + [JsonPropertyName("title")] + public string Title { get; set; } + + /// SubTitle of the envelope + [JsonPropertyName("subTitle")] + public string SubTitle { get; set; } + + /// URL of the envelope + [JsonPropertyName("url")] + public string URL { get; set; } + + /// Additional Properties + [JsonPropertyName("additionalPropertiesForSalesEnvelope")] + public object AdditionalProperties { get; set; } + } + + /// + /// Response for Send envelope + /// + public class SendDraftEnvelopeResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get custom field info from envelope + /// + public class EnvelopeCustomFieldResponse + { + /// The id of the envelope custom field. + [JsonPropertyName("fieldId")] + public string FieldId { get; set; } + + /// The type of the envelope custom field. + [JsonPropertyName("fieldType")] + public string FieldType { get; set; } + + /// The name of the envelope custom field. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// The value of the envelope custom field. + [JsonPropertyName("value")] + public string Value { get; set; } + } + + /// + /// Response for Update envelope custom field + /// + public class UpdateEnvelopeCustomFieldResponse + { + /// The id of the envelope custom field. + [JsonPropertyName("fieldId")] + public string FieldId { get; set; } + + /// The type of the envelope custom field. + [JsonPropertyName("fieldType")] + public string FieldType { get; set; } + + /// The name of the envelope custom field. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// The value of the envelope custom field. + [JsonPropertyName("value")] + public string Value { get; set; } + } + + /// + /// Response for Generate Embedded Sender URL + /// + public class EmbeddedSenderResponse + { + /// The url of embedded sender view. + [JsonPropertyName("url")] + public string EmbeddedSenderURL { get; set; } + } + + /// + /// Response for List recipients from envelope + /// + public class ListRecipientsResponse + { + /// Signers + [JsonPropertyName("signers")] + public List Signers { get; set; } + } + + /// + /// Item in Signers + /// + public class Signer + { + /// The signing order of the recipient in the document. + [JsonPropertyName("routingOrder")] + public string SigningOrder { get; set; } + + /// The role of the signer. + [JsonPropertyName("roleName")] + public string Role { get; set; } + + /// The id the recipient. + [JsonPropertyName("recipientId")] + public string RecipientId { get; set; } + + /// The name of the recipient. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// The email of the recipient. + [JsonPropertyName("email")] + public string Email { get; set; } + + /// The type the recipient. + [JsonPropertyName("recipientType")] + public string RecipientType { get; set; } + + /// The type of verification. + [JsonPropertyName("verificationType")] + public string VerificationType { get; set; } + + /// The recipient Guid. + [JsonPropertyName("recipientIdGuid")] + public string RecipientGuid { get; set; } + } + + /// + /// Response for Get audit event list + /// + public class AuditResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Add verification type to a recipient + /// + public class AddVerificationToRecipientResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Apply a template to documents + /// + public class ApplyTemplatesToDocumentsInput + { + /// Document Templates + [JsonPropertyName("documentTemplates")] + public List DocumentTemplates { get; set; } + } + + /// + /// Create bulk send list + /// + public class CreateBulkSendListInput + { + /// Upload CSV File + [JsonPropertyName("csv")] + public string CSVFile { get; set; } + } + + /// + /// Response for Create bulk send list + /// + public class BulkSendListGuid + { + /// Bulk send list guid + [JsonPropertyName("listId")] + public string BulkSendListGuidValue { get; set; } + } + + /// + /// Response for Login + /// + public class GetLoginAccountsResponse + { + /// Login accounts + [JsonPropertyName("loginAccounts")] + public List LoginAccounts { get; set; } + } + + /// + /// Item in Login accounts + /// + public class LoginAccount + { + /// The name of the account. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// The GUID of the account. + [JsonPropertyName("accountIdGuid")] + public string AccountIdGuid { get; set; } + } + + /// + /// Response for Get All Workflow Ids + /// + public class GetWorkFlowIdsResponse + { + /// Workflow ID + [JsonPropertyName("workflowIds")] + public List WorkflowIDs { get; set; } + } + + /// + /// Item in Workflow ID + /// + public class WorkflowId + { + /// The name of workflowID + [JsonPropertyName("name")] + public string Name { get; set; } + + /// The type of workflowID + [JsonPropertyName("type")] + public string Type { get; set; } + } + + /// + /// Response for List templates + /// + public class ListTemplatesResponse + { + /// The available envelope templates. + [JsonPropertyName("envelopeTemplates")] + public List EnvelopeTemplates { get; set; } + } + + /// + /// Item in The available envelope templates. + /// + public class EnvelopeTemplate + { + /// The id of the template. + [JsonPropertyName("templateId")] + public string TemplateId { get; set; } + + /// The name of the template. + [JsonPropertyName("name")] + public string Name { get; set; } + } + + /// + /// Response for GetSigningGroups + /// + public class ListSigningGroupResponse + { + /// List of all signing groups + [JsonPropertyName("signingGroups")] + public List SigningGroups { get; set; } + } + + /// + /// Item in List of all signing groups + /// + public class SigningGroup + { + /// The ID of the signing group. + [JsonPropertyName("signingGroupId")] + public string SigningGroupId { get; set; } + + /// The name of the signing group. + [JsonPropertyName("groupName")] + public string SigningGroupName { get; set; } + } + + /// + /// Response for List folders + /// + public class ListFoldersResponse + { + /// Folders + [JsonPropertyName("folders")] + public List Folders { get; set; } + } + + /// + /// Item in Folders + /// + public class Folder + { + /// The name of the folder. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// The id of the folder. + [JsonPropertyName("folderId")] + public string FolderId { get; set; } + } + + /// + /// Response for List envelopes + /// + public class ListEnvelopesResponse + { + /// The envelopes within a folder. + [JsonPropertyName("folderItems")] + public List FolderItems { get; set; } + } + + /// + /// Item in The envelopes within a folder. + /// + public class FolderItem + { + /// The id of the envelope. + [JsonPropertyName("envelopeId")] + public string EnvelopeId { get; set; } + + /// The subject of the envelope. + [JsonPropertyName("subject")] + public string Subject { get; set; } + } + + /// + /// Add documents to an envelope + /// + public class AddDocumentsToEnvelopeInput + { + /// documents + [JsonPropertyName("documents")] + public List Unnamed { get; set; } + } + + /// + /// Response for Add documents to an envelope + /// + public class AddDocumentsResponse + { + /// The id of the envelope. + [JsonPropertyName("envelopeId")] + public string EnvelopeId { get; set; } + + /// The documents attached to the envelope. + [JsonPropertyName("envelopeDocuments")] + public List EnvelopeDocuments { get; set; } + } + + /// + /// Item in The documents attached to the envelope. + /// + public class EnvelopeDocument + { + /// The name of the document. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// The id of the document. + [JsonPropertyName("documentId")] + public string DocumentId { get; set; } + + /// The guid of the document. + [JsonPropertyName("documentIdGuid")] + public string DocumentGuid { get; set; } + } + + /// + /// Response for List documents from a template + /// + public class ListTemplateDocumentsResponse + { + /// Documents attached to a template. + [JsonPropertyName("templateDocuments")] + public List TemplateDocuments { get; set; } + } + + /// + /// Response for List documents from an envelope + /// + public class ListDocumentsResponse + { + /// The documents attached to the envelope. + [JsonPropertyName("envelopeDocuments")] + public List EnvelopeDocuments { get; set; } + } + + /// + /// Response for Get the signers of a template in dynamic schema format + /// + public class GetDynamicSignersResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get the signers of a template in dynamic schema format + /// + public class GetDynamicRecipientsResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Add tabs for a recipient on an envelope + /// + public class AddRecipientTabsResponse + { + /// The tabs added to a recipient. + [JsonPropertyName("recipientTabs")] + public List RecipientTabs { get; set; } + } + + /// + /// Item in The tabs added to a recipient. + /// + public class RecipientTab + { + /// The id of the tab. + [JsonPropertyName("tabId")] + public string TabId { get; set; } + + /// The type of the tab. + [JsonPropertyName("tabType")] + public string TabType { get; set; } + } + + /// + /// Response for Get recipient tabs from envelope + /// + public class RecipientTabsResponse + { + /// Recipient tab + [JsonPropertyName("recipientTabs")] + public List RecipientTab { get; set; } + } + + /// + /// Response for Get Maestro Workflow Definitions + /// + public class WorkflowDefinitionsResponse + { + /// WorkflowDefinitions + [JsonPropertyName("WorkflowDefinitions")] + public List WorkflowDefinitions { get; set; } + } + + /// + /// Item in WorkflowDefinitions + /// + public class WorkflowDefinition + { + /// Id + [JsonPropertyName("Id")] + public string Id { get; set; } + + /// Name + [JsonPropertyName("Name")] + public string Name { get; set; } + } + + /// + /// Response for Get Maestro Workflow Definition + /// + public class WorkflowDefinitionResponse + { + /// Id + [JsonPropertyName("Id")] + public string Id { get; set; } + + /// Name + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// PayloadSchema + [JsonPropertyName("PayloadSchema")] + public List PayloadSchema { get; set; } + } + + /// + /// Item in PayloadSchema + /// + public class WorkflowDefPayloadSchema + { + /// Name + [JsonPropertyName("PropertyName")] + public string PropertyName { get; set; } + + /// Type + [JsonPropertyName("Type")] + public string Type { get; set; } + } + + /// + /// Response for Start Docusign Maestro workflow + /// + public class TriggerMaestroFlowResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for StaticResponseForTabTypes + /// + public class TabTypesResponse + { + /// Tab types + [JsonPropertyName("tabTypes")] + public List TabTypes { get; set; } + } + + /// + /// Item in Tab types + /// + public class TabType + { + /// Display name of the tab. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Type of the tab. + [JsonPropertyName("type")] + public string Type { get; set; } + } + + /// + /// Response for StaticResponseForRecipientTypes + /// + public class RecipientTypesResponse + { + /// Recipient types + [JsonPropertyName("tabTypes")] + public List RecipientTypes { get; set; } + } + + /// + /// Item in Recipient types + /// + public class RecipientType + { + /// Display name of the recipient type. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Type of the recipient. + [JsonPropertyName("type")] + public string Type { get; set; } + } + + /// + /// Response for StaticResponseForSignatureTypes + /// + public class SignatureTypesResponse + { + /// Signature types + [JsonPropertyName("tabTypes")] + public List SignatureTypes { get; set; } + } + + /// + /// Item in Signature types + /// + public class SignatureType + { + /// Display name of the signature type. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Type of the signature. + [JsonPropertyName("type")] + public string Type { get; set; } + } + + /// + /// Response for StaticResponseForAnchorTabSchema + /// + public class StaticResponseForAnchorTabSchemaResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for StaticResponseForCompositeTemplates + /// + public class StaticResponseForCompositeTemplatesResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for StaticResponseForRecipientTypeSchema + /// + public class StaticResponseForRecipientTypeSchemaResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for StaticResponseForEmbeddedSenderSchema + /// + public class StaticResponseForEmbeddedSenderSchemaResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for StaticResponseForVerificationTypeSchema + /// + public class StaticResponseForVerificationTypeSchemaResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Show build Number (For reference only. Do not include in a flow for execution) + /// + public class BuildNumberResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for StaticResponseForBuildNumberSchema + /// + public class StaticResponseForBuildNumberSchemaResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// When an envelope status changes (Connect) (V3) + /// + public class CreateHookEnvelopeInput + { + /// allUsers + [JsonPropertyName("allUsers")] + public string AllUsers { get; set; } + + /// allowEnvelopePublish + [JsonPropertyName("allowEnvelopePublish")] + public string AllowEnvelopePublish { get; set; } + + /// includeDocumentFields + [JsonPropertyName("includeDocumentFields")] + public string IncludeDocumentFields { get; set; } + + /// requiresAcknowledgement + [JsonPropertyName("requiresAcknowledgement")] + public string RequiresAcknowledgement { get; set; } + + /// urlToPublishTo + [JsonPropertyName("urlToPublishTo")] + public string UrlToPublishTo { get; set; } + + /// name + [JsonPropertyName("name")] + public string ConnectName { get; set; } + + /// envelopeEvents + [JsonPropertyName("envelopeEvents")] + public EnvelopeEvents? EnvelopeEvent { get; set; } + } + + /// + /// Response for When an envelope status changes (Connect) (V3) + /// + public class CreateHookEnvelopeResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Generate Embedded Signing URL (V2) + /// + public class EmbeddedSigningResponse + { + /// The url of embedded signing view. + [JsonPropertyName("url")] + public string URL { get; set; } + } + + /// + /// Response for StaticResponseForEmbeddedSigningSchemaV2 + /// + public class StaticResponseForEmbeddedSigningSchemaResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// MaestroInputVariables + /// + [DynamicSchema("GetMaestroWorkflowDefinition")] + public class MaestroInputVariables + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// DynamicSigners + /// + [DynamicSchema("GetDynamicSigners")] + public class DynamicSigners + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// DynamicRecipients + /// + [DynamicSchema("GetDynamicRecipients")] + public class DynamicRecipients + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// AdditionalRecipientParamsSchema + /// + [DynamicSchema("StaticResponseForRecipientTypeSchema")] + public class AdditionalRecipientParamsSchema + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// AdditionalRecipientData + /// + [DynamicSchema("StaticResponseForVerificationTypeSchema")] + public class AdditionalRecipientData + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// AdditionalURLForSenderView + /// + [DynamicSchema("StaticResponseForEmbeddedSenderSchema")] + public class AdditionalURLForSenderView + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// DynamicSigningUrlFields + /// + [DynamicSchema("StaticResponseForEmbeddedSigningSchemaV2")] + public class DynamicSigningUrlFields + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// BuildNumberSchema + /// + [DynamicSchema("StaticResponseForBuildNumberSchema")] + public class BuildNumberSchema + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// AccountCustomFields + /// + [DynamicSchema("GetCustomFields")] + public class AccountCustomFields + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// AnchorTabSchema + /// + [DynamicSchema("StaticResponseForAnchorTabSchema")] + public class AnchorTabSchema + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// CompositeTemplateSchema + /// + [DynamicSchema("StaticResponseForCompositeTemplates")] + public class CompositeTemplateSchema + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Extensible enum for known EnvelopeEvents values. + /// + [JsonConverter(typeof(EnvelopeEvents.EnvelopeEventsJsonConverter))] + public readonly struct EnvelopeEvents : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public EnvelopeEvents(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// envelope-sent + public static EnvelopeEvents EnvelopeSent { get; } = new("envelope-sent"); + + /// envelope-delivered + public static EnvelopeEvents EnvelopeDelivered { get; } = new("envelope-delivered"); + + /// envelope-completed + public static EnvelopeEvents EnvelopeCompleted { get; } = new("envelope-completed"); + + /// envelope-declined + public static EnvelopeEvents EnvelopeDeclined { get; } = new("envelope-declined"); + + /// envelope-voided + public static EnvelopeEvents EnvelopeVoided { get; } = new("envelope-voided"); + + /// envelope-resent + public static EnvelopeEvents EnvelopeResent { get; } = new("envelope-resent"); + + /// envelope-corrected + public static EnvelopeEvents EnvelopeCorrected { get; } = new("envelope-corrected"); + + /// envelope-purge + public static EnvelopeEvents EnvelopePurge { get; } = new("envelope-purge"); + + /// envelope-deleted + public static EnvelopeEvents EnvelopeDeleted { get; } = new("envelope-deleted"); + + /// envelope-discard + public static EnvelopeEvents EnvelopeDiscard { get; } = new("envelope-discard"); + + /// click-agreed + public static EnvelopeEvents ClickAgreed { get; } = new("click-agreed"); + + /// click-declined + public static EnvelopeEvents ClickDeclined { get; } = new("click-declined"); + + /// recipient-autoresponded + public static EnvelopeEvents RecipientAutoresponded { get; } = new("recipient-autoresponded"); + + /// recipient-authenticationfailed + public static EnvelopeEvents RecipientAuthenticationfailed { get; } = new("recipient-authenticationfailed"); + + /// recipient-finish-later + public static EnvelopeEvents RecipientFinishLater { get; } = new("recipient-finish-later"); + + /// Converts a string to . + public static implicit operator EnvelopeEvents(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(EnvelopeEvents value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(EnvelopeEvents other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is EnvelopeEvents other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(EnvelopeEvents left, EnvelopeEvents right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(EnvelopeEvents left, EnvelopeEvents right) => !left.Equals(right); + + internal sealed class EnvelopeEventsJsonConverter : JsonConverter + { + public EnvelopeEventsJsonConverter() { } + public override EnvelopeEvents Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for EnvelopeEvents, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, EnvelopeEvents value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of DocuSign models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class DocuSignModelFactory + { + /// + /// Creates a new instance of . + /// + public static DocGenFormFieldsResponse DocGenFormFieldsResponse( + List docgenFields = default) + { + return new DocGenFormFieldsResponse + { + DocgenFields = docgenFields, + }; + } + + /// + /// Creates a new instance of . + /// + public static DocGenFormField DocGenFormField( + string documentId = default, + string label = default, + string type = default, + string name = default, + string value = default) + { + return new DocGenFormField + { + DocumentId = documentId, + Label = label, + Type = type, + Name = name, + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static AddRemindersResponse AddRemindersResponse( + string reminderEnabled = default) + { + return new AddRemindersResponse + { + ReminderEnabled = reminderEnabled, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListTabsResponse ListTabsResponse( + List tabs = default) + { + return new ListTabsResponse + { + Tabs = tabs, + }; + } + + /// + /// Creates a new instance of . + /// + public static Tab Tab( + string tabName = default, + string tabType = default, + string tabLabel = default, + string tabValue = default, + string tabId = default, + string documentId = default, + string recipientId = default, + bool? isPrefill = default, + string selected = default) + { + return new Tab + { + TabName = tabName, + TabType = tabType, + TabLabel = tabLabel, + TabValue = tabValue, + TabId = tabId, + DocumentId = documentId, + RecipientId = recipientId, + IsPrefill = isPrefill, + Selected = selected, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListEnvelopeDocumentFieldsResponse ListEnvelopeDocumentFieldsResponse( + List customField = default) + { + return new ListEnvelopeDocumentFieldsResponse + { + CustomField = customField, + }; + } + + /// + /// Creates a new instance of . + /// + public static EnvelopeDocumentField EnvelopeDocumentField( + string name = default, + string value = default) + { + return new EnvelopeDocumentField + { + Name = name, + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateEnvelopeResponse CreateEnvelopeResponse( + string envelopeId = default, + string templateId = default, + string status = default, + string statusDateTime = default, + string uri = default) + { + return new CreateEnvelopeResponse + { + EnvelopeId = envelopeId, + TemplateId = templateId, + Status = status, + StatusDateTime = statusDateTime, + URI = uri, + }; + } + + /// + /// Creates a new instance of . + /// + public static CompositeTemplatesResponse CompositeTemplatesResponse( + string envelopeId = default, + string status = default, + string statusDateTime = default, + string uri = default) + { + return new CompositeTemplatesResponse + { + EnvelopeId = envelopeId, + Status = status, + StatusDateTime = statusDateTime, + URI = uri, + }; + } + + /// + /// Creates a new instance of . + /// + public static ActivityListResponseEnvelope ActivityListResponseEnvelope( + List relatedActivities = default, + bool? hasMoreResults = default) + { + return new ActivityListResponseEnvelope + { + RelatedActivities = relatedActivities, + HasMoreResults = hasMoreResults, + }; + } + + /// + /// Creates a new instance of . + /// + public static Activity Activity( + string title = default, + string description = default, + DateTime? dateTime = default, + string url = default, + object additionalProperties = default) + { + return new Activity + { + Title = title, + Description = description, + DateTime = dateTime, + URL = url, + AdditionalProperties = additionalProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static DocumentRecordListResponseEnvelope DocumentRecordListResponseEnvelope( + List relatedRecords = default, + bool? hasMoreResults = default) + { + return new DocumentRecordListResponseEnvelope + { + RelatedRecords = relatedRecords, + HasMoreResults = hasMoreResults, + }; + } + + /// + /// Creates a new instance of . + /// + public static DocumentRecord DocumentRecord( + string recordId = default, + string recordTypeDisplayName = default, + string recordTypeDisplayNameInPlural = default, + string recordType = default, + string recordTitle = default, + string urlOfTheEnvelope = default, + object additionalProperties = default) + { + return new DocumentRecord + { + RecordId = recordId, + RecordTypeDisplayName = recordTypeDisplayName, + RecordTypeDisplayNameInPlural = recordTypeDisplayNameInPlural, + RecordType = recordType, + RecordTitle = recordTitle, + UrlOfTheEnvelope = urlOfTheEnvelope, + AdditionalProperties = additionalProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static KeySalesResponse KeySalesResponse( + List keySales = default, + bool? hasMoreResults = default) + { + return new KeySalesResponse + { + KeySales = keySales, + HasMoreResults = hasMoreResults, + }; + } + + /// + /// Creates a new instance of . + /// + public static KeySales KeySales( + string title = default, + string description = default, + string urlOfTheEnvelope = default, + string timeAssociatedWithTheInsight = default, + object additionalProperties = default) + { + return new KeySales + { + Title = title, + Description = description, + UrlOfTheEnvelope = urlOfTheEnvelope, + TimeAssociatedWithTheInsight = timeAssociatedWithTheInsight, + AdditionalProperties = additionalProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static EmailSummaryResponse EmailSummaryResponse( + List emailSummary = default, + bool? hasMoreResults = default) + { + return new EmailSummaryResponse + { + EmailSummary = emailSummary, + HasMoreResults = hasMoreResults, + }; + } + + /// + /// Creates a new instance of . + /// + public static EmailSummary EmailSummary( + string title = default, + string description = default) + { + return new EmailSummary + { + Title = title, + Description = description, + }; + } + + /// + /// Creates a new instance of . + /// + public static FilteredEnvelopeListResponse FilteredEnvelopeListResponse( + List filteredEnvelopes = default, + bool? moreEnvelopeResults = default) + { + return new FilteredEnvelopeListResponse + { + FilteredEnvelopes = filteredEnvelopes, + MoreEnvelopeResults = moreEnvelopeResults, + }; + } + + /// + /// Creates a new instance of . + /// + public static FilteredEnvelopes FilteredEnvelopes( + string title = default, + string description = default, + string envelopeId = default, + string documents = default, + string recipientNames = default, + string senderName = default, + string status = default, + string statusDate = default, + DateTime? dateSent = default, + string url = default) + { + return new FilteredEnvelopes + { + Title = title, + Description = description, + EnvelopeId = envelopeId, + Documents = documents, + RecipientNames = recipientNames, + SenderName = senderName, + Status = status, + StatusDate = statusDate, + DateSent = dateSent, + URL = url, + }; + } + + /// + /// Creates a new instance of . + /// + public static FilteredSalesCopilotEnvelopeListResponse FilteredSalesCopilotEnvelopeListResponse( + List filteredEnvelopes = default, + bool? hasMoreResults = default) + { + return new FilteredSalesCopilotEnvelopeListResponse + { + FilteredEnvelopes = filteredEnvelopes, + HasMoreResults = hasMoreResults, + }; + } + + /// + /// Creates a new instance of . + /// + public static SalesCopilotFilteredEnvelopes SalesCopilotFilteredEnvelopes( + string title = default, + string subTitle = default, + string url = default, + object additionalProperties = default) + { + return new SalesCopilotFilteredEnvelopes + { + Title = title, + SubTitle = subTitle, + URL = url, + AdditionalProperties = additionalProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static EnvelopeCustomFieldResponse EnvelopeCustomFieldResponse( + string fieldId = default, + string fieldType = default, + string name = default, + string value = default) + { + return new EnvelopeCustomFieldResponse + { + FieldId = fieldId, + FieldType = fieldType, + Name = name, + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static UpdateEnvelopeCustomFieldResponse UpdateEnvelopeCustomFieldResponse( + string fieldId = default, + string fieldType = default, + string name = default, + string value = default) + { + return new UpdateEnvelopeCustomFieldResponse + { + FieldId = fieldId, + FieldType = fieldType, + Name = name, + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static EmbeddedSenderResponse EmbeddedSenderResponse( + string embeddedSenderURL = default) + { + return new EmbeddedSenderResponse + { + EmbeddedSenderURL = embeddedSenderURL, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListRecipientsResponse ListRecipientsResponse( + List signers = default) + { + return new ListRecipientsResponse + { + Signers = signers, + }; + } + + /// + /// Creates a new instance of . + /// + public static Signer Signer( + string signingOrder = default, + string role = default, + string recipientId = default, + string name = default, + string email = default, + string recipientType = default, + string verificationType = default, + string recipientGuid = default) + { + return new Signer + { + SigningOrder = signingOrder, + Role = role, + RecipientId = recipientId, + Name = name, + Email = email, + RecipientType = recipientType, + VerificationType = verificationType, + RecipientGuid = recipientGuid, + }; + } + + /// + /// Creates a new instance of . + /// + public static ApplyTemplatesToDocumentsInput ApplyTemplatesToDocumentsInput( + List documentTemplates = default) + { + return new ApplyTemplatesToDocumentsInput + { + DocumentTemplates = documentTemplates, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateBulkSendListInput CreateBulkSendListInput( + string csvFile = default) + { + return new CreateBulkSendListInput + { + CSVFile = csvFile, + }; + } + + /// + /// Creates a new instance of . + /// + public static BulkSendListGuid BulkSendListGuid( + string bulkSendListGuidValue = default) + { + return new BulkSendListGuid + { + BulkSendListGuidValue = bulkSendListGuidValue, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetLoginAccountsResponse GetLoginAccountsResponse( + List loginAccounts = default) + { + return new GetLoginAccountsResponse + { + LoginAccounts = loginAccounts, + }; + } + + /// + /// Creates a new instance of . + /// + public static LoginAccount LoginAccount( + string name = default, + string accountIdGuid = default) + { + return new LoginAccount + { + Name = name, + AccountIdGuid = accountIdGuid, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetWorkFlowIdsResponse GetWorkFlowIdsResponse( + List workflowIDs = default) + { + return new GetWorkFlowIdsResponse + { + WorkflowIDs = workflowIDs, + }; + } + + /// + /// Creates a new instance of . + /// + public static WorkflowId WorkflowId( + string name = default, + string type = default) + { + return new WorkflowId + { + Name = name, + Type = type, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListTemplatesResponse ListTemplatesResponse( + List envelopeTemplates = default) + { + return new ListTemplatesResponse + { + EnvelopeTemplates = envelopeTemplates, + }; + } + + /// + /// Creates a new instance of . + /// + public static EnvelopeTemplate EnvelopeTemplate( + string templateId = default, + string name = default) + { + return new EnvelopeTemplate + { + TemplateId = templateId, + Name = name, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListSigningGroupResponse ListSigningGroupResponse( + List signingGroups = default) + { + return new ListSigningGroupResponse + { + SigningGroups = signingGroups, + }; + } + + /// + /// Creates a new instance of . + /// + public static SigningGroup SigningGroup( + string signingGroupId = default, + string signingGroupName = default) + { + return new SigningGroup + { + SigningGroupId = signingGroupId, + SigningGroupName = signingGroupName, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListFoldersResponse ListFoldersResponse( + List folders = default) + { + return new ListFoldersResponse + { + Folders = folders, + }; + } + + /// + /// Creates a new instance of . + /// + public static Folder Folder( + string name = default, + string folderId = default) + { + return new Folder + { + Name = name, + FolderId = folderId, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListEnvelopesResponse ListEnvelopesResponse( + List folderItems = default) + { + return new ListEnvelopesResponse + { + FolderItems = folderItems, + }; + } + + /// + /// Creates a new instance of . + /// + public static FolderItem FolderItem( + string envelopeId = default, + string subject = default) + { + return new FolderItem + { + EnvelopeId = envelopeId, + Subject = subject, + }; + } + + /// + /// Creates a new instance of . + /// + public static AddDocumentsToEnvelopeInput AddDocumentsToEnvelopeInput( + List unnamed = default) + { + return new AddDocumentsToEnvelopeInput + { + Unnamed = unnamed, + }; + } + + /// + /// Creates a new instance of . + /// + public static AddDocumentsResponse AddDocumentsResponse( + string envelopeId = default, + List envelopeDocuments = default) + { + return new AddDocumentsResponse + { + EnvelopeId = envelopeId, + EnvelopeDocuments = envelopeDocuments, + }; + } + + /// + /// Creates a new instance of . + /// + public static EnvelopeDocument EnvelopeDocument( + string name = default, + string documentId = default, + string documentGuid = default) + { + return new EnvelopeDocument + { + Name = name, + DocumentId = documentId, + DocumentGuid = documentGuid, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListTemplateDocumentsResponse ListTemplateDocumentsResponse( + List templateDocuments = default) + { + return new ListTemplateDocumentsResponse + { + TemplateDocuments = templateDocuments, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListDocumentsResponse ListDocumentsResponse( + List envelopeDocuments = default) + { + return new ListDocumentsResponse + { + EnvelopeDocuments = envelopeDocuments, + }; + } + + /// + /// Creates a new instance of . + /// + public static AddRecipientTabsResponse AddRecipientTabsResponse( + List recipientTabs = default) + { + return new AddRecipientTabsResponse + { + RecipientTabs = recipientTabs, + }; + } + + /// + /// Creates a new instance of . + /// + public static RecipientTab RecipientTab( + string tabId = default, + string tabType = default) + { + return new RecipientTab + { + TabId = tabId, + TabType = tabType, + }; + } + + /// + /// Creates a new instance of . + /// + public static RecipientTabsResponse RecipientTabsResponse( + List recipientTab = default) + { + return new RecipientTabsResponse + { + RecipientTab = recipientTab, + }; + } + + /// + /// Creates a new instance of . + /// + public static WorkflowDefinitionsResponse WorkflowDefinitionsResponse( + List workflowDefinitions = default) + { + return new WorkflowDefinitionsResponse + { + WorkflowDefinitions = workflowDefinitions, + }; + } + + /// + /// Creates a new instance of . + /// + public static WorkflowDefinition WorkflowDefinition( + string id = default, + string name = default) + { + return new WorkflowDefinition + { + Id = id, + Name = name, + }; + } + + /// + /// Creates a new instance of . + /// + public static WorkflowDefinitionResponse WorkflowDefinitionResponse( + string id = default, + string name = default, + List payloadSchema = default) + { + return new WorkflowDefinitionResponse + { + Id = id, + Name = name, + PayloadSchema = payloadSchema, + }; + } + + /// + /// Creates a new instance of . + /// + public static WorkflowDefPayloadSchema WorkflowDefPayloadSchema( + string propertyName = default, + string type = default) + { + return new WorkflowDefPayloadSchema + { + PropertyName = propertyName, + Type = type, + }; + } + + /// + /// Creates a new instance of . + /// + public static TabTypesResponse TabTypesResponse( + List tabTypes = default) + { + return new TabTypesResponse + { + TabTypes = tabTypes, + }; + } + + /// + /// Creates a new instance of . + /// + public static TabType TabType( + string name = default, + string type = default) + { + return new TabType + { + Name = name, + Type = type, + }; + } + + /// + /// Creates a new instance of . + /// + public static RecipientTypesResponse RecipientTypesResponse( + List recipientTypes = default) + { + return new RecipientTypesResponse + { + RecipientTypes = recipientTypes, + }; + } + + /// + /// Creates a new instance of . + /// + public static RecipientType RecipientType( + string name = default, + string type = default) + { + return new RecipientType + { + Name = name, + Type = type, + }; + } + + /// + /// Creates a new instance of . + /// + public static SignatureTypesResponse SignatureTypesResponse( + List signatureTypes = default) + { + return new SignatureTypesResponse + { + SignatureTypes = signatureTypes, + }; + } + + /// + /// Creates a new instance of . + /// + public static SignatureType SignatureType( + string name = default, + string type = default) + { + return new SignatureType + { + Name = name, + Type = type, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateHookEnvelopeInput CreateHookEnvelopeInput( + string allUsers = default, + string allowEnvelopePublish = default, + string includeDocumentFields = default, + string requiresAcknowledgement = default, + string urlToPublishTo = default, + string connectName = default, + EnvelopeEvents? envelopeEvent = default) + { + return new CreateHookEnvelopeInput + { + AllUsers = allUsers, + AllowEnvelopePublish = allowEnvelopePublish, + IncludeDocumentFields = includeDocumentFields, + RequiresAcknowledgement = requiresAcknowledgement, + UrlToPublishTo = urlToPublishTo, + ConnectName = connectName, + EnvelopeEvent = envelopeEvent, + }; + } + + /// + /// Creates a new instance of . + /// + public static EmbeddedSigningResponse EmbeddedSigningResponse( + string url = default) + { + return new EmbeddedSigningResponse + { + URL = url, + }; + } + } + + #endregion Model Factory + +} + +namespace Azure.Connectors.Sdk.DocuSign +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the DocuSign connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class DocuSignTriggerOperations + { + /// + /// When an envelope status changes (Connect) (V3). + /// + public const string OnCreateHookEnvelope = "CreateHookEnvelopeV3"; + + } + + #endregion Trigger Operation Constants + + #region Client + + /// + /// Typed client for docusign connector. + /// + public class DocuSignClient : ConnectorClientBase + { + /// + /// Creates a new DocuSignClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public DocuSignClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new DocuSignClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public DocuSignClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new DocuSignClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public DocuSignClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new DocuSignClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public DocuSignClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected DocuSignClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "docusign"; + + /// + /// Get document generation form fields from envelope + /// + /// Get document generation form fields from envelope + /// Account + /// Envelope + /// Cancellation token. + /// The Get document generation form fields from envelope response. + public virtual async Task GetDocgenFormFieldsAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/docGenFormFields"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update document generation form fields from envelope + /// + /// Update document generation form fields from envelope + /// Account + /// Envelope + /// The request body. + /// Document GUID + /// Cancellation token. + public virtual async Task UpdateDocgenFormFieldsAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, List input, string documentGUID, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"documentGuid={Uri.EscapeDataString(documentGUID.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/docGenFormFields" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Void the envelope + /// + /// Void the envelope. + /// Account + /// Envelope + /// Void reason + /// Cancellation token. + /// The Void the envelope response. + public virtual async Task VoidEnvelopeAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string voidReason, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"voidedReason={Uri.EscapeDataString(voidReason.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/voidEnvelope" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Put, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Resend the envelope + /// + /// This action resends a Docusign envelope or sends a reminder to recipients who need to sign a Docusign agreement based on a provided EnvelopeId. + /// Envelope + /// Cancellation token. + /// The Resend the envelope response. + public virtual async Task ResendEnvelopeAsync(string envelope, CancellationToken cancellationToken = default) + { + var path = $"/accounts/copilotAccount/envelopes/{Uri.EscapeDataString(envelope.ToString())}/resendEnvelope"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add reminders for an envelope + /// + /// Add reminders for an envelope + /// Account + /// Envelope + /// Reminder Enabled + /// Reminder Delay + /// Reminder Frequency + /// Expire After + /// Cancellation token. + /// The Add reminders for an envelope response. + public virtual async Task AddRemindersAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, bool reminderEnabled, string reminderDelay, string reminderFrequency, string expireAfter = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"reminderEnabled={Uri.EscapeDataString(reminderEnabled.ToString())}"); + queryParams.Add($"reminderDelay={Uri.EscapeDataString(reminderDelay.ToString())}"); + queryParams.Add($"reminderFrequency={Uri.EscapeDataString(reminderFrequency.ToString())}"); + if (expireAfter != default) + queryParams.Add($"expireAfter={Uri.EscapeDataString(expireAfter.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/notification" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Put, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get document tabs from envelope + /// + /// Get document tabs from envelope + /// Account + /// Envelope + /// Document id + /// Cancellation token. + /// The Get document tabs from envelope response. + public virtual async Task GetEnvelopeDocumentTabsAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string documentId, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/documents/{Uri.EscapeDataString(documentId.ToString())}/tabs"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update envelope prefill tabs + /// + /// Update values for a list of prefill tabs + /// Account + /// Envelope + /// Document id + /// The request body. + /// Cancellation token. + public virtual async Task UpdateEnvelopePrefillTabsAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string documentId, List input, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/documents/{Uri.EscapeDataString(documentId.ToString())}/tabs"; + await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get document tabs from template + /// + /// Get document tabs from template + /// Account + /// Template + /// Document id + /// Cancellation token. + /// The Get document tabs from template response. + public virtual async Task GetTemplateDocumentTabsAsync([DynamicValues("GetLoginAccounts")] string account, string template, string documentId, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/templates/{Uri.EscapeDataString(template.ToString())}/documents/{Uri.EscapeDataString(documentId.ToString())}/tabs"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get document custom fields from envelope + /// + /// Get document custom fields from envelope + /// Account + /// Envelope + /// Document id + /// Cancellation token. + /// The Get document custom fields from envelope response. + public virtual async Task GetEnvelopeDocumentFieldsAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string documentId, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/documents/{Uri.EscapeDataString(documentId.ToString())}/fields"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create envelope + /// + /// Create a new blank envelope. + /// Account + /// The request body. + /// Email subject + /// Email body + /// Cancellation token. + /// The Create envelope response. + public virtual async Task CreateBlankEnvelopeAsync([DynamicValues("GetLoginAccounts")] string account, AccountCustomFields input, string emailSubject, string emailBody = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"emailSubject={Uri.EscapeDataString(emailSubject.ToString())}"); + if (emailBody != default) + queryParams.Add($"emailBody={Uri.EscapeDataString(emailBody.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/createBlankEnvelope" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create envelope using composite templates + /// + /// Create envelope using composite templates + /// Account + /// The request body. + /// Email subject + /// Email body + /// Envelope status + /// Cancellation token. + /// The Create envelope using composite templates response. + public virtual async Task CompositeTemplatesAsync([DynamicValues("GetLoginAccounts")] string account, CompositeTemplateSchema input, string emailSubject, string envelopeStatus, string emailBody = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"emailSubject={Uri.EscapeDataString(emailSubject.ToString())}"); + if (emailBody != default) + queryParams.Add($"emailBody={Uri.EscapeDataString(emailBody.ToString())}"); + queryParams.Add($"status={Uri.EscapeDataString(envelopeStatus.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/compositeTemplates" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copilot: Get related activities + /// + /// This action gets additional sales insights related to a CRM record that will be shown in the C4S record summary card. The action enhances the existing skills of copilot for sales. + /// Record type + /// Record Id + /// Start date + /// End date + /// Top + /// Skip + /// CRM type + /// CRM org URL + /// Cancellation token. + /// The Copilot: Get related activities response. + public virtual async Task ScpGetRelatedActivitiesAsync(string recordType, string recordId, string startDate = default, string endDate = default, int? top = default, int? skip = default, string cRMType = default, string cRMOrgURL = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"recordType={Uri.EscapeDataString(recordType.ToString())}"); + queryParams.Add($"recordId={Uri.EscapeDataString(recordId.ToString())}"); + if (startDate != default) + queryParams.Add($"startDateTime={Uri.EscapeDataString(startDate.ToString())}"); + if (endDate != default) + queryParams.Add($"endDateTime={Uri.EscapeDataString(endDate.ToString())}"); + if (top.HasValue) + queryParams.Add($"top={Uri.EscapeDataString(top.Value.ToString())}"); + if (skip.HasValue) + queryParams.Add($"skip={Uri.EscapeDataString(skip.Value.ToString())}"); + if (cRMType != default) + queryParams.Add($"crmType={Uri.EscapeDataString(cRMType.ToString())}"); + if (cRMOrgURL != default) + queryParams.Add($"crmOrgUrl={Uri.EscapeDataString(cRMOrgURL.ToString())}"); + var path = $"/accounts/salesCopilotAccount/envelopes/getRelatedActivities" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copilot: Get related records + /// + /// This action gets records related to a CRM record. The action enhances the existing skills of Copilot for Sales. + /// Record type + /// Record Id + /// Start date + /// Top + /// Skip + /// CRM type + /// CRM org URL + /// Cancellation token. + /// The Copilot: Get related records response. + public virtual async Task ScpGetRelatedRecordsAsync(string recordType, string recordId, string startDate = default, int? top = default, int? skip = default, string cRMType = default, string cRMOrgURL = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"recordType={Uri.EscapeDataString(recordType.ToString())}"); + queryParams.Add($"recordId={Uri.EscapeDataString(recordId.ToString())}"); + if (startDate != default) + queryParams.Add($"startDateTime={Uri.EscapeDataString(startDate.ToString())}"); + if (top.HasValue) + queryParams.Add($"top={Uri.EscapeDataString(top.Value.ToString())}"); + if (skip.HasValue) + queryParams.Add($"skip={Uri.EscapeDataString(skip.Value.ToString())}"); + if (cRMType != default) + queryParams.Add($"crmType={Uri.EscapeDataString(cRMType.ToString())}"); + if (cRMOrgURL != default) + queryParams.Add($"crmOrgUrl={Uri.EscapeDataString(cRMOrgURL.ToString())}"); + var path = $"/accounts/salesCopilotAccount/envelopes/getRelatedRecords" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copilot for Sales: Get key sales + /// + /// This action gets additional sales insights that will be shown in C4S key sales info card in outlook sidecar. The action enhances the existing skills of copilot for sales + /// Record type + /// Record Id + /// Start date + /// Top + /// Skip + /// CRM type + /// CRM org URL + /// Cancellation token. + /// The Copilot for Sales: Get key sales response. + public virtual async Task ScpGetKeySalesAsync(string recordType, string recordId, string startDate = default, int? top = default, int? skip = default, string cRMType = default, string cRMOrgURL = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"recordType={Uri.EscapeDataString(recordType.ToString())}"); + queryParams.Add($"recordId={Uri.EscapeDataString(recordId.ToString())}"); + if (startDate != default) + queryParams.Add($"startDateTime={Uri.EscapeDataString(startDate.ToString())}"); + if (top.HasValue) + queryParams.Add($"top={Uri.EscapeDataString(top.Value.ToString())}"); + if (skip.HasValue) + queryParams.Add($"skip={Uri.EscapeDataString(skip.Value.ToString())}"); + if (cRMType != default) + queryParams.Add($"crmType={Uri.EscapeDataString(cRMType.ToString())}"); + if (cRMOrgURL != default) + queryParams.Add($"crmOrgUrl={Uri.EscapeDataString(cRMOrgURL.ToString())}"); + var path = $"/accounts/salesCopilotAccount/envelopes/getKeySales" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copilot for Sales: Get email summary + /// + /// This action gets additional sales insights that will be shown in C4S email summary experience inside outlook summary. The action enhances the existing skills of copilot for sales. + /// Record type + /// Record Id + /// CRM type + /// CRM org URL + /// Comma separated email addresses + /// Top + /// Skip + /// Cancellation token. + /// The Copilot for Sales: Get email summary response. + public virtual async Task ScpGetEmailSummaryAsync(string commaSeparatedEmailAddresses, string recordType = default, string recordId = default, string cRMType = default, string cRMOrgURL = default, int? top = default, int? skip = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (recordType != default) + queryParams.Add($"recordType={Uri.EscapeDataString(recordType.ToString())}"); + if (recordId != default) + queryParams.Add($"recordId={Uri.EscapeDataString(recordId.ToString())}"); + if (cRMType != default) + queryParams.Add($"crmType={Uri.EscapeDataString(cRMType.ToString())}"); + if (cRMOrgURL != default) + queryParams.Add($"crmOrgUrl={Uri.EscapeDataString(cRMOrgURL.ToString())}"); + queryParams.Add($"emailContacts={Uri.EscapeDataString(commaSeparatedEmailAddresses.ToString())}"); + if (top.HasValue) + queryParams.Add($"top={Uri.EscapeDataString(top.Value.ToString())}"); + if (skip.HasValue) + queryParams.Add($"skip={Uri.EscapeDataString(skip.Value.ToString())}"); + var path = $"/accounts/salesCopilotAccount/envelopes/getEmailSummary" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copilot: List envelopes + /// + /// This action brings back relevant Docusign envelopes based on envelope status, date range, recipient name, recipient email address, envelope title, document name, or envelope custom field value. The output is the title, description, Envelope ID, document names, sender names, envelope status, status date, date sent, and a URL of the envelope which can be used as a link to view the envelope in Docusign. + /// Recipient name + /// Recipient emailId + /// Envelope subject + /// Custom field name + /// Custom field value + /// Envelope status + /// Folder + /// Order by + /// Top + /// Skip + /// Start date + /// End date + /// Cancellation token. + /// The Copilot: List envelopes response. + public virtual async Task ListEnvelopesAsync(string recipientName = default, string recipientEmailId = default, string envelopeSubject = default, string customFieldName = default, string customFieldValue = default, string envelopeStatus = default, string folder = default, string orderBy = default, int? top = default, int? skip = default, string startDate = default, string endDate = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (recipientName != default) + queryParams.Add($"recipientName={Uri.EscapeDataString(recipientName.ToString())}"); + if (recipientEmailId != default) + queryParams.Add($"recipientEmailId={Uri.EscapeDataString(recipientEmailId.ToString())}"); + if (envelopeSubject != default) + queryParams.Add($"envelopeTitle={Uri.EscapeDataString(envelopeSubject.ToString())}"); + if (customFieldName != default) + queryParams.Add($"customFieldName={Uri.EscapeDataString(customFieldName.ToString())}"); + if (customFieldValue != default) + queryParams.Add($"customFieldValue={Uri.EscapeDataString(customFieldValue.ToString())}"); + if (envelopeStatus != default) + queryParams.Add($"envelopeStatus={Uri.EscapeDataString(envelopeStatus.ToString())}"); + if (folder != default) + queryParams.Add($"folder_ids={Uri.EscapeDataString(folder.ToString())}"); + if (orderBy != default) + queryParams.Add($"order_by={Uri.EscapeDataString(orderBy.ToString())}"); + if (top.HasValue) + queryParams.Add($"top={Uri.EscapeDataString(top.Value.ToString())}"); + if (skip.HasValue) + queryParams.Add($"skip={Uri.EscapeDataString(skip.Value.ToString())}"); + if (startDate != default) + queryParams.Add($"from_date={Uri.EscapeDataString(startDate.ToString())}"); + if (endDate != default) + queryParams.Add($"to_date={Uri.EscapeDataString(endDate.ToString())}"); + var path = $"/accounts/copilotAccount/envelopes/listEnvelopes" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List envelopes + /// + /// This action brings back relevant Docusign envelopes based on envelope status, date range, recipient name, recipient email address, envelope title, document name, or envelope custom field value. The output is the title, description, Envelope ID, document names, sender names, envelope status, status date, date sent, and a URL of the envelope which can be used as a link to view the envelope in Docusign. + /// Account + /// Recipient name + /// Recipient email + /// Envelope subject + /// Custom field name + /// Custom field value + /// Envelope status + /// Folder + /// Order by + /// Return envelopes + /// Skip envelopes + /// Start date + /// End date + /// Cancellation token. + /// The List envelopes response. + public virtual async Task SearchListEnvelopesAsync([DynamicValues("GetLoginAccounts")] string account, string recipientName = default, string recipientEmail = default, string envelopeSubject = default, string customFieldName = default, string customFieldValue = default, string envelopeStatus = default, string folder = default, string orderBy = default, int? returnEnvelopes = default, int? skipEnvelopes = default, string startDate = default, string endDate = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (recipientName != default) + queryParams.Add($"recipientName={Uri.EscapeDataString(recipientName.ToString())}"); + if (recipientEmail != default) + queryParams.Add($"recipientEmailId={Uri.EscapeDataString(recipientEmail.ToString())}"); + if (envelopeSubject != default) + queryParams.Add($"envelopeTitle={Uri.EscapeDataString(envelopeSubject.ToString())}"); + if (customFieldName != default) + queryParams.Add($"customFieldName={Uri.EscapeDataString(customFieldName.ToString())}"); + if (customFieldValue != default) + queryParams.Add($"customFieldValue={Uri.EscapeDataString(customFieldValue.ToString())}"); + if (envelopeStatus != default) + queryParams.Add($"envelopeStatus={Uri.EscapeDataString(envelopeStatus.ToString())}"); + if (folder != default) + queryParams.Add($"folder_ids={Uri.EscapeDataString(folder.ToString())}"); + if (orderBy != default) + queryParams.Add($"order_by={Uri.EscapeDataString(orderBy.ToString())}"); + if (returnEnvelopes.HasValue) + queryParams.Add($"top={Uri.EscapeDataString(returnEnvelopes.Value.ToString())}"); + if (skipEnvelopes.HasValue) + queryParams.Add($"skip={Uri.EscapeDataString(skipEnvelopes.Value.ToString())}"); + if (startDate != default) + queryParams.Add($"from_date={Uri.EscapeDataString(startDate.ToString())}"); + if (endDate != default) + queryParams.Add($"to_date={Uri.EscapeDataString(endDate.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/SearchListEnvelopes" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copilot for Sales: List envelopes + /// + /// Copilot for Sales: List envelopes returns information on Docusign agreements such as title, documents, recipients, agreement status, sender name and URL of the agreement. The plugin can handle requests like show me all my agreements I need to sign or what is the status of the sales order contract. + /// Recipient name + /// Recipient emailId + /// Envelope subject + /// Custom field name + /// Custom field value + /// Envelope status + /// Folder + /// Order by + /// Top + /// Skip + /// Start date + /// End date + /// Cancellation token. + /// The Copilot for Sales: List envelopes response. + public virtual async Task SalesCopilotListEnvelopesAsync(string recipientName = default, string recipientEmailId = default, string envelopeSubject = default, string customFieldName = default, string customFieldValue = default, string envelopeStatus = default, string folder = default, string orderBy = default, int? top = default, int? skip = default, string startDate = default, string endDate = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (recipientName != default) + queryParams.Add($"recipientName={Uri.EscapeDataString(recipientName.ToString())}"); + if (recipientEmailId != default) + queryParams.Add($"recipientEmailId={Uri.EscapeDataString(recipientEmailId.ToString())}"); + if (envelopeSubject != default) + queryParams.Add($"envelopeTitle={Uri.EscapeDataString(envelopeSubject.ToString())}"); + if (customFieldName != default) + queryParams.Add($"customFieldName={Uri.EscapeDataString(customFieldName.ToString())}"); + if (customFieldValue != default) + queryParams.Add($"customFieldValue={Uri.EscapeDataString(customFieldValue.ToString())}"); + if (envelopeStatus != default) + queryParams.Add($"envelopeStatus={Uri.EscapeDataString(envelopeStatus.ToString())}"); + if (folder != default) + queryParams.Add($"folder_ids={Uri.EscapeDataString(folder.ToString())}"); + if (orderBy != default) + queryParams.Add($"order_by={Uri.EscapeDataString(orderBy.ToString())}"); + if (top.HasValue) + queryParams.Add($"top={Uri.EscapeDataString(top.Value.ToString())}"); + if (skip.HasValue) + queryParams.Add($"skip={Uri.EscapeDataString(skip.Value.ToString())}"); + if (startDate != default) + queryParams.Add($"startDateTime={Uri.EscapeDataString(startDate.ToString())}"); + if (endDate != default) + queryParams.Add($"endDateTime={Uri.EscapeDataString(endDate.ToString())}"); + var path = $"/accounts/copilotAccount/envelopes/listEnvelopesForSalesCopilot" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// DEPRECATED: Create envelope using template + /// + /// Create a new envelope using a specified template. + /// Account + /// The request body. + /// Template + /// Envelope status + /// Cancellation token. + /// The DEPRECATED: Create envelope using template response. + public virtual async Task CreateEnvelopeFromTemplateAsync([DynamicValues("GetLoginAccounts")] string account, AccountCustomFields input, [DynamicValues("GetEnvelopeTemplates")] string template, string envelopeStatus, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"templateId={Uri.EscapeDataString(template.ToString())}"); + queryParams.Add($"status={Uri.EscapeDataString(envelopeStatus.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/createFromTemplate" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create envelope using template + /// + /// Create a new envelope using a specified template. + /// Account + /// Template + /// Envelope status + /// Cancellation token. + /// The Create envelope using template response. + public virtual async Task CreateEnvelopeFromTemplateNoRecipientsAsync([DynamicValues("GetLoginAccounts")] string account, [DynamicValues("GetEnvelopeTemplates")] string template, string envelopeStatus, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"templateId={Uri.EscapeDataString(template.ToString())}"); + queryParams.Add($"status={Uri.EscapeDataString(envelopeStatus.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/createFromTemplateNoRecipients" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// DEPRECATED: Create envelope using template with recipients + /// + /// Create a new envelope using a specified template and specify recipients. + /// Account + /// The request body. + /// Envelope status + /// Template + /// Email subject + /// Email body + /// Cancellation token. + /// The DEPRECATED: Create envelope using template with recipients response. + public virtual async Task SendEnvelopeAsync([DynamicValues("GetLoginAccounts")] string account, DynamicSigners input, string envelopeStatus, [DynamicValues("GetEnvelopeTemplates")] string template, string emailSubject = default, string emailBody = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"status={Uri.EscapeDataString(envelopeStatus.ToString())}"); + queryParams.Add($"templateId={Uri.EscapeDataString(template.ToString())}"); + if (emailSubject != default) + queryParams.Add($"emailSubject={Uri.EscapeDataString(emailSubject.ToString())}"); + if (emailBody != default) + queryParams.Add($"emailBody={Uri.EscapeDataString(emailBody.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create envelope using template with recipients and tabs + /// + /// Create envelope using template with recipients and tabs + /// Account + /// The request body. + /// Template + /// Email subject + /// Cancellation token. + /// The Create envelope using template with recipients and tabs response. + public virtual async Task SendEnvelopeWithRecipientFieldsAsync([DynamicValues("GetLoginAccounts")] string account, DynamicRecipients input, [DynamicValues("GetEnvelopeTemplates")] string template, string emailSubject = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"templateId={Uri.EscapeDataString(template.ToString())}"); + if (emailSubject != default) + queryParams.Add($"emailSubject={Uri.EscapeDataString(emailSubject.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/createWithRecipientFields" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Send envelope + /// + /// Send an existing envelope. + /// Account + /// Envelope + /// Cancellation token. + /// The Send envelope response. + public virtual async Task SendDraftEnvelopeAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get custom field info from envelope + /// + /// Get custom field info from envelope + /// Account + /// Envelope + /// Custom Field Name + /// Cancellation token. + /// The Get custom field info from envelope response. + public virtual async Task GetEnvelopeCustomFieldAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, [DynamicValues("GetAccountCustomFields")] string customFieldName, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"fieldName={Uri.EscapeDataString(customFieldName.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/custom_fields" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update envelope custom field + /// + /// Update value for the specified envelope custom field + /// Account + /// Envelope + /// Field ID + /// Field Type + /// Name + /// Value + /// Cancellation token. + /// The Update envelope custom field response. + public virtual async Task UpdateEnvelopeCustomFieldAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string fieldId, string fieldType, string name, string value, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"fieldId={Uri.EscapeDataString(fieldId.ToString())}"); + queryParams.Add($"fieldType={Uri.EscapeDataString(fieldType.ToString())}"); + queryParams.Add($"name={Uri.EscapeDataString(name.ToString())}"); + queryParams.Add($"value={Uri.EscapeDataString(value.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/custom_fields" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Put, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Generate Embedded Sender URL + /// + /// Generate Embedded Sender URL + /// Account + /// Envelope + /// The request body. + /// Open in + /// Return URL + /// Cancellation token. + /// The Generate Embedded Sender URL response. + public virtual async Task GenerateEmbeddedSenderURLAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, AdditionalURLForSenderView input, string openIn, string returnURL, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"openIn={Uri.EscapeDataString(openIn.ToString())}"); + queryParams.Add($"returnUrl={Uri.EscapeDataString(returnURL.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/views/sender" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List recipients from envelope + /// + /// List recipients from envelope + /// Account + /// Envelope + /// Folder + /// Cancellation token. + /// The List recipients from envelope response. + public virtual async Task GetRecipientStatusAsync([DynamicValues("GetLoginAccounts")] string account, [DynamicValues("GetFolderEnvelopeList")] string envelope, [DynamicValues("GetFolderList")] string folder, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"folderId={Uri.EscapeDataString(folder.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/recipients" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Remove recipient from an envelope + /// + /// Remove recipient from an envelope + /// Account + /// Envelope + /// Folder + /// Recipient + /// Cancellation token. + /// The Remove recipient from an envelope response. + public virtual async Task RemoveRecipientFromEnvelopeAsync([DynamicValues("GetLoginAccounts")] string account, [DynamicValues("GetFolderEnvelopeList")] string envelope, [DynamicValues("GetFolderList")] string folder, [DynamicValues("GetRecipientStatus")] string recipient, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"folderId={Uri.EscapeDataString(folder.ToString())}"); + queryParams.Add($"RemoveRecipientFromEnvelopeRecipientId={Uri.EscapeDataString(recipient.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/recipients" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get recipient info from envelope + /// + /// Get recipient info from envelope + /// Account + /// Envelope + /// Recipient Email + /// Area Code + /// Phone Number + /// Recipient Id + /// Cancellation token. + /// The Get recipient info from envelope response. + public virtual async Task GetRecipientFieldsAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string recipientEmail = default, string areaCode = default, string phoneNumber = default, string recipientId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (recipientEmail != default) + queryParams.Add($"recipientEmail={Uri.EscapeDataString(recipientEmail.ToString())}"); + if (areaCode != default) + queryParams.Add($"areaCode={Uri.EscapeDataString(areaCode.ToString())}"); + if (phoneNumber != default) + queryParams.Add($"phoneNumber={Uri.EscapeDataString(phoneNumber.ToString())}"); + if (recipientId != default) + queryParams.Add($"recipientId={Uri.EscapeDataString(recipientId.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/recipientFields" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get audit event list + /// + /// Get audit event list + /// Account + /// Envelope + /// Cancellation token. + /// The Get audit event list response. + public virtual async Task GetAuditEventsAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/audit_events"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add verification type to a recipient + /// + /// Add verification type to a recipient. + /// Account + /// Envelope + /// The request body. + /// Recipient id + /// Recipient type + /// Verification Type + /// Cancellation token. + /// The Add verification type to a recipient response. + public virtual async Task AddVerificationToRecipientAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, AdditionalRecipientData input, string recipientId, string recipientType, string verificationType, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"recipientId={Uri.EscapeDataString(recipientId.ToString())}"); + queryParams.Add($"recipientType={Uri.EscapeDataString(recipientType.ToString())}"); + queryParams.Add($"verificationType={Uri.EscapeDataString(verificationType.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/recipients/addRecipientV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update recipient on an envelope + /// + /// Update recipient on an envelope + /// Account + /// Envelope + /// The request body. + /// Recipient id + /// Signature type + /// Recipient type + /// Client User ID + /// Embedded recipient start URL + /// Signing order + /// Email notification language + /// Email notification subject + /// Email notification body + /// Note + /// Role name + /// SMS Country Code + /// SMS Phone Number + /// Signing Group + /// Cancellation token. + /// The Update recipient on an envelope response. + public virtual async Task UpdateEnvelopeRecipientAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, AdditionalRecipientParamsSchema input, string recipientId, [DynamicValues("StaticResponseForRecipientTypes")] string recipientType, [DynamicValues("StaticResponseForSignatureTypes")] string signatureType = default, string clientUserId = default, string embeddedRecipientStartURL = default, string signingOrder = default, string emailNotificationLanguage = default, string emailNotificationSubject = default, string emailNotificationBody = default, string note = default, string roleName = default, int? sMSCountryCode = default, int? sMSPhoneNumber = default, [DynamicValues("GetSigningGroups")] string signingGroup = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"recipientId={Uri.EscapeDataString(recipientId.ToString())}"); + if (signatureType != default) + queryParams.Add($"signatureType={Uri.EscapeDataString(signatureType.ToString())}"); + queryParams.Add($"recipientType={Uri.EscapeDataString(recipientType.ToString())}"); + if (clientUserId != default) + queryParams.Add($"clientUserId={Uri.EscapeDataString(clientUserId.ToString())}"); + if (embeddedRecipientStartURL != default) + queryParams.Add($"embeddedRecipientStartURL={Uri.EscapeDataString(embeddedRecipientStartURL.ToString())}"); + if (signingOrder != default) + queryParams.Add($"routingOrder={Uri.EscapeDataString(signingOrder.ToString())}"); + if (emailNotificationLanguage != default) + queryParams.Add($"emailNotificationLanguage={Uri.EscapeDataString(emailNotificationLanguage.ToString())}"); + if (emailNotificationSubject != default) + queryParams.Add($"emailNotificationSubject={Uri.EscapeDataString(emailNotificationSubject.ToString())}"); + if (emailNotificationBody != default) + queryParams.Add($"emailNotificationBody={Uri.EscapeDataString(emailNotificationBody.ToString())}"); + if (note != default) + queryParams.Add($"note={Uri.EscapeDataString(note.ToString())}"); + if (roleName != default) + queryParams.Add($"roleName={Uri.EscapeDataString(roleName.ToString())}"); + if (sMSCountryCode.HasValue) + queryParams.Add($"countryCode={Uri.EscapeDataString(sMSCountryCode.Value.ToString())}"); + if (sMSPhoneNumber.HasValue) + queryParams.Add($"phoneNumber={Uri.EscapeDataString(sMSPhoneNumber.Value.ToString())}"); + if (signingGroup != default) + queryParams.Add($"signingGroupId={Uri.EscapeDataString(signingGroup.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/recipients/updateRecipient" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Apply a template to documents + /// + /// Apply a template to documents + /// Account + /// Envelope ID + /// The request body. + /// Template + /// Preserve template recipient + /// Cancellation token. + public virtual async Task ApplyTemplatesToDocumentsAsync([DynamicValues("GetLoginAccounts")] string account, string envelopeId, ApplyTemplatesToDocumentsInput input, [DynamicValues("GetEnvelopeTemplates")] string template, string preserveTemplateRecipient = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"templateId={Uri.EscapeDataString(template.ToString())}"); + if (preserveTemplateRecipient != default) + queryParams.Add($"preserve_template_recipient={Uri.EscapeDataString(preserveTemplateRecipient.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelopeId.ToString())}/templates" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create bulk send list + /// + /// Create bulk send list + /// Account + /// The request body. + /// Bulk send list name + /// Cancellation token. + /// The Create bulk send list response. + public virtual async Task CreateBulkSendListAsync([DynamicValues("GetLoginAccounts")] string account, CreateBulkSendListInput input, string bulkSendListName, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"name={Uri.EscapeDataString(bulkSendListName.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/bulk_send_lists" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Bulk send envelope using template + /// + /// Bulk send envelope using template + /// Account + /// Bulk send list GUID + /// Template ID + /// Cancellation token. + /// The Bulk send envelope using template response. + public virtual async Task BulkSendAsync([DynamicValues("GetLoginAccounts")] string account, string bulkSendListGUID, [DynamicValues("GetEnvelopeTemplates")] string templateId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"envelopeOrTemplateId={Uri.EscapeDataString(templateId.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/bulk_send_lists/{Uri.EscapeDataString(bulkSendListGUID.ToString())}/send" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Login + /// + /// Login + /// Cancellation token. + /// The Login response. + public virtual async Task GetLoginAccountsAsync(CancellationToken cancellationToken = default) + { + var path = $"/login_information"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get All Workflow Ids + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Account + /// Cancellation token. + /// The Get All Workflow Ids response. + public virtual async Task GetAllWorkflowIDsAsync([DynamicValues("GetLoginAccounts")] string account, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/all_identity_verification"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get custom fields from an account + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Account + /// Cancellation token. + public virtual async Task GetCustomFieldsAsync([DynamicValues("GetLoginAccounts")] string account, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/custom_fields"; + await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List templates + /// + /// List templates for a specific account. + /// Account + /// Cancellation token. + /// The List templates response. + public virtual async Task GetEnvelopeTemplatesAsync([DynamicValues("GetLoginAccounts")] string account, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/templates"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// GetSigningGroups + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Account + /// Cancellation token. + /// The GetSigningGroups response. + public virtual async Task GetSigningGroupsAsync([DynamicValues("GetLoginAccounts")] string account, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/signing_groups"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get account custom fields + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Account + /// Cancellation token. + public virtual async Task GetAccountCustomFieldsAsync([DynamicValues("GetLoginAccounts")] string account, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/account_custom_fields"; + await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List folders + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Account + /// Cancellation token. + /// The List folders response. + public virtual async Task GetFolderListAsync([DynamicValues("GetLoginAccounts")] string account, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/folders"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List envelopes + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Account + /// Folder + /// Cancellation token. + /// The List envelopes response. + public virtual async Task GetFolderEnvelopeListAsync([DynamicValues("GetLoginAccounts")] string account, [DynamicValues("GetFolderList")] string folder, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/folders/{Uri.EscapeDataString(folder.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add documents to an envelope + /// + /// Add documents to an envelope. + /// Account + /// Envelope + /// The request body. + /// Cancellation token. + /// The Add documents to an envelope response. + public virtual async Task AddDocumentsToEnvelopeAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, AddDocumentsToEnvelopeInput input, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/documents"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List documents from a template + /// + /// List documents from a template + /// Account + /// Template + /// Cancellation token. + /// The List documents from a template response. + public virtual async Task ListTemplateDocumentsAsync([DynamicValues("GetLoginAccounts")] string account, [DynamicValues("GetEnvelopeTemplates")] string template, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/templates/{Uri.EscapeDataString(template.ToString())}/documents"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List documents from an envelope + /// + /// List documents from an envelope + /// Account + /// Envelope + /// Cancellation token. + /// The List documents from an envelope response. + public virtual async Task ListEnvelopeDocumentsAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/envelopeDocuments"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get document info from envelope + /// + /// Get document info from envelope + /// Account + /// Envelope + /// Document name + /// Cancellation token. + /// The Get document info from envelope response. + public virtual async Task GetEnvelopeDocumentInfoAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string documentName, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"documentName={Uri.EscapeDataString(documentName.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/get_document_info" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get the signers of a template in dynamic schema format + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Account Id + /// Template Id + /// Cancellation token. + /// The Get the signers of a template in dynamic schema format response. + public virtual async Task GetDynamicSignersAsync(string accountId, string templateId, CancellationToken cancellationToken = default) + { + var path = $"/signers/accounts/{Uri.EscapeDataString(accountId.ToString())}/templates/{Uri.EscapeDataString(templateId.ToString())}/recipients"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get the signers of a template in dynamic schema format + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Account Id + /// Template Id + /// Cancellation token. + /// The Get the signers of a template in dynamic schema format response. + public virtual async Task GetDynamicRecipientsAsync(string accountId, string templateId, CancellationToken cancellationToken = default) + { + var path = $"/signers/accounts/{Uri.EscapeDataString(accountId.ToString())}/templates/{Uri.EscapeDataString(templateId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add tabs for a recipient on an envelope + /// + /// Add tabs for a recipient on an envelope + /// Account + /// Envelope + /// Recipient + /// The request body. + /// Tab type + /// Cancellation token. + /// The Add tabs for a recipient on an envelope response. + public virtual async Task AddRecipientTabsAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string recipient, AnchorTabSchema input, [DynamicValues("StaticResponseForTabTypes")] string tabType, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"tabType={Uri.EscapeDataString(tabType.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/recipients/{Uri.EscapeDataString(recipient.ToString())}/tabs" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get info for recipient tab + /// + /// Returns the value of the tab for the given recipient + /// Account + /// Envelope + /// Recipient id + /// Tab label + /// Cancellation token. + /// The Get info for recipient tab response. + public virtual async Task GetTabInfoAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string recipientId, string tabLabel, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"tabLabel={Uri.EscapeDataString(tabLabel.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/recipients/{Uri.EscapeDataString(recipientId.ToString())}/tabs" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update recipient tab values on an envelope + /// + /// Update recipient tab values on an envelope + /// Account + /// Envelope + /// Recipient + /// The request body. + /// Cancellation token. + public virtual async Task UpdateRecipientTabsValuesAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string recipient, List input, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/recipients/{Uri.EscapeDataString(recipient.ToString())}/tabs"; + await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get recipient tabs from envelope + /// + /// Get recipient tabs from envelope + /// Account + /// Envelope + /// Recipient id + /// Cancellation token. + /// The Get recipient tabs from envelope response. + public virtual async Task GetEnvelopeRecipientTabsAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string recipientId, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/recipients/{Uri.EscapeDataString(recipientId.ToString())}/recipientTabs"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Maestro Workflow Definitions + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// accountId + /// Cancellation token. + /// The Get Maestro Workflow Definitions response. + public virtual async Task GetMaestroWorkflowDefinitionsAsync(string accountId, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(accountId.ToString())}/maestro-workflows"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Maestro Workflow Definition + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// accountId + /// workflowId + /// Cancellation token. + /// The Get Maestro Workflow Definition response. + public virtual async Task GetMaestroWorkflowDefinitionAsync(string accountId, string workflowId, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(accountId.ToString())}/maestro-workflows/{Uri.EscapeDataString(workflowId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Start Docusign Maestro workflow + /// + /// Start Docusign Maestro workflow + /// Account + /// workflow + /// The request body. + /// instance Name + /// Cancellation token. + /// The Start Docusign Maestro workflow response. + public virtual async Task TriggerMaestroFlowAsync([DynamicValues("GetLoginAccounts")] string account, [DynamicValues("GetMaestroWorkflowDefinitions")] string workflow, MaestroInputVariables input, string instanceName, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"instanceName={Uri.EscapeDataString(instanceName.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/maestro-workflows/trigger/{Uri.EscapeDataString(workflow.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// StaticResponseForTabTypes + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The StaticResponseForTabTypes response. + public virtual async Task StaticResponseForTabTypesAsync(CancellationToken cancellationToken = default) + { + var path = $"/tab_types"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// StaticResponseForRecipientTypes + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The StaticResponseForRecipientTypes response. + public virtual async Task StaticResponseForRecipientTypesAsync(CancellationToken cancellationToken = default) + { + var path = $"/recipient_types"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// StaticResponseForSignatureTypes + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The StaticResponseForSignatureTypes response. + public virtual async Task StaticResponseForSignatureTypesAsync(CancellationToken cancellationToken = default) + { + var path = $"/signature_types"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// StaticResponseForAnchorTabSchema + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// tab type + /// Cancellation token. + /// The StaticResponseForAnchorTabSchema response. + public virtual async Task StaticResponseForAnchorTabSchemaAsync(string tabType, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"tabType={Uri.EscapeDataString(tabType.ToString())}"); + var path = $"/anchortab_schema" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// StaticResponseForCompositeTemplates + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The StaticResponseForCompositeTemplates response. + public virtual async Task StaticResponseForCompositeTemplatesAsync(CancellationToken cancellationToken = default) + { + var path = $"/composite_templates_schema"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// StaticResponseForRecipientTypeSchema + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// recipient type + /// signature type + /// Cancellation token. + /// The StaticResponseForRecipientTypeSchema response. + public virtual async Task StaticResponseForRecipientTypeSchemaAsync(string recipientType, string signatureType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"recipientType={Uri.EscapeDataString(recipientType.ToString())}"); + if (signatureType != default) + queryParams.Add($"signatureType={Uri.EscapeDataString(signatureType.ToString())}"); + var path = $"/recipienttype_schema" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// StaticResponseForEmbeddedSenderSchema + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Return URL + /// Cancellation token. + /// The StaticResponseForEmbeddedSenderSchema response. + public virtual async Task StaticResponseForEmbeddedSenderSchemaAsync(string returnURL, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"returnUrl={Uri.EscapeDataString(returnURL.ToString())}"); + var path = $"/embeddedSender_schema" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// StaticResponseForVerificationTypeSchema + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Verification Type + /// Cancellation token. + /// The StaticResponseForVerificationTypeSchema response. + public virtual async Task StaticResponseForVerificationTypeSchemaAsync(string verificationType, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"verificationType={Uri.EscapeDataString(verificationType.ToString())}"); + var path = $"/verificationtype_schema" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Show build Number (For reference only. Do not include in a flow for execution) + /// + /// Identifier for the currently deployed build. + /// The request body. + /// Cancellation token. + /// The Show build Number (For reference only. Do not include in a flow for execution) response. + public virtual async Task BuildNumberAsync(BuildNumberSchema input, CancellationToken cancellationToken = default) + { + var path = $"/build_number"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// StaticResponseForBuildNumberSchema + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The StaticResponseForBuildNumberSchema response. + public virtual async Task StaticResponseForBuildNumberSchemaAsync(CancellationToken cancellationToken = default) + { + var path = $"/build_number_schema"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add recipient to an envelope (V2) + /// + /// Add recipient to an envelope. + /// Account + /// Envelope + /// The request body. + /// Recipient type + /// Client User ID + /// Embedded recipient start URL + /// Signing order + /// Email notification language + /// Email notification subject + /// Email notification body + /// Note + /// Role name + /// SMS Country Code + /// SMS Phone Number + /// Signing Group + /// Signature type + /// Verification workflow + /// Cancellation token. + /// The Add recipient to an envelope (V2) response. + public virtual async Task AddRecipientToEnvelopeAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, AdditionalRecipientParamsSchema input, [DynamicValues("StaticResponseForRecipientTypes")] string recipientType, string clientUserId = default, string embeddedRecipientStartURL = default, string signingOrder = default, string emailNotificationLanguage = default, string emailNotificationSubject = default, string emailNotificationBody = default, string note = default, string roleName = default, int? sMSCountryCode = default, int? sMSPhoneNumber = default, [DynamicValues("GetSigningGroups")] string signingGroup = default, [DynamicValues("StaticResponseForSignatureTypes")] string signatureType = default, [DynamicValues("GetAllWorkflowIDs")] string verificationWorkflow = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"recipientType={Uri.EscapeDataString(recipientType.ToString())}"); + if (clientUserId != default) + queryParams.Add($"clientUserId={Uri.EscapeDataString(clientUserId.ToString())}"); + if (embeddedRecipientStartURL != default) + queryParams.Add($"embeddedRecipientStartURL={Uri.EscapeDataString(embeddedRecipientStartURL.ToString())}"); + if (signingOrder != default) + queryParams.Add($"routingOrder={Uri.EscapeDataString(signingOrder.ToString())}"); + if (emailNotificationLanguage != default) + queryParams.Add($"emailNotificationLanguage={Uri.EscapeDataString(emailNotificationLanguage.ToString())}"); + if (emailNotificationSubject != default) + queryParams.Add($"emailNotificationSubject={Uri.EscapeDataString(emailNotificationSubject.ToString())}"); + if (emailNotificationBody != default) + queryParams.Add($"emailNotificationBody={Uri.EscapeDataString(emailNotificationBody.ToString())}"); + if (note != default) + queryParams.Add($"note={Uri.EscapeDataString(note.ToString())}"); + if (roleName != default) + queryParams.Add($"roleName={Uri.EscapeDataString(roleName.ToString())}"); + if (sMSCountryCode.HasValue) + queryParams.Add($"countryCode={Uri.EscapeDataString(sMSCountryCode.Value.ToString())}"); + if (sMSPhoneNumber.HasValue) + queryParams.Add($"phoneNumber={Uri.EscapeDataString(sMSPhoneNumber.Value.ToString())}"); + if (signingGroup != default) + queryParams.Add($"signingGroupId={Uri.EscapeDataString(signingGroup.ToString())}"); + if (signatureType != default) + queryParams.Add($"signatureType={Uri.EscapeDataString(signatureType.ToString())}"); + if (verificationWorkflow != default) + queryParams.Add($"workflowId={Uri.EscapeDataString(verificationWorkflow.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/recipients/addRecipientV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Generate Embedded Signing URL (V2) + /// + /// Generate Embedded Signing URL (V2) + /// Account + /// Envelope + /// The request body. + /// Is this an in-person signer? + /// Authentication Method + /// Return URL + /// Cancellation token. + /// The Generate Embedded Signing URL (V2) response. + public virtual async Task GenerateEmbeddedSigningURLAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, DynamicSigningUrlFields input, string isThisAnInPersonSigner, string authenticationMethod, string returnURL, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"isInPersonSigner={Uri.EscapeDataString(isThisAnInPersonSigner.ToString())}"); + queryParams.Add($"authenticationMethod={Uri.EscapeDataString(authenticationMethod.ToString())}"); + queryParams.Add($"returnUrl={Uri.EscapeDataString(returnURL.ToString())}"); + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/views/recipientV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get documents from an envelope + /// + /// Get documents from an envelope + /// Account + /// Envelope + /// Output format + /// Cancellation token. + /// The Get documents from an envelope response. + public virtual async Task GetDocumentsAsync([DynamicValues("GetLoginAccounts")] string account, string envelope, string outputFormat, CancellationToken cancellationToken = default) + { + var path = $"/accounts/{Uri.EscapeDataString(account.ToString())}/envelopes/{Uri.EscapeDataString(envelope.ToString())}/documents/{Uri.EscapeDataString(outputFormat.ToString())}/documentsDownload"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// StaticResponseForEmbeddedSigningSchemaV2 + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Return URL + /// Is This an Person Signer? + /// Cancellation token. + /// The StaticResponseForEmbeddedSigningSchemaV2 response. + public virtual async Task StaticResponseForEmbeddedSigningSchemaAsync(string returnURL, string isThisAnPersonSigner, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"returnUrl={Uri.EscapeDataString(returnURL.ToString())}"); + queryParams.Add($"isInPersonSigner={Uri.EscapeDataString(isThisAnPersonSigner.ToString())}"); + var path = $"/embeddedSigning_schema_v2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/DocumentdbExtensions.cs b/src/Azure.Connectors.Sdk/Generated/DocumentdbExtensions.cs index ddbb0ce..5e1679b 100644 --- a/src/Azure.Connectors.Sdk/Generated/DocumentdbExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/DocumentdbExtensions.cs @@ -177,10 +177,6 @@ public class GetDocumentResponse /// List of columns along with their Sensitivity Labels [JsonPropertyName("@metadata")] public List Metadata { get; set; } - - /// Dynamic document properties returned by the service. - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); } /// @@ -311,6 +307,10 @@ public class QueryDocumentsResponse /// List of columns along with their Sensitivity Labels [JsonPropertyName("@metadata")] public List Metadata { get; set; } + + /// Dynamic document properties returned by the service. + [JsonPropertyName("additionalProperties")] + public object AdditionalProperties { get; set; } } /// @@ -590,7 +590,8 @@ public static QueryDocumentsResponse QueryDocumentsResponse( double? requestCharge = default, string sessionToken = default, string activityId = default, - List metadata = default) + List metadata = default, + object additionalProperties = default) { return new QueryDocumentsResponse { @@ -601,6 +602,7 @@ public static QueryDocumentsResponse QueryDocumentsResponse( SessionToken = sessionToken, ActivityId = activityId, Metadata = metadata, + AdditionalProperties = additionalProperties, }; } diff --git a/src/Azure.Connectors.Sdk/Generated/DropboxExtensions.cs b/src/Azure.Connectors.Sdk/Generated/DropboxExtensions.cs new file mode 100644 index 0000000..ec67e5e --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/DropboxExtensions.cs @@ -0,0 +1,532 @@ +// DropboxExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Dropbox.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Dropbox.Models +{ + + #region Types + + /// + /// Response for Get file metadata + /// + public class BlobMetadata + { + /// The unique id of the file or folder. + [JsonPropertyName("Id")] + public string Id { get; set; } + + /// The name of the file or folder. + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// The display name of the file or folder. + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + + /// The path of the file or folder. + [JsonPropertyName("Path")] + public string Path { get; set; } + + /// The date and time the file or folder was last modified. + [JsonPropertyName("LastModified")] + [JsonInclude] + public DateTime? LastModified { get; internal set; } + + /// The size of the file or folder. + [JsonPropertyName("Size")] + public long? Size { get; set; } + + /// The media type of the file or folder. + [JsonPropertyName("MediaType")] + public string MediaType { get; set; } + + /// A boolean value (true, false) to indicate whether or not the blob is a folder. + [JsonPropertyName("IsFolder")] + public bool? IsFolder { get; set; } + + /// The etag of the file or folder. + [JsonPropertyName("ETag")] + [JsonInclude] + public string ETag { get; internal set; } + + /// The filelocator of the file or folder. + [JsonPropertyName("FileLocator")] + public string FileLocator { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Dropbox models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class DropboxModelFactory + { + /// + /// Creates a new instance of . + /// + public static BlobMetadata BlobMetadata( + string id = default, + string name = default, + string displayName = default, + string path = default, + DateTime? lastModified = default, + long? size = default, + string mediaType = default, + bool? isFolder = default, + string eTag = default, + string fileLocator = default) + { + return new BlobMetadata + { + Id = id, + Name = name, + DisplayName = displayName, + Path = path, + LastModified = lastModified, + Size = size, + MediaType = mediaType, + IsFolder = isFolder, + ETag = eTag, + FileLocator = fileLocator, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnNewFiles trigger (Dropbox "When a file is created (properties only)", operationId: OnNewFiles). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<DropboxOnNewFilesTriggerPayload>(body). + /// + public class DropboxOnNewFilesTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnUpdatedFiles trigger (Dropbox "When a file is modified (properties only)", operationId: OnUpdatedFiles). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<DropboxOnUpdatedFilesTriggerPayload>(body). + /// + public class DropboxOnUpdatedFilesTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Dropbox connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class DropboxTriggers + { + /// + /// Trigger operations with typed payloads for the Dropbox connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnNewFiles"] = typeof(DropboxOnNewFilesTriggerPayload), + ["OnUpdatedFiles"] = typeof(DropboxOnUpdatedFilesTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Dropbox +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Dropbox connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class DropboxTriggerOperations + { + /// + /// When a file is created. + /// + public const string OnNewFile = "OnNewFile"; + + /// + /// When a file is modified. + /// + public const string OnUpdatedFile = "OnUpdatedFile"; + + /// + /// When a file is created (properties only). + /// Payload type: . + /// + public const string OnNewFiles = "OnNewFiles"; + + /// + /// When a file is modified (properties only). + /// Payload type: . + /// + public const string OnUpdatedFiles = "OnUpdatedFiles"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Dropbox connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class DropboxTriggerParameters + { + /// + /// Input parameters for the OnNewFile trigger operation (operationId: OnNewFile). + /// + public static class OnNewFile + { + /// + /// The unique identifier of the folder. + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// A boolean value (true, false) to infer content-type based on extension. + /// Default: true. + /// + public const string InferContentType = "inferContentType"; + + /// + /// The 'queryParametersSingleEncoded' parameter. + /// Default: true. + /// + public const string QueryParametersSingleEncoded = "queryParametersSingleEncoded"; + + } + + /// + /// Input parameters for the OnUpdatedFile trigger operation (operationId: OnUpdatedFile). + /// + public static class OnUpdatedFile + { + /// + /// The unique identifier of the folder. + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// If set to true, file content will also be retrieved along with the trigger response. + /// Default: true. + /// + public const string IncludeFileContent = "includeFileContent"; + + /// + /// A boolean value (true, false) to infer content-type based on extension. + /// Default: true. + /// + public const string InferContentType = "inferContentType"; + + /// + /// The 'queryParametersSingleEncoded' parameter. + /// Default: true. + /// + public const string QueryParametersSingleEncoded = "queryParametersSingleEncoded"; + + } + + /// + /// Input parameters for the OnNewFiles trigger operation (operationId: OnNewFiles). + /// + public static class OnNewFiles + { + /// + /// The unique identifier of the folder. + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// Maximum number of files to return by single trigger run (1-100). Note that 'Split On' setting can force trigger to process each item individually. + /// Default: 10. + /// + public const string MaxFileCount = "maxFileCount"; + + } + + /// + /// Input parameters for the OnUpdatedFiles trigger operation (operationId: OnUpdatedFiles). + /// + public static class OnUpdatedFiles + { + /// + /// Select a folder + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// Maximum number of files to return by single trigger run (1-100). Note that 'Split On' setting can force trigger to process each item individually. + /// Default: 10. + /// + public const string MaxFileCount = "maxFileCount"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for dropbox connector. + /// + public class DropboxClient : ConnectorClientBase + { + /// + /// Creates a new DropboxClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public DropboxClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new DropboxClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public DropboxClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new DropboxClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public DropboxClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new DropboxClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public DropboxClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected DropboxClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "dropbox"; + + /// + /// Get file metadata + /// + /// This operation gets the metadata for a file. + /// File + /// Cancellation token. + /// The Get file metadata response. + public virtual async Task GetFileMetadataAsync(string @file, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update file + /// + /// This operation updates a file. + /// File + /// The request body. + /// Cancellation token. + /// The Update file response. + public virtual async Task UpdateFileAsync(string @file, byte[] input, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete file + /// + /// This operation deletes a file. + /// File + /// Cancellation token. + public virtual async Task DeleteFileAsync(string @file, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file metadata using path + /// + /// This operation gets the metadata of a file using the path. + /// File Path + /// Cancellation token. + /// The Get file metadata using path response. + public virtual async Task GetFileMetadataByPathAsync(string filePath, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + var path = $"/datasets/default/GetFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file content using path + /// + /// This operation gets the content of a file using the path. + /// File Path + /// Infer Content Type + /// Cancellation token. + /// The Get file content using path response. + public virtual async Task GetFileContentByPathAsync(string filePath, bool? inferContentType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); + var path = $"/datasets/default/GetFileContentByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file content + /// + /// This operation gets the content of a file. + /// File + /// Infer Content Type + /// Cancellation token. + /// The Get file content response. + public virtual async Task GetFileContentAsync(string @file, bool? inferContentType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/content" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create file + /// + /// This operation creates a file in a folder. + /// The request body. + /// Folder Path + /// File Name + /// Cancellation token. + /// The Create file response. + public virtual async Task CreateFileAsync(byte[] input, string folderPath, string fileName, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"folderPath={Uri.EscapeDataString(folderPath.ToString())}"); + queryParams.Add($"name={Uri.EscapeDataString(fileName.ToString())}"); + var path = $"/datasets/default/files" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copy file + /// + /// This operation copies a file to Dropbox. + /// Source URL + /// Destination File Path + /// Overwrite + /// Cancellation token. + /// The Copy file response. + public virtual async Task CopyFileAsync(string sourceURL, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"source={Uri.EscapeDataString(sourceURL.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/copyFile" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Extract archive to folder + /// + /// This operation extracts an archive file into a folder (example: .zip). + /// Source Archive File Path + /// Destination Folder Path + /// Overwrite + /// Cancellation token. + /// The Extract archive to folder response. + public virtual async Task> ExtractFolderAsync(string sourceArchiveFilePath, string destinationFolderPath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"source={Uri.EscapeDataString(sourceArchiveFilePath.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFolderPath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/extractFolderV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/DynamicsAXExtensions.cs b/src/Azure.Connectors.Sdk/Generated/DynamicsAXExtensions.cs new file mode 100644 index 0000000..ae80009 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/DynamicsAXExtensions.cs @@ -0,0 +1,1197 @@ +// DynamicsAXExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.DynamicsAX.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.DynamicsAX.Models +{ + + #region Types + + /// + /// Response for Get actions metadata + /// + public class ProcedureMetadata + { + /// Procedure name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Procedure title + [JsonPropertyName("title")] + public string Title { get; set; } + + /// schema + [JsonPropertyName("schema")] + public ObjectEntity Schema { get; set; } + } + + /// + /// schema + /// + public class ObjectEntity + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get metadata of a exportable table + /// + public class TableMetadata + { + /// Table name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Table title + [JsonPropertyName("title")] + public string Title { get; set; } + + /// Table permission + [JsonPropertyName("x-ms-permission")] + public string XMsPermission { get; set; } + + /// x-ms-capabilities + [JsonPropertyName("x-ms-capabilities")] + public TableCapabilitiesMetadata XMsCapabilities { get; set; } + + /// schema + [JsonPropertyName("schema")] + public ObjectEntity Schema { get; set; } + + /// referencedEntities + [JsonPropertyName("referencedEntities")] + public ObjectEntity ReferencedEntities { get; set; } + + /// Url link + [JsonPropertyName("webUrl")] + public string WebUrl { get; set; } + } + + /// + /// x-ms-capabilities + /// + public class TableCapabilitiesMetadata + { + /// sortRestrictions + [JsonPropertyName("sortRestrictions")] + public TableSortRestrictionsMetadata SortRestrictions { get; set; } + + /// filterRestrictions + [JsonPropertyName("filterRestrictions")] + public TableFilterRestrictionsMetadata FilterRestrictions { get; set; } + + /// selectRestrictions + [JsonPropertyName("selectRestrictions")] + public TableSelectRestrictionsMetadata SelectRestrictions { get; set; } + + /// Server paging restrictions + [JsonPropertyName("isOnlyServerPagable")] + public bool? IsOnlyServerPagable { get; set; } + + /// List of supported filter capabilities + [JsonPropertyName("filterFunctionSupport")] + public List FilterFunctionSupport { get; set; } + + /// List of supported server-driven paging capabilities + [JsonPropertyName("serverPagingOptions")] + public List ServerPagingOptions { get; set; } + } + + /// + /// sortRestrictions + /// + public class TableSortRestrictionsMetadata + { + /// Indicates whether this table has sortable columns + [JsonPropertyName("sortable")] + public bool? Sortable { get; set; } + + /// List of unsortable properties + [JsonPropertyName("unsortableProperties")] + public List UnsortableProperties { get; set; } + + /// List of properties which support ascending order only + [JsonPropertyName("ascendingOnlyProperties")] + public List AscendingOnlyProperties { get; set; } + } + + /// + /// filterRestrictions + /// + public class TableFilterRestrictionsMetadata + { + /// Indicates whether this table has filterable columns + [JsonPropertyName("filterable")] + public bool? Filterable { get; set; } + + /// List of non filterable properties + [JsonPropertyName("nonFilterableProperties")] + public List NonFilterableProperties { get; set; } + + /// List of required properties + [JsonPropertyName("requiredProperties")] + public List RequiredProperties { get; set; } + } + + /// + /// selectRestrictions + /// + public class TableSelectRestrictionsMetadata + { + /// Indicates whether this table has selectable columns + [JsonPropertyName("selectable")] + public bool? Selectable { get; set; } + } + + /// + /// Response for When a Business Event occurs + /// + public class BusinessEventSubscriptionResponse + { + /// Id of the subscription + [JsonPropertyName("id")] + public string Id { get; set; } + + /// Resource of the subscription request + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// Notification Type + [JsonPropertyName("notificationType")] + public string NotificationType { get; set; } + + /// Notification Url + [JsonPropertyName("notificationUrl")] + public string NotificationUrl { get; set; } + } + + /// + /// Response for Gets legal entities + /// + public class TriggerFieldDataList + { + /// List of business event categories + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in List of business event categories + /// + public class TriggerFieldData + { + /// Business event data name + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// Business event data display name + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + } + + /// + /// Response for Gets business events + /// + public class BusinessEventsList + { + /// List of business events + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in List of business events + /// + public class BusinessEventData + { + /// Business event Id + [JsonPropertyName("Id")] + public string Id { get; set; } + + /// Business event data name + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// Business event data display name + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + } + + /// + /// Response for Get actions + /// + public class ProceduresList + { + /// List of Procedures + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in List of Procedures + /// + public class Procedure + { + /// Procedure name + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// Procedure display name + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + } + + /// + /// Execute action + /// + [DynamicSchema("GetProcedure")] + public class ExecuteProcedureInput + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Execute action + /// + public class AxOnlineProcedureResult + { + /// Output parameter values + [JsonPropertyName("value")] + public string Value { get; set; } + + /// Output parameter values + [JsonPropertyName("OutputParameters")] + [JsonInclude] + public object OutputParameters { get; internal set; } + } + + /// + /// Response for Get instances + /// + public class DataSetsList + { + /// List of datasets + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in List of datasets + /// + public class DataSet + { + /// Dataset name + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// Dataset display name + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + + /// Pass-through Native Queries + [JsonPropertyName("query")] + [JsonInclude] + public List Query { get; internal set; } + } + + /// + /// Item in Pass-through Native Queries + /// + public class PassThroughNativeQuery + { + /// Query language + [JsonPropertyName("Language")] + public string Language { get; set; } + } + + /// + /// Response for Lists items present in table + /// + public class ItemsList + { + /// List of Items + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in List of Items + /// + [DynamicSchema("GetTable")] + public class Item + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + + /// dynamicProperties + [JsonPropertyName("dynamicProperties")] + public object DynamicProperties { get; set; } + } + + /// + /// Create record + /// + [DynamicSchema("GetTable")] + public class PostItemInput + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Create record + /// + [DynamicSchema("GetTable")] + public class PostItemResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get a record + /// + [DynamicSchema("GetTable")] + public class GetItemResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Update a record + /// + [DynamicSchema("GetTable")] + public class PatchItemInput + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Update a record + /// + [DynamicSchema("GetTable")] + public class PatchItemResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Lists exportable tables + /// + public class TablesList + { + /// List of Tables + [JsonPropertyName("value")] + public List
Value { get; set; } + } + + /// + /// Item in List of Tables + /// + public class Table + { + /// The name of the table. The name is used at runtime. + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// The display name of the table. + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + + /// Additional table properties provided by the connector to the clients. + [JsonPropertyName("DynamicProperties")] + [JsonInclude] + public object DynamicProperties { get; internal set; } + } + + /// + /// BusinessEventSubscription + /// + public class BusinessEventSubscription + { + /// Callback URL to the flow engine. Expected as part of the request and provided by Flow. + [JsonPropertyName("NotificationUrl")] + public string NotificationUrl { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of DynamicsAX models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class DynamicsAXModelFactory + { + /// + /// Creates a new instance of . + /// + public static ProcedureMetadata ProcedureMetadata( + string name = default, + string title = default, + ObjectEntity schema = default) + { + return new ProcedureMetadata + { + Name = name, + Title = title, + Schema = schema, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableMetadata TableMetadata( + string name = default, + string title = default, + string xMsPermission = default, + TableCapabilitiesMetadata xMsCapabilities = default, + ObjectEntity schema = default, + ObjectEntity referencedEntities = default, + string webUrl = default) + { + return new TableMetadata + { + Name = name, + Title = title, + XMsPermission = xMsPermission, + XMsCapabilities = xMsCapabilities, + Schema = schema, + ReferencedEntities = referencedEntities, + WebUrl = webUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableCapabilitiesMetadata TableCapabilitiesMetadata( + TableSortRestrictionsMetadata sortRestrictions = default, + TableFilterRestrictionsMetadata filterRestrictions = default, + TableSelectRestrictionsMetadata selectRestrictions = default, + bool? isOnlyServerPagable = default, + List filterFunctionSupport = default, + List serverPagingOptions = default) + { + return new TableCapabilitiesMetadata + { + SortRestrictions = sortRestrictions, + FilterRestrictions = filterRestrictions, + SelectRestrictions = selectRestrictions, + IsOnlyServerPagable = isOnlyServerPagable, + FilterFunctionSupport = filterFunctionSupport, + ServerPagingOptions = serverPagingOptions, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableSortRestrictionsMetadata TableSortRestrictionsMetadata( + bool? sortable = default, + List unsortableProperties = default, + List ascendingOnlyProperties = default) + { + return new TableSortRestrictionsMetadata + { + Sortable = sortable, + UnsortableProperties = unsortableProperties, + AscendingOnlyProperties = ascendingOnlyProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableFilterRestrictionsMetadata TableFilterRestrictionsMetadata( + bool? filterable = default, + List nonFilterableProperties = default, + List requiredProperties = default) + { + return new TableFilterRestrictionsMetadata + { + Filterable = filterable, + NonFilterableProperties = nonFilterableProperties, + RequiredProperties = requiredProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableSelectRestrictionsMetadata TableSelectRestrictionsMetadata( + bool? selectable = default) + { + return new TableSelectRestrictionsMetadata + { + Selectable = selectable, + }; + } + + /// + /// Creates a new instance of . + /// + public static BusinessEventSubscriptionResponse BusinessEventSubscriptionResponse( + string id = default, + string resource = default, + string notificationType = default, + string notificationUrl = default) + { + return new BusinessEventSubscriptionResponse + { + Id = id, + Resource = resource, + NotificationType = notificationType, + NotificationUrl = notificationUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static TriggerFieldDataList TriggerFieldDataList( + List value = default) + { + return new TriggerFieldDataList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static TriggerFieldData TriggerFieldData( + string name = default, + string displayName = default) + { + return new TriggerFieldData + { + Name = name, + DisplayName = displayName, + }; + } + + /// + /// Creates a new instance of . + /// + public static BusinessEventsList BusinessEventsList( + List value = default) + { + return new BusinessEventsList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static BusinessEventData BusinessEventData( + string id = default, + string name = default, + string displayName = default) + { + return new BusinessEventData + { + Id = id, + Name = name, + DisplayName = displayName, + }; + } + + /// + /// Creates a new instance of . + /// + public static ProceduresList ProceduresList( + List value = default) + { + return new ProceduresList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static Procedure Procedure( + string name = default, + string displayName = default) + { + return new Procedure + { + Name = name, + DisplayName = displayName, + }; + } + + /// + /// Creates a new instance of . + /// + public static AxOnlineProcedureResult AxOnlineProcedureResult( + string value = default, + object outputParameters = default) + { + return new AxOnlineProcedureResult + { + Value = value, + OutputParameters = outputParameters, + }; + } + + /// + /// Creates a new instance of . + /// + public static DataSetsList DataSetsList( + List value = default) + { + return new DataSetsList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static DataSet DataSet( + string name = default, + string displayName = default, + List query = default) + { + return new DataSet + { + Name = name, + DisplayName = displayName, + Query = query, + }; + } + + /// + /// Creates a new instance of . + /// + public static PassThroughNativeQuery PassThroughNativeQuery( + string language = default) + { + return new PassThroughNativeQuery + { + Language = language, + }; + } + + /// + /// Creates a new instance of . + /// + public static ItemsList ItemsList( + List value = default) + { + return new ItemsList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static Item Item( + object dynamicProperties = default) + { + return new Item + { + DynamicProperties = dynamicProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static TablesList TablesList( + List
value = default) + { + return new TablesList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static Table Table( + string name = default, + string displayName = default, + object dynamicProperties = default) + { + return new Table + { + Name = name, + DisplayName = displayName, + DynamicProperties = dynamicProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static BusinessEventSubscription BusinessEventSubscription( + string notificationUrl = default) + { + return new BusinessEventSubscription + { + NotificationUrl = notificationUrl, + }; + } + } + + #endregion Model Factory + +} + +namespace Azure.Connectors.Sdk.DynamicsAX +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the DynamicsAX connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class DynamicsAXTriggerOperations + { + /// + /// When a Business Event occurs. + /// + public const string OnSubscribeOnABusinessEvent = "SubscribeOnABusinessEvent"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the DynamicsAX connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class DynamicsAXTriggerParameters + { + /// + /// Input parameters for the OnSubscribeOnABusinessEvent trigger operation (operationId: SubscribeOnABusinessEvent). + /// + public static class OnSubscribeOnABusinessEvent + { + /// + /// Business event category. + /// Required. + /// Dynamic values from: GetBusinessEventCategories. + /// + public const string Businesseventcategory = "businesseventcategory"; + + /// + /// Name of the legal entity. + /// Dynamic values from: GetLegalEntities. + /// + public const string LegalEntity = "legalEntity"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for dynamicsax connector. + /// + public class DynamicsAXClient : ConnectorClientBase + { + /// + /// Creates a new DynamicsAXClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public DynamicsAXClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new DynamicsAXClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public DynamicsAXClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new DynamicsAXClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public DynamicsAXClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new DynamicsAXClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public DynamicsAXClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected DynamicsAXClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "dynamicsax"; + + /// + /// Get actions metadata + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Instance + /// Action + /// Cancellation token. + /// The Get actions metadata response. + public virtual async Task GetProcedureAsync([DynamicValues("GetDataSets")] string instance, [DynamicValues("GetProcedures")] string action, CancellationToken cancellationToken = default) + { + var path = $"/$metadata.json/datasets/{Uri.EscapeDataString(instance.ToString())}/procedures/{Uri.EscapeDataString(action.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get metadata of a exportable table + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// dataset name + /// table name + /// Cancellation token. + /// The Get metadata of a exportable table response. + public virtual async Task GetExportableTableAsync([DynamicValues("GetDataSets")] string datasetName, [DynamicValues("GetExportableTables")] string tableName, CancellationToken cancellationToken = default) + { + var path = $"/$metadata.json/datasets/{Uri.EscapeDataString(datasetName.ToString())}/exportabletables/{Uri.EscapeDataString(tableName.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get entity metadata + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Instance + /// Entity name + /// Cancellation token. + /// The Get entity metadata response. + public virtual async Task GetTableAsync([DynamicValues("GetDataSets")] string instance, [DynamicValues("GetTables")] string entityName, CancellationToken cancellationToken = default) + { + var path = $"/$metadata.json/datasets/{Uri.EscapeDataString(instance.ToString())}/tables/{Uri.EscapeDataString(entityName.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Gets legal entities + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Instance + /// Category + /// Business event + /// Cancellation token. + /// The Gets legal entities response. + public virtual async Task GetLegalEntitiesAsync([DynamicValues("GetDataSets")] string instance, [DynamicValues("GetBusinessEventCategories")] string category, [DynamicValues("GetBusinessEvents")] string businessEvent, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"businesseventcategory={Uri.EscapeDataString(category.ToString())}"); + queryParams.Add($"businessevent={Uri.EscapeDataString(businessEvent.ToString())}"); + var path = $"/datasets/{Uri.EscapeDataString(instance.ToString())}/legalentities" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Gets business events categories + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Instance + /// Cancellation token. + /// The Gets business events categories response. + public virtual async Task GetBusinessEventCategoriesAsync([DynamicValues("GetDataSets")] string instance, CancellationToken cancellationToken = default) + { + var path = $"/datasets/{Uri.EscapeDataString(instance.ToString())}/businesseventcategories"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Gets business events + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Instance + /// BusinessEventCategory + /// Cancellation token. + /// The Gets business events response. + public virtual async Task GetBusinessEventsAsync([DynamicValues("GetDataSets")] string instance, [DynamicValues("GetBusinessEventCategories")] string businessEventCategory, CancellationToken cancellationToken = default) + { + var path = $"/datasets/{Uri.EscapeDataString(instance.ToString())}/businesseventcategories/{Uri.EscapeDataString(businessEventCategory.ToString())}/businessevents"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get actions + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Instance + /// Cancellation token. + /// The Get actions response. + public virtual async Task GetProceduresAsync([DynamicValues("GetDataSets")] string instance, CancellationToken cancellationToken = default) + { + var path = $"/datasets/{Uri.EscapeDataString(instance.ToString())}/procedures"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Execute action + /// + /// Execute action + /// Instance + /// Action + /// The request body. + /// Cancellation token. + /// The Execute action response. + public virtual async Task ExecuteProcedureAsync([DynamicValues("GetDataSets")] string instance, [DynamicValues("GetProcedures")] string action, ExecuteProcedureInput input, CancellationToken cancellationToken = default) + { + var path = $"/datasets/{Uri.EscapeDataString(instance.ToString())}/procedures/{Uri.EscapeDataString(action.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get instances + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The Get instances response. + public virtual async Task GetDataSetsAsync(CancellationToken cancellationToken = default) + { + var path = $"/datasets"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Lists items present in table + /// + /// Lists items present in table + /// Instance + /// Entity name + /// Aggregation transformation + /// Filter Query + /// Order By + /// Top Count + /// Skip Count + /// Select Query + /// Cross Company + /// Cancellation token. + /// The Lists items present in table response. + public virtual async Task GetItemsAsync([DynamicValues("GetDataSets")] string instance, [DynamicValues("GetTables")] string entityName, string aggregationTransformation = default, string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, string selectQuery = default, bool? crossCompany = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (aggregationTransformation != default) + queryParams.Add($"$apply={Uri.EscapeDataString(aggregationTransformation.ToString())}"); + if (filterQuery != default) + queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); + if (orderBy != default) + queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); + if (selectQuery != default) + queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); + if (crossCompany.HasValue) + queryParams.Add($"cross-company={Uri.EscapeDataString(crossCompany.Value.ToString())}"); + var path = $"/datasets/{Uri.EscapeDataString(instance.ToString())}/tables/{Uri.EscapeDataString(entityName.ToString())}/items" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create record + /// + /// Create a new record in an entity + /// Instance + /// Entity name + /// The request body. + /// Cancellation token. + /// The Create record response. + public virtual async Task PostItemAsync([DynamicValues("GetDataSets")] string instance, [DynamicValues("GetTables")] string entityName, PostItemInput input, CancellationToken cancellationToken = default) + { + var path = $"/datasets/{Uri.EscapeDataString(instance.ToString())}/tables/{Uri.EscapeDataString(entityName.ToString())}/items"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get a record + /// + /// Retrieves a single record + /// Instance + /// Entity name + /// Object id + /// Cancellation token. + /// The Get a record response. + public virtual async Task GetItemAsync([DynamicValues("GetDataSets")] string instance, [DynamicValues("GetTables")] string entityName, string objectId, CancellationToken cancellationToken = default) + { + var path = $"/datasets/{Uri.EscapeDataString(instance.ToString())}/tables/{Uri.EscapeDataString(entityName.ToString())}/items/{Uri.EscapeDataString(objectId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete record + /// + /// Deletes a single record in an entity + /// Instance + /// Entity name + /// Object id + /// Cancellation token. + public virtual async Task DeleteItemAsync([DynamicValues("GetDataSets")] string instance, [DynamicValues("GetTables")] string entityName, string objectId, CancellationToken cancellationToken = default) + { + var path = $"/datasets/{Uri.EscapeDataString(instance.ToString())}/tables/{Uri.EscapeDataString(entityName.ToString())}/items/{Uri.EscapeDataString(objectId.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update a record + /// + /// Updates a single record in an entity + /// Instance + /// Entity name + /// Object id + /// The request body. + /// Cancellation token. + /// The Update a record response. + public virtual async Task PatchItemAsync([DynamicValues("GetDataSets")] string instance, [DynamicValues("GetTables")] string entityName, string objectId, PatchItemInput input, CancellationToken cancellationToken = default) + { + var path = $"/datasets/{Uri.EscapeDataString(instance.ToString())}/tables/{Uri.EscapeDataString(entityName.ToString())}/items/{Uri.EscapeDataString(objectId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Patch, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Lists exportable tables + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// dataset name + /// Cancellation token. + /// The Lists exportable tables response. + public virtual async Task GetExportableTablesAsync([DynamicValues("GetDataSets")] string datasetName, CancellationToken cancellationToken = default) + { + var path = $"/datasets/{Uri.EscapeDataString(datasetName.ToString())}/exportabletables"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get list of entities + /// + /// Retrieves a list of entities + /// Instance + /// Cancellation token. + /// The Get list of entities response. + public virtual async Task GetTablesAsync([DynamicValues("GetDataSets")] string instance, CancellationToken cancellationToken = default) + { + var path = $"/datasets/{Uri.EscapeDataString(instance.ToString())}/tables"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/EventbriteExtensions.cs b/src/Azure.Connectors.Sdk/Generated/EventbriteExtensions.cs new file mode 100644 index 0000000..c927692 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/EventbriteExtensions.cs @@ -0,0 +1,615 @@ +// EventbriteExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Eventbrite.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Eventbrite.Models +{ + + #region Types + + /// + /// Response for Get categories + /// + public class GetCategoriesResponse + { + /// categories + [JsonPropertyName("categories")] + public List Categories { get; set; } + } + + /// + /// Response for Get organization events + /// + public class GetMyEventsResponse + { + /// events + [JsonPropertyName("events")] + public List Events { get; set; } + } + + /// + /// Response for Create event (V2) + /// + public class CreateEventResponse + { + /// name + [JsonPropertyName("name")] + public object Name { get; set; } + + /// description + [JsonPropertyName("description")] + public object Description { get; set; } + + /// The id of the event. + [JsonPropertyName("id")] + public string Id { get; set; } + + /// The URL of the event. + [JsonPropertyName("url")] + public string URL { get; set; } + + /// start + [JsonPropertyName("start")] + public object Start { get; set; } + + /// end + [JsonPropertyName("end")] + public object End { get; set; } + + /// The date-time the event was created at. + [JsonPropertyName("created")] + [JsonInclude] + public DateTime? CreatedDateTime { get; internal set; } + + /// The date-time the event was changed at. + [JsonPropertyName("changed")] + [JsonInclude] + public DateTime? ChagedDateTime { get; internal set; } + + /// The capacity of the event. + [JsonPropertyName("capacity")] + public int? Capacity { get; set; } + + /// A boolean indicating whether or not the event is online. + [JsonPropertyName("online_event")] + public bool? IsOnlineEvent { get; set; } + + /// The id of the organizer of the event. + [JsonPropertyName("organizer_id")] + public string OrganizerId { get; set; } + + /// The id of the venue of the event. + [JsonPropertyName("venue_id")] + public string VenueId { get; set; } + + /// The id of the category of the event. + [JsonPropertyName("category_id")] + public string CategoryId { get; set; } + } + + /// + /// Response for Get venues (V2) + /// + public class GetMyVenuesResponse + { + /// venues + [JsonPropertyName("venues")] + public List Venue { get; set; } + } + + /// + /// Response for Get organizers (V2) + /// + public class GetOrganizersResponse + { + /// organizers + [JsonPropertyName("organizers")] + public List Organizer { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Eventbrite models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class EventbriteModelFactory + { + /// + /// Creates a new instance of . + /// + public static GetCategoriesResponse GetCategoriesResponse( + List categories = default) + { + return new GetCategoriesResponse + { + Categories = categories, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetMyEventsResponse GetMyEventsResponse( + List events = default) + { + return new GetMyEventsResponse + { + Events = events, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateEventResponse CreateEventResponse( + object name = default, + object description = default, + string id = default, + string url = default, + object start = default, + object end = default, + DateTime? createdDateTime = default, + DateTime? chagedDateTime = default, + int? capacity = default, + bool? isOnlineEvent = default, + string organizerId = default, + string venueId = default, + string categoryId = default) + { + return new CreateEventResponse + { + Name = name, + Description = description, + Id = id, + URL = url, + Start = start, + End = end, + CreatedDateTime = createdDateTime, + ChagedDateTime = chagedDateTime, + Capacity = capacity, + IsOnlineEvent = isOnlineEvent, + OrganizerId = organizerId, + VenueId = venueId, + CategoryId = categoryId, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetMyVenuesResponse GetMyVenuesResponse( + List venue = default) + { + return new GetMyVenuesResponse + { + Venue = venue, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetOrganizersResponse GetOrganizersResponse( + List organizer = default) + { + return new GetOrganizersResponse + { + Organizer = organizer, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnNewEvent trigger (Eventbrite "When an event is created (V2)", operationId: OnNewEventV2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<EventbriteOnNewEventTriggerPayload>(body). + /// + public class EventbriteOnNewEventTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnOrderChanged trigger (Eventbrite "When an order changes (V2)", operationId: OnOrderChangedV2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<EventbriteOnOrderChangedTriggerPayload>(body). + /// + public class EventbriteOnOrderChangedTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Eventbrite connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class EventbriteTriggers + { + /// + /// Trigger operations with typed payloads for the Eventbrite connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnNewEventV2"] = typeof(EventbriteOnNewEventTriggerPayload), + ["OnOrderChangedV2"] = typeof(EventbriteOnOrderChangedTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Eventbrite +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Eventbrite connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class EventbriteTriggerOperations + { + /// + /// When an event is created (V2). + /// Payload type: . + /// + public const string OnNewEvent = "OnNewEventV2"; + + /// + /// When an order changes (V2). + /// Payload type: . + /// + public const string OnOrderChanged = "OnOrderChangedV2"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Eventbrite connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class EventbriteTriggerParameters + { + /// + /// Input parameters for the OnNewEvent trigger operation (operationId: OnNewEventV2). + /// + public static class OnNewEvent + { + /// + /// The organizer of the event. + /// Required. + /// Dynamic values from: GetOrganizersV2. + /// + public const string OrganizerFilter = "organizer_filter"; + + /// + /// The order events should be returned in + /// Required. + /// Default: created_desc. + /// + public const string OrderBy = "order_by"; + + } + + /// + /// Input parameters for the OnOrderChanged trigger operation (operationId: OnOrderChangedV2). + /// + public static class OnOrderChanged + { + /// + /// Select the organization. + /// Required. + /// Dynamic values from: GetOrganizations. + /// + public const string OrganizationId = "organization_id"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for eventbrite connector. + /// + public class EventbriteClient : ConnectorClientBase + { + /// + /// Creates a new EventbriteClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public EventbriteClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new EventbriteClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public EventbriteClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new EventbriteClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public EventbriteClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new EventbriteClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public EventbriteClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected EventbriteClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "eventbrite"; + + /// + /// Get categories + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The Get categories response. + public virtual async Task GetCategoriesAsync(CancellationToken cancellationToken = default) + { + var path = $"/v3/categories/"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// GetOrganizations + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The GetOrganizations response. + public virtual async Task> GetOrganizationsAsync(CancellationToken cancellationToken = default) + { + var path = $"/v3/users/me/organizations/"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get organization events + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Organization + /// Order By + /// Status + /// Cancellation token. + /// The Get organization events response. + public virtual async Task GetOrganizationEventsAsync([DynamicValues("GetOrganizations")] string organization, string orderBy, string status, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"order_by={Uri.EscapeDataString(orderBy.ToString())}"); + queryParams.Add($"status={Uri.EscapeDataString(status.ToString())}"); + var path = $"/v3/organizations/{Uri.EscapeDataString(organization.ToString())}/events/" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create event (V2) + /// + /// Create a new Eventbrite event. + /// Organization + /// Name + /// Description + /// Start + /// End + /// Start timezone + /// End timezone + /// Event currency + /// Organizer + /// Venue + /// Category + /// Password + /// Capacity + /// Shareable + /// Invite Only + /// Online Event + /// Listed + /// Hide start date + /// Hide end date + /// Show Remaining + /// Cancellation token. + /// The Create event (V2) response. + public virtual async Task CreateEventAsync([DynamicValues("GetOrganizations")] string organization, string name, string description, string start, string end, string startTimezone, string endTimezone, string eventCurrency, [DynamicValues("GetOrganizersV2")] string organizer = default, [DynamicValues("GetMyVenuesV2")] string venue = default, [DynamicValues("GetCategories")] string category = default, string password = default, string capacity = default, bool? shareable = default, bool? inviteOnly = default, bool? onlineEvent = default, bool? listed = default, bool? hideStartDate = default, bool? hideEndDate = default, bool? showRemaining = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"event.name.html={Uri.EscapeDataString(name.ToString())}"); + queryParams.Add($"event.description.html={Uri.EscapeDataString(description.ToString())}"); + queryParams.Add($"event.start.utc={Uri.EscapeDataString(start.ToString())}"); + queryParams.Add($"event.end.utc={Uri.EscapeDataString(end.ToString())}"); + queryParams.Add($"event.start.timezone={Uri.EscapeDataString(startTimezone.ToString())}"); + queryParams.Add($"event.end.timezone={Uri.EscapeDataString(endTimezone.ToString())}"); + queryParams.Add($"event.currency={Uri.EscapeDataString(eventCurrency.ToString())}"); + if (organizer != default) + queryParams.Add($"event.organizer_id={Uri.EscapeDataString(organizer.ToString())}"); + if (venue != default) + queryParams.Add($"event.venue_id={Uri.EscapeDataString(venue.ToString())}"); + if (category != default) + queryParams.Add($"event.category_id={Uri.EscapeDataString(category.ToString())}"); + if (password != default) + queryParams.Add($"event.password={Uri.EscapeDataString(password.ToString())}"); + if (capacity != default) + queryParams.Add($"event.capacity={Uri.EscapeDataString(capacity.ToString())}"); + if (shareable.HasValue) + queryParams.Add($"event.shareable={Uri.EscapeDataString(shareable.Value.ToString())}"); + if (inviteOnly.HasValue) + queryParams.Add($"event.invite_only={Uri.EscapeDataString(inviteOnly.Value.ToString())}"); + if (onlineEvent.HasValue) + queryParams.Add($"event.online_event={Uri.EscapeDataString(onlineEvent.Value.ToString())}"); + if (listed.HasValue) + queryParams.Add($"event.listed={Uri.EscapeDataString(listed.Value.ToString())}"); + if (hideStartDate.HasValue) + queryParams.Add($"event.hide_start_date={Uri.EscapeDataString(hideStartDate.Value.ToString())}"); + if (hideEndDate.HasValue) + queryParams.Add($"event.hide_end_date={Uri.EscapeDataString(hideEndDate.Value.ToString())}"); + if (showRemaining.HasValue) + queryParams.Add($"event.show_remaining={Uri.EscapeDataString(showRemaining.Value.ToString())}"); + var path = $"/v3/organizations/{Uri.EscapeDataString(organization.ToString())}/events/" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get venues (V2) + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Organization + /// Cancellation token. + /// The Get venues (V2) response. + public virtual async Task GetMyVenuesAsync([DynamicValues("GetOrganizations")] string organization, CancellationToken cancellationToken = default) + { + var path = $"/v3/organizations/{Uri.EscapeDataString(organization.ToString())}/venues/"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get organizers (V2) + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Organization + /// Cancellation token. + /// The Get organizers (V2) response. + public virtual async Task GetOrganizersAsync([DynamicValues("GetOrganizations")] string organization, CancellationToken cancellationToken = default) + { + var path = $"/v3/organizations/{Uri.EscapeDataString(organization.ToString())}/organizers/"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update event (V2) + /// + /// Update an existing event. + /// Event + /// Organization + /// Name + /// Description + /// Start + /// End + /// Start timezone + /// End timezone + /// Event currency + /// Organizer + /// Venue + /// Category + /// Password + /// Capacity + /// Shareable + /// Invite Only + /// Online Event + /// Listed + /// Hide start date + /// Hide end date + /// Show Remaining + /// Cancellation token. + /// The Update event (V2) response. + public virtual async Task UpdateEventAsync([DynamicValues("GetOrganizationEvents")] string @event, [DynamicValues("GetOrganizations")] string organization, string startTimezone, string endTimezone, string eventCurrency, string name = default, string description = default, string start = default, string end = default, [DynamicValues("GetOrganizersV2")] string organizer = default, [DynamicValues("GetMyVenuesV2")] string venue = default, [DynamicValues("GetCategories")] string category = default, string password = default, string capacity = default, bool? shareable = default, bool? inviteOnly = default, bool? onlineEvent = default, bool? listed = default, bool? hideStartDate = default, bool? hideEndDate = default, bool? showRemaining = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"organization_id={Uri.EscapeDataString(organization.ToString())}"); + if (name != default) + queryParams.Add($"event.name.html={Uri.EscapeDataString(name.ToString())}"); + if (description != default) + queryParams.Add($"event.description.html={Uri.EscapeDataString(description.ToString())}"); + if (start != default) + queryParams.Add($"event.start.utc={Uri.EscapeDataString(start.ToString())}"); + if (end != default) + queryParams.Add($"event.end.utc={Uri.EscapeDataString(end.ToString())}"); + queryParams.Add($"event.start.timezone={Uri.EscapeDataString(startTimezone.ToString())}"); + queryParams.Add($"event.end.timezone={Uri.EscapeDataString(endTimezone.ToString())}"); + queryParams.Add($"event.currency={Uri.EscapeDataString(eventCurrency.ToString())}"); + if (organizer != default) + queryParams.Add($"event.organizer_id={Uri.EscapeDataString(organizer.ToString())}"); + if (venue != default) + queryParams.Add($"event.venue_id={Uri.EscapeDataString(venue.ToString())}"); + if (category != default) + queryParams.Add($"event.category_id={Uri.EscapeDataString(category.ToString())}"); + if (password != default) + queryParams.Add($"event.password={Uri.EscapeDataString(password.ToString())}"); + if (capacity != default) + queryParams.Add($"event.capacity={Uri.EscapeDataString(capacity.ToString())}"); + if (shareable.HasValue) + queryParams.Add($"event.shareable={Uri.EscapeDataString(shareable.Value.ToString())}"); + if (inviteOnly.HasValue) + queryParams.Add($"event.invite_only={Uri.EscapeDataString(inviteOnly.Value.ToString())}"); + if (onlineEvent.HasValue) + queryParams.Add($"event.online_event={Uri.EscapeDataString(onlineEvent.Value.ToString())}"); + if (listed.HasValue) + queryParams.Add($"event.listed={Uri.EscapeDataString(listed.Value.ToString())}"); + if (hideStartDate.HasValue) + queryParams.Add($"event.hide_start_date={Uri.EscapeDataString(hideStartDate.Value.ToString())}"); + if (hideEndDate.HasValue) + queryParams.Add($"event.hide_end_date={Uri.EscapeDataString(hideEndDate.Value.ToString())}"); + if (showRemaining.HasValue) + queryParams.Add($"event.show_remaining={Uri.EscapeDataString(showRemaining.Value.ToString())}"); + var path = $"/v2/v3/events/{Uri.EscapeDataString(@event.ToString())}/" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/ExcelOnlineBusinessExtensions.cs b/src/Azure.Connectors.Sdk/Generated/ExcelOnlineBusinessExtensions.cs index c34996a..a6d7d80 100644 --- a/src/Azure.Connectors.Sdk/Generated/ExcelOnlineBusinessExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/ExcelOnlineBusinessExtensions.cs @@ -171,6 +171,7 @@ public class Item /// [JsonExtensionData] public Dictionary AdditionalProperties { get; set; } = new(); + /// dynamicProperties [JsonPropertyName("dynamicProperties")] public object DynamicProperties { get; set; } @@ -262,6 +263,7 @@ public class GetItemResponse /// [JsonExtensionData] public Dictionary AdditionalProperties { get; set; } = new(); + /// dynamicProperties [JsonPropertyName("dynamicProperties")] public object DynamicProperties { get; set; } @@ -839,8 +841,7 @@ protected ExcelOnlineBusinessClient() : this(new Uri("https://localhost")) { } public virtual async Task CreateTableAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, TableToCreate input, [DynamicValues("GetSources")] string location, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); var path = $"/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/files/{Uri.EscapeDataString(@file.ToString())}/tables" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) @@ -861,8 +862,7 @@ public virtual async Task CreateIdColumnAsync([DynamicValues("GetDrives")] strin { var queryParams = new List(); queryParams.Add("populateColumn=false"); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); if (keyColumn != default) queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); var path = $"/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/files/{Uri.EscapeDataString(@file.ToString())}/tables/{Uri.EscapeDataString(table.ToString())}/createIdColumn" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); @@ -889,27 +889,26 @@ await this /// Sensitivity Label Metadata /// Cancellation token. /// The List rows present in a table response. - public virtual async Task GetItemsAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetTables")] string table, [DynamicValues("GetSources")] string location, string filterQuery = default, string orderBy = default, int topCount = default, int skipCount = default, string selectQuery = default, string dateTimeFormat = default, bool extractSensitivityLabel = default, bool sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) + public virtual async Task GetItemsAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetTables")] string table, [DynamicValues("GetSources")] string location, string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, string selectQuery = default, string dateTimeFormat = default, bool? extractSensitivityLabel = default, bool? sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); if (filterQuery != default) queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); if (orderBy != default) queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); - if (topCount != default) - queryParams.Add($"$top={Uri.EscapeDataString(topCount.ToString())}"); - if (skipCount != default) - queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); if (selectQuery != default) queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); if (dateTimeFormat != default) queryParams.Add($"dateTimeFormat={Uri.EscapeDataString(dateTimeFormat.ToString())}"); - if (extractSensitivityLabel != default) - queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.ToString())}"); - if (sensitivityLabelMetadata != default) - queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.ToString())}"); + if (extractSensitivityLabel.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.Value.ToString())}"); + if (sensitivityLabelMetadata.HasValue) + queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.Value.ToString())}"); var path = $"/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/files/{Uri.EscapeDataString(@file.ToString())}/tables/{Uri.EscapeDataString(table.ToString())}/items" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -994,19 +993,17 @@ public virtual async Task ReplyCommentAsync([DynamicValues("GetDrives") /// Sensitivity Label Metadata /// Cancellation token. /// The Get a row response. - public virtual async Task GetItemAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetTables")] string table, string keyValue, [DynamicValues("GetSources")] string location, [DynamicValues("GetColumns")] string keyColumn, string dateTimeFormat = default, bool extractSensitivityLabel = default, bool sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) + public virtual async Task GetItemAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetTables")] string table, string keyValue, [DynamicValues("GetSources")] string location, [DynamicValues("GetColumns")] string keyColumn, string dateTimeFormat = default, bool? extractSensitivityLabel = default, bool? sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); - if (keyColumn != default) - queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); if (dateTimeFormat != default) queryParams.Add($"dateTimeFormat={Uri.EscapeDataString(dateTimeFormat.ToString())}"); - if (extractSensitivityLabel != default) - queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.ToString())}"); - if (sensitivityLabelMetadata != default) - queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.ToString())}"); + if (extractSensitivityLabel.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.Value.ToString())}"); + if (sensitivityLabelMetadata.HasValue) + queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.Value.ToString())}"); var path = $"/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/files/{Uri.EscapeDataString(@file.ToString())}/tables/{Uri.EscapeDataString(table.ToString())}/items/{Uri.EscapeDataString(keyValue.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1027,10 +1024,8 @@ public virtual async Task GetItemAsync([DynamicValues("GetDrive public virtual async Task DeleteItemAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetTables")] string table, string keyValue, [DynamicValues("GetSources")] string location, [DynamicValues("GetColumns")] string keyColumn, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); - if (keyColumn != default) - queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); var path = $"/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/files/{Uri.EscapeDataString(@file.ToString())}/tables/{Uri.EscapeDataString(table.ToString())}/items/{Uri.EscapeDataString(keyValue.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) @@ -1054,10 +1049,8 @@ await this public virtual async Task PatchItemAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetTables")] string table, string keyValue, Item input, [DynamicValues("GetSources")] string location, [DynamicValues("GetColumns")] string keyColumn, string dateTimeFormat = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); - if (keyColumn != default) - queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); if (dateTimeFormat != default) queryParams.Add($"dateTimeFormat={Uri.EscapeDataString(dateTimeFormat.ToString())}"); var path = $"/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/files/{Uri.EscapeDataString(@file.ToString())}/tables/{Uri.EscapeDataString(table.ToString())}/items/{Uri.EscapeDataString(keyValue.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); @@ -1094,8 +1087,7 @@ public virtual async Task GetSourcesAsync(string top = defau public virtual async Task GetDrivesAsync([DynamicValues("GetSources")] string location, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); var path = $"/codeless/v1.0/drives" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1113,15 +1105,14 @@ public virtual async Task GetDrivesAsync([DynamicValues("GetS /// Sensitivity Label Metadata /// Cancellation token. /// The Get worksheets response. - public virtual async Task GetAllWorksheetsAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetSources")] string location, bool extractSensitivityLabel = default, bool sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) + public virtual async Task GetAllWorksheetsAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetSources")] string location, bool? extractSensitivityLabel = default, bool? sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); - if (extractSensitivityLabel != default) - queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.ToString())}"); - if (sensitivityLabelMetadata != default) - queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + if (extractSensitivityLabel.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.Value.ToString())}"); + if (sensitivityLabelMetadata.HasValue) + queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.Value.ToString())}"); var path = $"/codeless/v1.0/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/items/{Uri.EscapeDataString(@file.ToString())}/workbook/worksheets" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1141,8 +1132,7 @@ public virtual async Task GetAllWorksheetsAsync([Dynam public virtual async Task CreateWorksheetAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, CreateWorksheetInput input, [DynamicValues("GetSources")] string location, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); var path = $"/codeless/v1.0/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/items/{Uri.EscapeDataString(@file.ToString())}/workbook/worksheets" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) @@ -1160,15 +1150,14 @@ public virtual async Task CreateWorksheetAsync([DynamicValues /// Sensitivity Label Metadata /// Cancellation token. /// The Get tables response. - public virtual async Task GetTablesAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetSources")] string location, bool extractSensitivityLabel = default, bool sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) + public virtual async Task GetTablesAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetSources")] string location, bool? extractSensitivityLabel = default, bool? sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); - if (extractSensitivityLabel != default) - queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.ToString())}"); - if (sensitivityLabelMetadata != default) - queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + if (extractSensitivityLabel.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.Value.ToString())}"); + if (sensitivityLabelMetadata.HasValue) + queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.Value.ToString())}"); var path = $"/codeless/v1.0/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/items/{Uri.EscapeDataString(@file.ToString())}/workbook/tables" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1188,8 +1177,7 @@ public virtual async Task GetTablesAsync([DynamicValues("GetD public virtual async Task GetTableAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetTables")] string table, [DynamicValues("GetSources")] string location, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); var path = $"/codeless/v1.0/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/items/{Uri.EscapeDataString(@file.ToString())}/workbook/tables/{Uri.EscapeDataString(table.ToString())}/metadata" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1210,8 +1198,7 @@ public virtual async Task GetRawAndFormattedTableAsync([DynamicVa { var queryParams = new List(); queryParams.Add("formattedPostfix=Formatted"); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); var path = $"/codeless/v1.0/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/items/{Uri.EscapeDataString(@file.ToString())}/workbook/tables/{Uri.EscapeDataString(table.ToString())}/rawandformattedtablemetadata" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1231,8 +1218,7 @@ public virtual async Task GetRawAndFormattedTableAsync([DynamicVa public virtual async Task GetColumnsAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetTables")] string table, [DynamicValues("GetSources")] string location, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); var path = $"/codeless/v1.0/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/items/{Uri.EscapeDataString(@file.ToString())}/workbook/tables/{Uri.EscapeDataString(table.ToString())}/columns" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1254,8 +1240,7 @@ public virtual async Task GetColumnsAsync([DynamicValues("Ge public virtual async Task AddRowAsync([DynamicValues("GetDrives")] string documentLibrary, string @file, [DynamicValues("GetTables")] string table, Item input, [DynamicValues("GetSources")] string location, string dateTimeFormat = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (location != default) - queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(location.ToString())}"); if (dateTimeFormat != default) queryParams.Add($"dateTimeFormat={Uri.EscapeDataString(dateTimeFormat.ToString())}"); var path = $"/codeless/v1.2/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/items/{Uri.EscapeDataString(@file.ToString())}/workbook/tables/{Uri.EscapeDataString(table.ToString())}/rows" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); @@ -1276,12 +1261,9 @@ public virtual async Task AddRowAsync([DynamicValues("GetDrives")] string public virtual async Task GetSingleScriptAsync(string chosenScriptSource, string chosenScriptDrive, string chosenScript, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (chosenScriptSource != default) - queryParams.Add($"scriptSource={Uri.EscapeDataString(chosenScriptSource.ToString())}"); - if (chosenScriptDrive != default) - queryParams.Add($"scriptDrive={Uri.EscapeDataString(chosenScriptDrive.ToString())}"); - if (chosenScript != default) - queryParams.Add($"scriptId={Uri.EscapeDataString(chosenScript.ToString())}"); + queryParams.Add($"scriptSource={Uri.EscapeDataString(chosenScriptSource.ToString())}"); + queryParams.Add($"scriptDrive={Uri.EscapeDataString(chosenScriptDrive.ToString())}"); + queryParams.Add($"scriptId={Uri.EscapeDataString(chosenScript.ToString())}"); var path = $"/v2/officescripting/api/storage/script" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1304,10 +1286,8 @@ public virtual async Task GetSingleScriptAsync(string c public virtual async Task RunScriptProdAsync([DynamicValues("GetDrives")] string workbookLibrary, string workbook, [DynamicValues("GetDrives")] string scriptLibrary, string script, RunScriptProdInput input, [DynamicValues("GetSources")] string workbookLocation, [DynamicValues("GetSources")] string scriptLocation, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (workbookLocation != default) - queryParams.Add($"source={Uri.EscapeDataString(workbookLocation.ToString())}"); - if (scriptLocation != default) - queryParams.Add($"scriptSource={Uri.EscapeDataString(scriptLocation.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(workbookLocation.ToString())}"); + queryParams.Add($"scriptSource={Uri.EscapeDataString(scriptLocation.ToString())}"); var path = $"/v2/officescripting/api/unattended/run/{Uri.EscapeDataString(workbookLibrary.ToString())}/{Uri.EscapeDataString(workbook.ToString())}/{Uri.EscapeDataString(scriptLibrary.ToString())}/{Uri.EscapeDataString(script.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) diff --git a/src/Azure.Connectors.Sdk/Generated/ExcelOnlineExtensions.cs b/src/Azure.Connectors.Sdk/Generated/ExcelOnlineExtensions.cs index 7fac22f..f673a4b 100644 --- a/src/Azure.Connectors.Sdk/Generated/ExcelOnlineExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/ExcelOnlineExtensions.cs @@ -167,6 +167,7 @@ public class Item /// [JsonExtensionData] public Dictionary AdditionalProperties { get; set; } = new(); + /// dynamicProperties [JsonPropertyName("dynamicProperties")] public object DynamicProperties { get; set; } @@ -575,7 +576,7 @@ await this /// DateTime Format /// Cancellation token. /// The List rows present in a table response. - public virtual async Task GetItemsAsync(string documentLibrary, string @file, [DynamicValues("GetTables")] string table, string filterQuery = default, string orderBy = default, int topCount = default, int skipCount = default, string selectQuery = default, string dateTimeFormat = default, CancellationToken cancellationToken = default) + public virtual async Task GetItemsAsync(string documentLibrary, string @file, [DynamicValues("GetTables")] string table, string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, string selectQuery = default, string dateTimeFormat = default, CancellationToken cancellationToken = default) { var queryParams = new List(); queryParams.Add("source=me"); @@ -583,10 +584,10 @@ public virtual async Task GetItemsAsync(string documentLibrary, strin queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); if (orderBy != default) queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); - if (topCount != default) - queryParams.Add($"$top={Uri.EscapeDataString(topCount.ToString())}"); - if (skipCount != default) - queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); if (selectQuery != default) queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); if (dateTimeFormat != default) @@ -613,8 +614,7 @@ public virtual async Task GetItemAsync(string documentLibrary, string @fil { var queryParams = new List(); queryParams.Add("source=me"); - if (keyColumn != default) - queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); + queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); if (dateTimeFormat != default) queryParams.Add($"dateTimeFormat={Uri.EscapeDataString(dateTimeFormat.ToString())}"); var path = $"/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/files/{Uri.EscapeDataString(@file.ToString())}/tables/{Uri.EscapeDataString(table.ToString())}/items/{Uri.EscapeDataString(keyValue.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); @@ -637,8 +637,7 @@ public virtual async Task DeleteItemAsync(string documentLibrary, string @file, { var queryParams = new List(); queryParams.Add("source=me"); - if (keyColumn != default) - queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); + queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); var path = $"/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/files/{Uri.EscapeDataString(@file.ToString())}/tables/{Uri.EscapeDataString(table.ToString())}/items/{Uri.EscapeDataString(keyValue.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) @@ -662,8 +661,7 @@ public virtual async Task PatchItemAsync(string documentLibrary, string @f { var queryParams = new List(); queryParams.Add("source=me"); - if (keyColumn != default) - queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); + queryParams.Add($"idColumn={Uri.EscapeDataString(keyColumn.ToString())}"); if (dateTimeFormat != default) queryParams.Add($"dateTimeFormat={Uri.EscapeDataString(dateTimeFormat.ToString())}"); var path = $"/drives/{Uri.EscapeDataString(documentLibrary.ToString())}/files/{Uri.EscapeDataString(@file.ToString())}/tables/{Uri.EscapeDataString(table.ToString())}/items/{Uri.EscapeDataString(keyValue.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); diff --git a/src/Azure.Connectors.Sdk/Generated/FtpExtensions.cs b/src/Azure.Connectors.Sdk/Generated/FtpExtensions.cs new file mode 100644 index 0000000..dbfe355 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/FtpExtensions.cs @@ -0,0 +1,441 @@ +// FtpExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Ftp.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Ftp.Models +{ + + #region Types + + /// + /// Response for Create file + /// + public class BlobMetadata + { + /// The unique id of the file or folder. + [JsonPropertyName("Id")] + public string Id { get; set; } + + /// The name of the file or folder. + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// The display name of the file or folder. + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + + /// The path of the file or folder. + [JsonPropertyName("Path")] + public string Path { get; set; } + + /// The date and time the file or folder was last modified. + [JsonPropertyName("LastModified")] + [JsonInclude] + public DateTime? LastModified { get; internal set; } + + /// The size of the file or folder. + [JsonPropertyName("Size")] + public long? Size { get; set; } + + /// The media type of the file or folder. + [JsonPropertyName("MediaType")] + public string MediaType { get; set; } + + /// A boolean value (true, false) to indicate whether or not the blob is a folder. + [JsonPropertyName("IsFolder")] + public bool? IsFolder { get; set; } + + /// The etag of the file or folder. + [JsonPropertyName("ETag")] + [JsonInclude] + public string ETag { get; internal set; } + + /// The filelocator of the file or folder. + [JsonPropertyName("FileLocator")] + public string FileLocator { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Ftp models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class FtpModelFactory + { + /// + /// Creates a new instance of . + /// + public static BlobMetadata BlobMetadata( + string id = default, + string name = default, + string displayName = default, + string path = default, + DateTime? lastModified = default, + long? size = default, + string mediaType = default, + bool? isFolder = default, + string eTag = default, + string fileLocator = default) + { + return new BlobMetadata + { + Id = id, + Name = name, + DisplayName = displayName, + Path = path, + LastModified = lastModified, + Size = size, + MediaType = mediaType, + IsFolder = isFolder, + ETag = eTag, + FileLocator = fileLocator, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnUpdatedFiles trigger (Ftp "When a file is added or modified (properties only)", operationId: OnUpdatedFiles). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<FtpOnUpdatedFilesTriggerPayload>(body). + /// + public class FtpOnUpdatedFilesTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Ftp connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class FtpTriggers + { + /// + /// Trigger operations with typed payloads for the Ftp connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnUpdatedFiles"] = typeof(FtpOnUpdatedFilesTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Ftp +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Ftp connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class FtpTriggerOperations + { + /// + /// When a file is added or modified (properties only). + /// Payload type: . + /// + public const string OnUpdatedFiles = "OnUpdatedFiles"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Ftp connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class FtpTriggerParameters + { + /// + /// Input parameters for the OnUpdatedFiles trigger operation (operationId: OnUpdatedFiles). + /// + public static class OnUpdatedFiles + { + /// + /// Select a folder + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// Maximum number of files to return by single trigger run (1-100). Note that 'Split On' setting can force trigger to process each item individually. + /// Default: 10. + /// + public const string MaxFileCount = "maxFileCount"; + + /// + /// If the flag is set to true, the trigger will check the file's created date and time and the file's last modified date and time. If the flag is set to false, the trigger will only check the file's last modified date and time. + /// Default: false. + /// + public const string CheckBothCreatedAndModifiedDateTime = "checkBothCreatedAndModifiedDateTime"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for ftp connector. + /// + public class FtpClient : ConnectorClientBase + { + /// + /// Creates a new FtpClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public FtpClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new FtpClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public FtpClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new FtpClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public FtpClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new FtpClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public FtpClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected FtpClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "ftp"; + + /// + /// Create file + /// + /// This operation creates a file. If a file is being deleted/renamed on server right after it was created, connector may return HTTP 404 error by it's design. Please use a delay for 1 minute before deleting or renaming newly created file. + /// The request body. + /// Folder path + /// File name + /// Cancellation token. + /// The Create file response. + public virtual async Task CreateFileAsync(byte[] input, string folderPath, string fileName, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"folderPath={Uri.EscapeDataString(folderPath.ToString())}"); + queryParams.Add($"name={Uri.EscapeDataString(fileName.ToString())}"); + var path = $"/datasets/default/files" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file metadata + /// + /// This operation gets the metadata for a file. + /// File + /// Cancellation token. + /// The Get file metadata response. + public virtual async Task GetFileMetadataAsync(string @file, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update file + /// + /// This operation updates a file. If a file is being deleted/renamed on server right after it was updated, connector may return HTTP 404 error by it's design. Please use a delay for 1 minute before deleting or renaming recently updated file. + /// File + /// The request body. + /// Cancellation token. + /// The Update file response. + public virtual async Task UpdateFileAsync(string @file, byte[] input, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete file + /// + /// This operation deletes a file. + /// File + /// Cancellation token. + public virtual async Task DeleteFileAsync(string @file, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copy file + /// + /// This operation copies a file to an FTP server. If a file is being deleted/renamed on server right after it was copied, connector may return HTTP 404 error by it's design. Please use a delay for 1 minute before deleting or renaming newly created file. + /// Source url + /// Destination file path + /// Overwrite? + /// Cancellation token. + /// The Copy file response. + public virtual async Task CopyFileAsync(string sourceUrl, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"source={Uri.EscapeDataString(sourceUrl.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/copyFile" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file metadata using path + /// + /// This operation gets the metadata of a file using the file path. + /// File path + /// Cancellation token. + /// The Get file metadata using path response. + public virtual async Task GetFileMetadataByPathAsync(string filePath, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + var path = $"/datasets/default/GetFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file content using path + /// + /// This operation gets the content of a file using the file path. + /// File path + /// Infer Content Type + /// Cancellation token. + /// The Get file content using path response. + public virtual async Task GetFileContentByPathAsync(string filePath, bool? inferContentType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); + var path = $"/datasets/default/GetFileContentByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file content + /// + /// This operation gets the content of a file. + /// File + /// Infer Content Type + /// Cancellation token. + /// The Get file content response. + public virtual async Task GetFileContentAsync(string @file, bool? inferContentType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/content" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Extract archive to folder + /// + /// This operation extracts an archive file into a folder (example: .zip). + /// Source archive file path + /// Destination folder path + /// Overwrite? + /// Create folders? + /// Cancellation token. + /// The Extract archive to folder response. + public virtual async Task> ExtractFolderAsync(string sourceArchiveFilePath, string destinationFolderPath, bool? overwrite = default, bool? createFolders = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"source={Uri.EscapeDataString(sourceArchiveFilePath.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFolderPath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + if (createFolders.HasValue) + queryParams.Add($"createFolders={Uri.EscapeDataString(createFolders.Value.ToString())}"); + var path = $"/datasets/default/extractFolderV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/GitHubExtensions.cs b/src/Azure.Connectors.Sdk/Generated/GitHubExtensions.cs new file mode 100644 index 0000000..7c1e64c --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/GitHubExtensions.cs @@ -0,0 +1,3821 @@ +// GitHubExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.GitHub.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.GitHub.Models +{ + + #region Types + + /// + /// Response for Create an issue + /// + public class IssueDetailsModel + { + /// Summary of the issue. + [JsonPropertyName("title")] + public string Title { get; set; } + + /// Description of the issue. + [JsonPropertyName("body")] + public string Body { get; set; } + + /// assignee + [JsonPropertyName("assignee")] + public UserDetailsModel Assignee { get; set; } + + /// Unique id of the issue. + [JsonPropertyName("number")] + public int? Id { get; set; } + + /// Status of the issue. + [JsonPropertyName("state")] + public string State { get; set; } + + /// yyyy-MM-ddTHH:mm:ss.fffZ (UTC format). + [JsonPropertyName("created_at")] + [JsonInclude] + public string CreatedDateTime { get; internal set; } + + /// Web link to the repository. + [JsonPropertyName("repository_url")] + public string RepositoryUrl { get; set; } + } + + /// + /// assignee + /// + public class UserDetailsModel + { + /// User Login. + [JsonPropertyName("login")] + public string Login { get; set; } + + /// User Id. + [JsonPropertyName("id")] + public int? Id { get; set; } + + /// User Node Id. + [JsonPropertyName("node_id")] + public string NodeId { get; set; } + + /// User Avatar Url. + [JsonPropertyName("avatar_url")] + public string AvatarUrl { get; set; } + + /// User Gravatar Id. + [JsonPropertyName("gravatar_id")] + public string GravatarId { get; set; } + + /// User Url. + [JsonPropertyName("url")] + public string Url { get; set; } + + /// User Html Url. + [JsonPropertyName("html_url")] + public string HtmlUrl { get; set; } + + /// User FollowersUrl + [JsonPropertyName("followers_url")] + public string FollowersUrl { get; set; } + + /// User Following Url. + [JsonPropertyName("following_url")] + public string FollowingUrl { get; set; } + + /// User Gists Url. + [JsonPropertyName("gists_url")] + public string GistsUrl { get; set; } + + /// User Starred Url. + [JsonPropertyName("starred_url")] + public string StarredUrl { get; set; } + + /// User Subscriptions Url. + [JsonPropertyName("subscriptions_url")] + public string SubscriptionsUrl { get; set; } + + /// User Organizations Url. + [JsonPropertyName("organizations_url")] + public string OrganizationsUrl { get; set; } + + /// User Repos Url. + [JsonPropertyName("repos_url")] + public string ReposUrl { get; set; } + + /// User Events Url. + [JsonPropertyName("events_url")] + public string EventsUrl { get; set; } + + /// User Received Events Url. + [JsonPropertyName("received_events_url")] + public string ReceivedEventsUrl { get; set; } + + /// User Type. + [JsonPropertyName("type")] + public string Type { get; set; } + + /// Is User Site Admin? + [JsonPropertyName("site_admin")] + public bool? SiteAdmin { get; set; } + + /// User Name. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// User Company. + [JsonPropertyName("company")] + public string Company { get; set; } + + /// User Blog. + [JsonPropertyName("blog")] + public string Blog { get; set; } + + /// User Location. + [JsonPropertyName("location")] + public string Location { get; set; } + + /// User Email. + [JsonPropertyName("email")] + public string Email { get; set; } + + /// User Hireable? + [JsonPropertyName("hireable")] + public bool? Hireable { get; set; } + + /// User Bio. + [JsonPropertyName("bio")] + public string Bio { get; set; } + + /// User Public Repos. + [JsonPropertyName("public_repos")] + public int? PublicRepos { get; set; } + + /// User Public Gists. + [JsonPropertyName("public_gists")] + public int? PublicGists { get; set; } + + /// User Followers. + [JsonPropertyName("followers")] + public int? Followers { get; set; } + + /// User Following. + [JsonPropertyName("following")] + public int? Following { get; set; } + + /// User Created At. + [JsonPropertyName("created_at")] + public DateTime? CreatedAt { get; set; } + + /// User Updated At. + [JsonPropertyName("updated_at")] + public DateTime? UpdatedAt { get; set; } + } + + /// + /// Response for Get all issues of a repository + /// + public class GeneralAPIModel + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get a repository public key + /// + public class ActionsPublicKey + { + /// The identifier for the key. + [JsonPropertyName("key_id")] + public string KeyId { get; set; } + + /// The Base64 encoded public key. + [JsonPropertyName("key")] + public string Key { get; set; } + + /// Unique identifier of the key. + [JsonPropertyName("id")] + public int? Id { get; set; } + + /// Public key url. + [JsonPropertyName("url")] + public string Url { get; set; } + + /// Public key title. + [JsonPropertyName("title")] + public string Title { get; set; } + + /// The date and time when the key was created. + [JsonPropertyName("created_at")] + public string CreatedAt { get; set; } + } + + /// + /// Response for Create a repository using a template + /// + public class RepositoryDetails + { + /// Unique identifier of the repository. + [JsonPropertyName("id")] + public int? Id { get; set; } + + /// The Node Id of the repository. + [JsonPropertyName("node_id")] + public string NodeId { get; set; } + + /// The name of the repository. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// The full name of the repository. + [JsonPropertyName("full_name")] + public string FullName { get; set; } + + /// license + [JsonPropertyName("license")] + public LicenseDetails License { get; set; } + + /// The number of forks of the repository. + [JsonPropertyName("forks")] + public int? Forks { get; set; } + + /// Permissions on the repository. + [JsonPropertyName("permissions")] + public object Permissions { get; set; } + + /// owner + [JsonPropertyName("owner")] + public UserDetailsModel Owner { get; set; } + + /// Whether the repository is private or public. + [JsonPropertyName("private")] + public bool? IsPrivate { get; set; } + + /// The Html Url of the repository + [JsonPropertyName("html_url")] + public string HtmlUrl { get; set; } + + /// The description of the repository + [JsonPropertyName("description")] + public string Description { get; set; } + + /// If the repository is a fork? + [JsonPropertyName("fork")] + public bool? IsAFork { get; set; } + + /// The HTTP URL for this repository + [JsonPropertyName("url")] + public string Url { get; set; } + + /// The Archive URL for this repository + [JsonPropertyName("archive_url")] + public string ArchiveUrl { get; set; } + + /// The Assignees URL for this repository + [JsonPropertyName("assignees_url")] + public string AssigneesUrl { get; set; } + + /// The Blobs URL for this repository + [JsonPropertyName("blobs_url")] + public string BlobsUrl { get; set; } + + /// The Branches URL for this repository + [JsonPropertyName("branches_url")] + public string BranchesUrl { get; set; } + + /// The Collaborators URL for this repository + [JsonPropertyName("collaborators_url")] + public string CollaboratorsUrl { get; set; } + + /// The Comments URL for this repository + [JsonPropertyName("comments_url")] + public string CommentsUrl { get; set; } + + /// The Commits URL for this repository + [JsonPropertyName("commits_url")] + public string CommitsUrl { get; set; } + + /// The Compare URL for this repository + [JsonPropertyName("compare_url")] + public string CompareUrl { get; set; } + + /// The Contents URL for this repository + [JsonPropertyName("contents_url")] + public string ContentsUrl { get; set; } + + /// The Contributors URL for this repository + [JsonPropertyName("contributors_url")] + public string ContributorsUrl { get; set; } + + /// The Deployments URL for this repository + [JsonPropertyName("deployments_url")] + public string DeploymentsUrl { get; set; } + + /// The Downloads URL for this repository + [JsonPropertyName("downloads_url")] + public string DownloadsUrl { get; set; } + + /// The Events URL for this repository + [JsonPropertyName("events_url")] + public string EventsUrl { get; set; } + + /// The Forks URL for this repository + [JsonPropertyName("forks_url")] + public string ForksUrl { get; set; } + + /// The Git Commits URL for this repository + [JsonPropertyName("git_commits_url")] + public string GitCommitsUrl { get; set; } + + /// The Git References URL for this repository + [JsonPropertyName("git_refs_url")] + public string GitReferencesUrl { get; set; } + + /// The Git Tags URL for this repository + [JsonPropertyName("git_tags_url")] + public string GitTagsUrl { get; set; } + + /// The Git URL for this repository + [JsonPropertyName("git_url")] + public string GitUrl { get; set; } + + /// The issue comment URL for this repository + [JsonPropertyName("issue_comment_url")] + public string IssueCommentUrl { get; set; } + + /// The issue events URL for this repository + [JsonPropertyName("issue_events_url")] + public string IssueEventsUrl { get; set; } + + /// The issues URL for this repository + [JsonPropertyName("issues_url")] + public string IssuesUrl { get; set; } + + /// The keys URL for this repository + [JsonPropertyName("keys_url")] + public string KeysUrl { get; set; } + + /// The labels URL for this repository + [JsonPropertyName("labels_url")] + public string LabelsUrl { get; set; } + + /// The languages URL for this repository + [JsonPropertyName("languages_url")] + public string LanguagesUrl { get; set; } + + /// The merges URL for this repository + [JsonPropertyName("merges_url")] + public string MergesUrl { get; set; } + + /// The milestones URL for this repository + [JsonPropertyName("milestones_url")] + public string MilestonesUrl { get; set; } + + /// The notifications URL for this repository + [JsonPropertyName("notifications_url")] + public string NotificationsUrl { get; set; } + + /// The pulls URL for this repository + [JsonPropertyName("pulls_url")] + public string PullsUrl { get; set; } + + /// The releases URL for this repository + [JsonPropertyName("releases_url")] + public string ReleasesUrl { get; set; } + + /// The SSH URL to clone this repository + [JsonPropertyName("ssh_url")] + public string SSHUrl { get; set; } + + /// The stargazers (Stargazers are the people that have bookmarked the GitHub repository) URL for this repository + [JsonPropertyName("stargazers_url")] + public string StargazersUrl { get; set; } + + /// The statuses URL for this repository + [JsonPropertyName("statuses_url")] + public string StatusesUrl { get; set; } + + /// The subscribers URL for this repository + [JsonPropertyName("subscribers_url")] + public string SubscribersUrl { get; set; } + + /// The subscription URL for this repository + [JsonPropertyName("subscription_url")] + public string SubscriptionUrl { get; set; } + + /// The tags URL for this repository + [JsonPropertyName("tags_url")] + public string TagsUrl { get; set; } + + /// The teams URL for this repository + [JsonPropertyName("teams_url")] + public string TeamsUrl { get; set; } + + /// The trees URL for this repository + [JsonPropertyName("trees_url")] + public string TreesUrl { get; set; } + + /// The clone URL for this repository + [JsonPropertyName("clone_url")] + public string CloneUrl { get; set; } + + /// The original mirror URL for this repository + [JsonPropertyName("mirror_url")] + public string MirrorUrl { get; set; } + + /// The hooks URL for this repository + [JsonPropertyName("hooks_url")] + public string HooksUrl { get; set; } + + /// The SVN URL for this repository + [JsonPropertyName("svn_url")] + public string SVNUrl { get; set; } + + /// The homepage for this repository + [JsonPropertyName("homepage")] + public string Homepage { get; set; } + + /// The language for this repository + [JsonPropertyName("language")] + public string Language { get; set; } + + /// Number of forks there are of this repository in the whole network. + [JsonPropertyName("forks_count")] + public int? ForksCount { get; set; } + + /// Number of users who have starred the repository. + [JsonPropertyName("stargazers_count")] + public int? StargazersCount { get; set; } + + /// Number of users watching the repository. + [JsonPropertyName("watchers_count")] + public int? WatchersCount { get; set; } + + /// Size of the repository + [JsonPropertyName("size")] + public int? Size { get; set; } + + /// The default branch of the repository. + [JsonPropertyName("default_branch")] + public string DefaultBranch { get; set; } + + /// Number of open issues in the repository. + [JsonPropertyName("open_issues_count")] + public int? OpenIssuesCount { get; set; } + + /// Whether this repository acts as a template that can be used to generate new repositories. + [JsonPropertyName("is_template")] + public bool? IsTemplate { get; set; } + + /// List of topics in the repository + [JsonPropertyName("topics")] + public List Topics { get; set; } + + /// Whether issues are enabled. + [JsonPropertyName("has_issues")] + public bool? HasIssues { get; set; } + + /// Whether projects are enabled. + [JsonPropertyName("has_projects")] + public bool? HasProjects { get; set; } + + /// Whether the wiki is enabled. + [JsonPropertyName("has_wiki")] + public bool? HasWiki { get; set; } + + /// Whether pages are enabled. + [JsonPropertyName("has_pages")] + public bool? HasPages { get; set; } + + /// Whether downloads are enabled. + [JsonPropertyName("has_downloads")] + public bool? HasDownloads { get; set; } + + /// Whether the repository is archived. + [JsonPropertyName("archived")] + public bool? IsArchived { get; set; } + + /// Returns whether or not this repository disabled. + [JsonPropertyName("disabled")] + public bool? IsDisabled { get; set; } + + /// The repository visibility: public, private, or internal. + [JsonPropertyName("visibility")] + public string Visibility { get; set; } + + /// When the repository was last pushed to. + [JsonPropertyName("pushed_at")] + public DateTime? PushedAt { get; set; } + + /// the date and time when the repository was created. + [JsonPropertyName("created_at")] + public DateTime? CreatedAt { get; set; } + + /// the date and time when the repository was last updated. + [JsonPropertyName("updated_at")] + public DateTime? UpdatedAt { get; set; } + + /// Whether to allow rebase merges for pull requests. + [JsonPropertyName("allow_rebase_merge")] + public bool? AllowRebaseMerge { get; set; } + + /// template_repository + [JsonPropertyName("template_repository")] + public object TemplateRepository { get; set; } + + /// Temporary authentication token for cloning this repository. + [JsonPropertyName("temp_clone_token")] + public string TempCloneToken { get; set; } + + /// Whether to allow squash merges for pull requests. + [JsonPropertyName("allow_squash_merge")] + public bool? AllowSquashMerge { get; set; } + + /// Whether to delete head branches when pull requests are merged + [JsonPropertyName("delete_branch_on_merge")] + public bool? DeleteBranchOnMerge { get; set; } + + /// Whether to allow merge commits for pull requests. + [JsonPropertyName("allow_merge_commit")] + public bool? AllowMergeCommit { get; set; } + + /// Number of subscribers for the repository. + [JsonPropertyName("subscribers_count")] + public int? SubscribersCount { get; set; } + + /// Repository Network Count + [JsonPropertyName("network_count")] + public int? NetworkCount { get; set; } + + /// Repository open issues. + [JsonPropertyName("open_issues")] + public int? OpenIssues { get; set; } + + /// Repository Watchers. + [JsonPropertyName("watchers")] + public int? Watchers { get; set; } + + /// Repository master branch. + [JsonPropertyName("master_branch")] + public string MasterBranch { get; set; } + + /// Repository Starred At + [JsonPropertyName("starred_at")] + public string StarredAt { get; set; } + } + + /// + /// license + /// + public class LicenseDetails + { + /// The lowercased SPDX Id of the license. + [JsonPropertyName("key")] + public string Key { get; set; } + + /// The license full name specified by https://spdx.org/licenses. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// URL to the license on https://choosealicense.com. + [JsonPropertyName("url")] + public string Url { get; set; } + + /// Short identifier specified by https://spdx.org/licenses. + [JsonPropertyName("spdx_id")] + public string SPDXId { get; set; } + + /// License Node Id. + [JsonPropertyName("node_id")] + public string NodeId { get; set; } + + /// License HTML URL. + [JsonPropertyName("html_url")] + public string HTMLUrl { get; set; } + } + + /// + /// Response for Create a reference + /// + public class GitReference + { + /// The name of the fully qualified reference. + [JsonPropertyName("ref")] + public string Reference { get; set; } + + /// The Node Id of the reference. + [JsonPropertyName("node_id")] + public string NodeId { get; set; } + + /// The url of the reference. + [JsonPropertyName("url")] + public string Url { get; set; } + + /// object + [JsonPropertyName("object")] + public object ObjectEntity { get; set; } + } + + /// + /// Response for Merge a pull request + /// + public class PullRequestMergeResult + { + /// SHA for the merge commit. + [JsonPropertyName("sha")] + public string Sha { get; set; } + + /// Whether or not the pull request was merged. + [JsonPropertyName("merged")] + public bool? IsMerged { get; set; } + + /// Merge response message. + [JsonPropertyName("message")] + public string Message { get; set; } + } + + /// + /// Response for Get a pull request + /// + public class PullRequest + { + /// The HTTP URL for this pull request. + [JsonPropertyName("url")] + public string PullRequestUrl { get; set; } + + /// The Unique Identifier for the pull request. + [JsonPropertyName("id")] + public int? PullRequestId { get; set; } + + /// The Node ID for the pull request. + [JsonPropertyName("node_id")] + public string PullRequestNodeId { get; set; } + + /// The HTML URL for the pull request. + [JsonPropertyName("html_url")] + public string PullRequestHtmlUrl { get; set; } + + /// The Diff URL for the pull request. + [JsonPropertyName("diff_url")] + public string PullRequestDiffUrl { get; set; } + + /// The patch URL for the pull request. + [JsonPropertyName("patch_url")] + public string PullRequestPatchUrl { get; set; } + + /// The issue URL for the pull request. + [JsonPropertyName("issue_url")] + public string PullRequestIssueUrl { get; set; } + + /// The commit URL for the pull request. + [JsonPropertyName("commits_url")] + public string PullRequestCommitUrl { get; set; } + + /// The review comments URL for the pull request. + [JsonPropertyName("review_comments_url")] + public string PullRequestReviewCommentsUrl { get; set; } + + /// The review comment URL for the pull request. + [JsonPropertyName("review_comment_url")] + public string PullRequestReviewCommentUrl { get; set; } + + /// The statuses URL for the pull request. + [JsonPropertyName("statuses_url")] + public string PullRequestStatusesUrl { get; set; } + + /// Number uniquely identifying the pull request within its repository. + [JsonPropertyName("number")] + public int? PullRequestNumber { get; set; } + + /// State of this Pull Request. Either `open` or `closed`. + [JsonPropertyName("state")] + public State? PullRequestState { get; set; } + + /// Whether the pull request is locked or not. + [JsonPropertyName("locked")] + public bool? IsPullRequestLocked { get; set; } + + /// The title of the pull request. + [JsonPropertyName("title")] + public string PullRequestTitle { get; set; } + + /// user + [JsonPropertyName("user")] + public UserDetailsModel User { get; set; } + + /// The body as Markdown. + [JsonPropertyName("body")] + public string PullRequestBody { get; set; } + + /// The list of labels associated with the pull request. + [JsonPropertyName("labels")] + public List
Value { get; set; } + } + + /// + /// Item in List of Tables + /// + public class Table + { + /// The name of the table. The name is used at runtime. + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// The display name of the table. + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + + /// Additional table properties provided by the connector to the clients. + [JsonPropertyName("DynamicProperties")] + [JsonInclude] + public object DynamicProperties { get; internal set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of GoogleDrive models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class GoogleDriveModelFactory + { + /// + /// Creates a new instance of . + /// + public static BlobMetadata BlobMetadata( + string id = default, + string name = default, + string displayName = default, + string path = default, + DateTime? lastModified = default, + long? size = default, + string mediaType = default, + bool? isFolder = default, + string eTag = default, + string fileLocator = default, + string lastModifiedBy = default) + { + return new BlobMetadata + { + Id = id, + Name = name, + DisplayName = displayName, + Path = path, + LastModified = lastModified, + Size = size, + MediaType = mediaType, + IsFolder = isFolder, + ETag = eTag, + FileLocator = fileLocator, + LastModifiedBy = lastModifiedBy, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableMetadata TableMetadata( + string name = default, + string title = default, + string xMsPermission = default, + TableCapabilitiesMetadata xMsCapabilities = default, + ObjectEntity schema = default, + ObjectEntity referencedEntities = default, + string webUrl = default) + { + return new TableMetadata + { + Name = name, + Title = title, + XMsPermission = xMsPermission, + XMsCapabilities = xMsCapabilities, + Schema = schema, + ReferencedEntities = referencedEntities, + WebUrl = webUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableCapabilitiesMetadata TableCapabilitiesMetadata( + TableSortRestrictionsMetadata sortRestrictions = default, + TableFilterRestrictionsMetadata filterRestrictions = default, + TableSelectRestrictionsMetadata selectRestrictions = default, + bool? isOnlyServerPagable = default, + List filterFunctionSupport = default, + List serverPagingOptions = default) + { + return new TableCapabilitiesMetadata + { + SortRestrictions = sortRestrictions, + FilterRestrictions = filterRestrictions, + SelectRestrictions = selectRestrictions, + IsOnlyServerPagable = isOnlyServerPagable, + FilterFunctionSupport = filterFunctionSupport, + ServerPagingOptions = serverPagingOptions, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableSortRestrictionsMetadata TableSortRestrictionsMetadata( + bool? sortable = default, + List unsortableProperties = default, + List ascendingOnlyProperties = default) + { + return new TableSortRestrictionsMetadata + { + Sortable = sortable, + UnsortableProperties = unsortableProperties, + AscendingOnlyProperties = ascendingOnlyProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableFilterRestrictionsMetadata TableFilterRestrictionsMetadata( + bool? filterable = default, + List nonFilterableProperties = default, + List requiredProperties = default) + { + return new TableFilterRestrictionsMetadata + { + Filterable = filterable, + NonFilterableProperties = nonFilterableProperties, + RequiredProperties = requiredProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableSelectRestrictionsMetadata TableSelectRestrictionsMetadata( + bool? selectable = default) + { + return new TableSelectRestrictionsMetadata + { + Selectable = selectable, + }; + } + + /// + /// Creates a new instance of . + /// + public static TablesList TablesList( + List
value = default) + { + return new TablesList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static Table Table( + string name = default, + string displayName = default, + object dynamicProperties = default) + { + return new Table + { + Name = name, + DisplayName = displayName, + DynamicProperties = dynamicProperties, + }; + } + } + + #endregion Model Factory + +} + +namespace Azure.Connectors.Sdk.GoogleDrive +{ + + #region Client + + /// + /// Typed client for googledrive connector. + /// + public class GoogleDriveClient : ConnectorClientBase + { + /// + /// Creates a new GoogleDriveClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public GoogleDriveClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new GoogleDriveClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public GoogleDriveClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new GoogleDriveClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public GoogleDriveClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new GoogleDriveClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public GoogleDriveClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected GoogleDriveClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "googledrive"; + + /// + /// Get file metadata using id + /// + /// Retrieves file metadata from Google Drive using id + /// File + /// Cancellation token. + /// The Get file metadata using id response. + public virtual async Task GetFileMetadataAsync(string @file, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update file + /// + /// Updates a file in Google Drive + /// File + /// The request body. + /// Cancellation token. + /// The Update file response. + public virtual async Task UpdateFileAsync(string @file, byte[] input, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete file + /// + /// Deletes a file from Google Drive + /// File + /// Cancellation token. + public virtual async Task DeleteFileAsync(string @file, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file metadata using path + /// + /// Retrieves file metadata from Google Drive using path + /// File path + /// Cancellation token. + /// The Get file metadata using path response. + public virtual async Task GetFileMetadataByPathAsync(string filePath, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + var path = $"/datasets/default/GetFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file content using path + /// + /// Retrieves file content from Google Drive using path + /// File path + /// Infer Content Type + /// Cancellation token. + /// The Get file content using path response. + public virtual async Task GetFileContentByPathAsync(string filePath, bool? inferContentType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); + var path = $"/datasets/default/GetFileContentByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file content using id + /// + /// Retrieves file content from Google Drive using id + /// File id + /// Infer Content Type + /// Cancellation token. + /// The Get file content using id response. + public virtual async Task GetFileContentAsync(string fileId, bool? inferContentType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(fileId.ToString())}/content" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create file + /// + /// Uploads a file to Google Drive + /// The request body. + /// Folder path + /// File name + /// Cancellation token. + /// The Create file response. + public virtual async Task CreateFileAsync(byte[] input, string folderPath, string fileName, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"folderPath={Uri.EscapeDataString(folderPath.ToString())}"); + queryParams.Add($"name={Uri.EscapeDataString(fileName.ToString())}"); + var path = $"/datasets/default/files" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copy file + /// + /// Copies a file on Google Drive + /// Source url + /// Destination file path + /// Overwrite? + /// Cancellation token. + /// The Copy file response. + public virtual async Task CopyFileAsync(string sourceUrl, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"source={Uri.EscapeDataString(sourceUrl.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/copyFile" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List files in folder + /// + /// List files in a Google Drive folder + /// Folder id + /// Cancellation token. + /// The List files in folder response. + public virtual async Task> ListFolderAsync(string folderId, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/folders/{Uri.EscapeDataString(folderId.ToString())}"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List files in root folder + /// + /// Lists files in the Google Drive root folder + /// Cancellation token. + /// The List files in root folder response. + public virtual async Task> ListRootFolderAsync(CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/folders"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get sheet metadata + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// File + /// Worksheet + /// Cancellation token. + /// The Get sheet metadata response. + public virtual async Task GetTableAsync(string @file, [DynamicValues("GetTables")] string worksheet, CancellationToken cancellationToken = default) + { + var path = $"/$metadata.json/datasets/{Uri.EscapeDataString(@file.ToString())}/tables/{Uri.EscapeDataString(worksheet.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get sheets + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// File + /// Cancellation token. + /// The Get sheets response. + public virtual async Task GetTablesAsync(string @file, CancellationToken cancellationToken = default) + { + var path = $"/datasets/{Uri.EscapeDataString(@file.ToString())}/tables"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Extract archive to folder + /// + /// Extracts an archive file into a folder in Google Drive (example: .zip) + /// Source archive file path + /// Destination folder path + /// Overwrite? + /// Cancellation token. + /// The Extract archive to folder response. + public virtual async Task> ExtractFolderAsync(string sourceArchiveFilePath, string destinationFolderPath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("queryParametersSingleEncoded=true"); + queryParams.Add($"source={Uri.EscapeDataString(sourceArchiveFilePath.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFolderPath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/extractFolderV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/GoogleTasksExtensions.cs b/src/Azure.Connectors.Sdk/Generated/GoogleTasksExtensions.cs new file mode 100644 index 0000000..919aa89 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/GoogleTasksExtensions.cs @@ -0,0 +1,426 @@ +// GoogleTasksExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.GoogleTasks.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.GoogleTasks.Models +{ + + #region Types + + /// + /// Response for List task lists + /// + public class TaskListList + { + /// Task lists in the lists. + [JsonPropertyName("items")] + public List Items { get; set; } + } + + /// + /// Item in Task lists in the lists. + /// + public class TaskListEntry + { + /// The identifier of the task list. + [JsonPropertyName("id")] + public string TaskListId { get; set; } + + /// The title of the task list. + [JsonPropertyName("title")] + public string Title { get; set; } + + /// A link to this task list. + [JsonPropertyName("selfLink")] + public string HTMLLink { get; set; } + + /// The time the task list was last updated. + [JsonPropertyName("updated")] + public DateTime? UpdatedTime { get; set; } + } + + /// + /// Response for Lists the tasks for a task list + /// + public class TaskList + { + /// The tasks in the list. + [JsonPropertyName("items")] + public List Items { get; set; } + } + + /// + /// Item in The tasks in the list. + /// + public class TaskObject + { + /// The identifier of the task. + [JsonPropertyName("id")] + public string TaskId { get; set; } + + /// The title of the task. + [JsonPropertyName("title")] + public string Title { get; set; } + + /// The last time the task was updated. + [JsonPropertyName("updated")] + public DateTime? Updated { get; set; } + + /// A link to the task. + [JsonPropertyName("selfLink")] + public string HTMLLink { get; set; } + + /// The parent of the task. + [JsonPropertyName("parent")] + public string Parent { get; set; } + + /// The position of the task. + [JsonPropertyName("position")] + public string Position { get; set; } + + /// The notes for the task. + [JsonPropertyName("notes")] + public string Notes { get; set; } + + /// The status of the task. + [JsonPropertyName("status")] + public string Status { get; set; } + + /// The datetime the task is due. + [JsonPropertyName("due")] + public DateTime? Due { get; set; } + + /// The datetime the task was completed. + [JsonPropertyName("completed")] + public DateTime? Completed { get; set; } + } + + /// + /// TaskListCreate + /// + public class TaskListCreate + { + /// The title of the task list. + [JsonPropertyName("title")] + public string Title { get; set; } + } + + /// + /// TaskCreate + /// + public class TaskCreate + { + /// The title of the task. + [JsonPropertyName("title")] + public string Title { get; set; } + + /// The notes for the task. + [JsonPropertyName("notes")] + public string Notes { get; set; } + + /// The datetime the task is due. + [JsonPropertyName("due")] + public DateTime? Due { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of GoogleTasks models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class GoogleTasksModelFactory + { + /// + /// Creates a new instance of . + /// + public static TaskListList TaskListList( + List items = default) + { + return new TaskListList + { + Items = items, + }; + } + + /// + /// Creates a new instance of . + /// + public static TaskListEntry TaskListEntry( + string taskListId = default, + string title = default, + string htmlLink = default, + DateTime? updatedTime = default) + { + return new TaskListEntry + { + TaskListId = taskListId, + Title = title, + HTMLLink = htmlLink, + UpdatedTime = updatedTime, + }; + } + + /// + /// Creates a new instance of . + /// + public static TaskList TaskList( + List items = default) + { + return new TaskList + { + Items = items, + }; + } + + /// + /// Creates a new instance of . + /// + public static TaskObject TaskObject( + string taskId = default, + string title = default, + DateTime? updated = default, + string htmlLink = default, + string parent = default, + string position = default, + string notes = default, + string status = default, + DateTime? due = default, + DateTime? completed = default) + { + return new TaskObject + { + TaskId = taskId, + Title = title, + Updated = updated, + HTMLLink = htmlLink, + Parent = parent, + Position = position, + Notes = notes, + Status = status, + Due = due, + Completed = completed, + }; + } + + /// + /// Creates a new instance of . + /// + public static TaskListCreate TaskListCreate( + string title = default) + { + return new TaskListCreate + { + Title = title, + }; + } + + /// + /// Creates a new instance of . + /// + public static TaskCreate TaskCreate( + string title = default, + string notes = default, + DateTime? due = default) + { + return new TaskCreate + { + Title = title, + Notes = notes, + Due = due, + }; + } + } + + #endregion Model Factory + +} + +namespace Azure.Connectors.Sdk.GoogleTasks +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the GoogleTasks connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class GoogleTasksTriggerOperations + { + /// + /// When a new task list is created. + /// + public const string OnNewTaskList = "OnNewTaskList"; + + /// + /// When a task is added to a task list. + /// + public const string OnNewTaskInList = "OnNewTaskInList"; + + /// + /// When a task is due in a task list. + /// + public const string OnDueTaskInList = "OnDueTaskInList"; + + /// + /// When a task is completed in a task list (V2). + /// + public const string OnCompletedTaskInList = "OnCompletedTaskInListV2"; + + } + + #endregion Trigger Operation Constants + + #region Client + + /// + /// Typed client for googletasks connector. + /// + public class GoogleTasksClient : ConnectorClientBase + { + /// + /// Creates a new GoogleTasksClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public GoogleTasksClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new GoogleTasksClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public GoogleTasksClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new GoogleTasksClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public GoogleTasksClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new GoogleTasksClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public GoogleTasksClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected GoogleTasksClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "googletasks"; + + /// + /// List task lists + /// + /// List all task lists. + /// Cancellation token. + /// The List task lists response. + public virtual async Task ListTaskListsAsync(CancellationToken cancellationToken = default) + { + var path = $"/users/@me/lists"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a task list + /// + /// Creates a new task list. + /// The request body. + /// Cancellation token. + /// The Create a task list response. + public virtual async Task CreateTaskListAsync(TaskListCreate input, CancellationToken cancellationToken = default) + { + var path = $"/users/@me/lists"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Lists the tasks for a task list + /// + /// Lists the tasks for a specific task list. + /// Task List ID + /// Cancellation token. + /// The Lists the tasks for a task list response. + public virtual async Task ListTasksAsync([DynamicValues("ListTaskLists")] string taskListId, CancellationToken cancellationToken = default) + { + var path = $"/lists/{Uri.EscapeDataString(taskListId.ToString())}/tasks"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a task in a task list + /// + /// Create a task in a specific task list. + /// Task List ID + /// The request body. + /// Cancellation token. + /// The Create a task in a task list response. + public virtual async Task CraeteTaskAsync([DynamicValues("ListTaskLists")] string taskListId, TaskCreate input, CancellationToken cancellationToken = default) + { + var path = $"/lists/{Uri.EscapeDataString(taskListId.ToString())}/tasks"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get a task from a task list + /// + /// Get specific task from the specified task list. + /// Task List ID + /// Task ID + /// Cancellation token. + /// The Get a task from a task list response. + public virtual async Task ListTaskAsync([DynamicValues("ListTaskLists")] string taskListId, [DynamicValues("ListTasks")] string taskId, CancellationToken cancellationToken = default) + { + var path = $"/lists/{Uri.EscapeDataString(taskListId.ToString())}/tasks/{Uri.EscapeDataString(taskId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/InfusionsoftExtensions.cs b/src/Azure.Connectors.Sdk/Generated/InfusionsoftExtensions.cs index 2500fbe..a227511 100644 --- a/src/Azure.Connectors.Sdk/Generated/InfusionsoftExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/InfusionsoftExtensions.cs @@ -72,52 +72,6 @@ public class ListTasksResponse public List Tasks { get; set; } } - /// - /// Item in Response for When there is a new order - /// - public class ListOrdersResponseItem - { - /// The unique id of the order. - [JsonPropertyName("id")] - public int? Id { get; set; } - - /// Name given to the order. - [JsonPropertyName("title")] - public string Title { get; set; } - - /// The status of the order. - [JsonPropertyName("status")] - public string Status { get; set; } - - /// Total amount of the order. - [JsonPropertyName("total")] - public float? Total { get; set; } - - /// Shipping info for the order. - [JsonPropertyName("shipping_information")] - public object Shipping { get; set; } - - /// Order contact. - [JsonPropertyName("contact")] - public object Contact { get; set; } - - /// Creation date of the order. - [JsonPropertyName("creation_date")] - public DateTime? CreationDate { get; set; } - - /// Order date of the order. - [JsonPropertyName("order_date")] - public DateTime? OrderDate { get; set; } - - /// Total paid amount of the order. - [JsonPropertyName("total_paid")] - public float? TotalPaid { get; set; } - - /// Total amount due for the order. - [JsonPropertyName("total_due")] - public float? TotalDue { get; set; } - } - /// /// CreateTask_Request /// @@ -257,36 +211,6 @@ public static ListTasksResponse ListTasksResponse( }; } - /// - /// Creates a new instance of . - /// - public static ListOrdersResponseItem ListOrdersResponseItem( - int? id = default, - string title = default, - string status = default, - float? total = default, - object shipping = default, - object contact = default, - DateTime? creationDate = default, - DateTime? orderDate = default, - float? totalPaid = default, - float? totalDue = default) - { - return new ListOrdersResponseItem - { - Id = id, - Title = title, - Status = status, - Total = total, - Shipping = shipping, - Contact = contact, - CreationDate = creationDate, - OrderDate = orderDate, - TotalPaid = totalPaid, - TotalDue = totalDue, - }; - } - /// /// Creates a new instance of . /// @@ -312,6 +236,43 @@ public static CreateTaskRequest CreateTaskRequest( #region Trigger Payloads + /// + /// Typed trigger payload for the OnNewTask trigger (Infusionsoft "When a new task is created", operationId: OnNewTask). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<InfusionsoftOnNewTaskTriggerPayload>(body). + /// + public class InfusionsoftOnNewTaskTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnNewOrder trigger (Infusionsoft "When there is a new order", operationId: OnNewOrder). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<InfusionsoftOnNewOrderTriggerPayload>(body). + /// + public class InfusionsoftOnNewOrderTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Infusionsoft connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class InfusionsoftTriggers + { + /// + /// Trigger operations with typed payloads for the Infusionsoft connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnNewTask"] = typeof(InfusionsoftOnNewTaskTriggerPayload), + ["OnNewOrder"] = typeof(InfusionsoftOnNewOrderTriggerPayload), + }); + } + #endregion Trigger Payloads } @@ -330,11 +291,13 @@ public static class InfusionsoftTriggerOperations { /// /// When a new task is created. + /// Payload type: . /// public const string OnNewTask = "OnNewTask"; /// /// When there is a new order. + /// Payload type: . /// public const string OnNewOrder = "OnNewOrder"; diff --git a/src/Azure.Connectors.Sdk/Generated/JiraExtensions.cs b/src/Azure.Connectors.Sdk/Generated/JiraExtensions.cs new file mode 100644 index 0000000..6b5bbb7 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/JiraExtensions.cs @@ -0,0 +1,1679 @@ +// JiraExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Jira.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Jira.Models +{ + + #region Types + + /// + /// Response for Get list of issues + /// + public class ListIssuesResponse + { + /// The maximum number of items to return per page + [JsonPropertyName("maxResults")] + public int? MaximumNumberOfItems { get; set; } + + /// issues + [JsonPropertyName("issues")] + public List Issues { get; set; } + } + + /// + /// Item in issues + /// + public class FullIssue + { + /// Unique id of the issue. + [JsonPropertyName("id")] + public string IssueId { get; set; } + + /// Unique key of the issue. + [JsonPropertyName("key")] + public string IssueKey { get; set; } + + /// Browse to the issue using this URL. + [JsonPropertyName("self")] + public string IssueURL { get; set; } + + /// fields + [JsonPropertyName("fields")] + public object Fields { get; set; } + } + + /// + /// Response for Get list of issues (Datacenter) + /// + public class ListIssuesResponseDatacenter + { + /// The index of the first item to return in a page of results + [JsonPropertyName("startAt")] + public int? StartingRecordNumber { get; set; } + + /// The maximum number of items to return per page + [JsonPropertyName("maxResults")] + public int? MaximumNumberOfItems { get; set; } + + /// issues + [JsonPropertyName("issues")] + public List Issues { get; set; } + } + + /// + /// Response for Get list of Transitions + /// + public class ListTransitionsResponse + { + /// transitions + [JsonPropertyName("transitions")] + public List Transitions { get; set; } + } + + /// + /// Item in transitions + /// + public class Transition + { + /// ID of the transition + [JsonPropertyName("id")] + public string Id { get; set; } + + /// Name of the transition + [JsonPropertyName("name")] + public string Name { get; set; } + + /// to + [JsonPropertyName("to")] + public TransitionStatus To { get; set; } + + /// Fields required for this transition + [JsonPropertyName("fields")] + public object Fields { get; set; } + } + + /// + /// to + /// + public class TransitionStatus + { + /// ID of the status + [JsonPropertyName("id")] + public string Id { get; set; } + + /// Name of the status + [JsonPropertyName("name")] + public string Name { get; set; } + } + + /// + /// Response for Performs an issue transition + /// + public class UpdateTransitionResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get current user + /// + public class GetCurrentUserResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Jira MCP Server + /// + public class MCPQueryResponse + { + /// jsonrpc + [JsonPropertyName("jsonrpc")] + public string Jsonrpc { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// method + [JsonPropertyName("method")] + public string Method { get; set; } + + /// params + [JsonPropertyName("params")] + public object Params { get; set; } + + /// result + [JsonPropertyName("result")] + public object Result { get; set; } + + /// error + [JsonPropertyName("error")] + public object Error { get; set; } + } + + /// + /// Response for Add comment (V2) + /// + public class CommentResponse + { + /// Unique id of the comment. + [JsonPropertyName("id")] + public string CommentId { get; set; } + + /// Body of the comment. + [JsonPropertyName("body")] + public string CommentBody { get; set; } + + /// yyyy-MM-ddTHH:mm:ss.fffZ + [JsonPropertyName("created")] + [JsonInclude] + public DateTime? CreatedDateTime { get; internal set; } + } + + /// + /// Response for Cancel Task (V2) + /// + public class CancelTaskResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Create a new issue (V3) + /// + [DynamicSchema("ListIssueTypesFields_V2")] + public class CreateIssueInput + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Create a new issue (V3) + /// + public class CreateIssueResponse + { + /// Unique identifier of the issue. + [JsonPropertyName("id")] + public string IssueId { get; set; } + + /// Unique key of the issue. + [JsonPropertyName("key")] + public string IssueKey { get; set; } + } + + /// + /// Create a new project (V2) + /// + public class CreateProjectInput + { + /// The unique key, starts with a capital letter. + [JsonPropertyName("key")] + public string ProjectKey { get; set; } + + /// Title of the project. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Project type key. + [JsonPropertyName("projectTypeKey")] + public ProjectTypeKey? Type { get; set; } + + /// Id of Project lead. + [JsonPropertyName("leadAccountId")] + public string LeadId { get; set; } + + /// Verbose description of the project. + [JsonPropertyName("description")] + public string Description { get; set; } + } + + /// + /// Response for Create a new project (V2) + /// + public class CreateProjectResponse + { + /// Unique id of the project. + [JsonPropertyName("id")] + public int? ProjectId { get; set; } + + /// Unique key of the project. + [JsonPropertyName("key")] + public string ProjectKey { get; set; } + } + + /// + /// Create Project Category (V2) + /// + public class CreateProjectCategoryInput + { + /// Name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Description + [JsonPropertyName("description")] + public string Description { get; set; } + } + + /// + /// Response for Create Project Category (V2) + /// + public class CreateProjectCategoryResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Edit Issue (V2) + /// + public class EditIssueInput + { + /// Transition + [JsonPropertyName("transition")] + public object Transition { get; set; } + + /// List of issue screen fields to update, specifying the sub-field to update and its value for each field. This field provides a straightforward option when setting a sub-field. When multiple sub-fields or other operations are required, use update. Fields included in here cannot be included in update. + [JsonPropertyName("fields")] + public object Fields { get; set; } + + /// A Map containing the field field name and a list of operations to perform on the issue screen field. Note that fields included in here cannot be included in fields. + [JsonPropertyName("update")] + public object Update { get; set; } + + /// History meta data + [JsonPropertyName("historyMetadata")] + public object HistoryMetadata { get; set; } + + /// Properties + [JsonPropertyName("properties")] + public List Properties { get; set; } + } + + /// + /// Response for Edit Issue (V2) + /// + public class EditIssueResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get Task (V2) + /// + public class GetTaskResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get User (V2) + /// + public class GetUserResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get list of Filters (V2) + /// + public class ListFiltersResponse + { + /// Next page of filters + [JsonPropertyName("nextPage")] + public string NextPage { get; set; } + + /// values + [JsonPropertyName("values")] + public List Values { get; set; } + } + + /// + /// Response for Get projects (V2) + /// + public class ListProjectsResponse + { + /// Next page of projects + [JsonPropertyName("nextPage")] + public string NextPage { get; set; } + + /// values + [JsonPropertyName("values")] + public List Values { get; set; } + } + + /// + /// Update Project (V2) + /// + public class UpdateProjectInput + { + /// Key + [JsonPropertyName("key")] + public string Key { get; set; } + + /// Name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Project Type Key + [JsonPropertyName("projectTypeKey")] + public string ProjectTypeKey { get; set; } + + /// Project Template Key + [JsonPropertyName("projectTemplateKey")] + public string ProjectTemplateKey { get; set; } + + /// Description + [JsonPropertyName("description")] + public string Description { get; set; } + + /// Lead + [JsonPropertyName("lead")] + public string Lead { get; set; } + + /// Lead Account ID + [JsonPropertyName("leadAccountId")] + public string LeadAccountId { get; set; } + + /// URL + [JsonPropertyName("url")] + public string Url { get; set; } + + /// Assignee Type + [JsonPropertyName("assigneeType")] + public string AssigneeType { get; set; } + + /// Avatar ID + [JsonPropertyName("avatarId")] + public string AvatarId { get; set; } + + /// Issue Security Scheme + [JsonPropertyName("issueSecurityScheme")] + public string IssueSecurityScheme { get; set; } + + /// Permission Scheme + [JsonPropertyName("permissionScheme")] + public string PermissionScheme { get; set; } + + /// Notification Scheme + [JsonPropertyName("notificationScheme")] + public string NotificationScheme { get; set; } + + /// Category ID + [JsonPropertyName("categoryId")] + public string CategoryId { get; set; } + } + + /// + /// Response for Update Project (V2) + /// + public class UpdateProjectResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Comment + /// + public class Comment + { + /// Body of the comment. + [JsonPropertyName("body")] + public string CommentValue { get; set; } + } + + /// + /// TransitionInput + /// + public class TransitionInput + { + /// fields + [JsonPropertyName("fields")] + public object Fields { get; set; } + + /// historyMetadata + [JsonPropertyName("historyMetadata")] + public object HistoryMetadata { get; set; } + + /// transition + [JsonPropertyName("transition")] + public object Transition { get; set; } + + /// update + [JsonPropertyName("update")] + public object Update { get; set; } + } + + /// + /// MCPQueryRequest + /// + public class MCPQueryRequest + { + /// jsonrpc + [JsonPropertyName("jsonrpc")] + public string Jsonrpc { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// method + [JsonPropertyName("method")] + public string Method { get; set; } + + /// params + [JsonPropertyName("params")] + public object Params { get; set; } + + /// result + [JsonPropertyName("result")] + public object Result { get; set; } + + /// error + [JsonPropertyName("error")] + public object Error { get; set; } + + /// callbackEndpoint + [JsonPropertyName("callbackEndpoint")] + public string CallbackEndpoint { get; set; } + } + + /// + /// Extensible enum for known ProjectTypeKey values. + /// + [JsonConverter(typeof(ProjectTypeKey.ProjectTypeKeyJsonConverter))] + public readonly struct ProjectTypeKey : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public ProjectTypeKey(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// Software - Scrum software development + public static ProjectTypeKey SoftwareScrumSoftwareDevelopment { get; } = new("Software - Scrum software development"); + + /// Software - Kanban software development + public static ProjectTypeKey SoftwareKanbanSoftwareDevelopment { get; } = new("Software - Kanban software development"); + + /// Software - Basic software development + public static ProjectTypeKey SoftwareBasicSoftwareDevelopment { get; } = new("Software - Basic software development"); + + /// Business - Project management + public static ProjectTypeKey BusinessProjectManagement { get; } = new("Business - Project management"); + + /// Business - Task management + public static ProjectTypeKey BusinessTaskManagement { get; } = new("Business - Task management"); + + /// Business - Process management + public static ProjectTypeKey BusinessProcessManagement { get; } = new("Business - Process management"); + + /// Converts a string to . + public static implicit operator ProjectTypeKey(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(ProjectTypeKey value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(ProjectTypeKey other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is ProjectTypeKey other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(ProjectTypeKey left, ProjectTypeKey right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(ProjectTypeKey left, ProjectTypeKey right) => !left.Equals(right); + + internal sealed class ProjectTypeKeyJsonConverter : JsonConverter + { + public ProjectTypeKeyJsonConverter() { } + public override ProjectTypeKey Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for ProjectTypeKey, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, ProjectTypeKey value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Jira models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class JiraModelFactory + { + /// + /// Creates a new instance of . + /// + public static ListIssuesResponse ListIssuesResponse( + int? maximumNumberOfItems = default, + List issues = default) + { + return new ListIssuesResponse + { + MaximumNumberOfItems = maximumNumberOfItems, + Issues = issues, + }; + } + + /// + /// Creates a new instance of . + /// + public static FullIssue FullIssue( + string issueId = default, + string issueKey = default, + string issueURL = default, + object fields = default) + { + return new FullIssue + { + IssueId = issueId, + IssueKey = issueKey, + IssueURL = issueURL, + Fields = fields, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListIssuesResponseDatacenter ListIssuesResponseDatacenter( + int? startingRecordNumber = default, + int? maximumNumberOfItems = default, + List issues = default) + { + return new ListIssuesResponseDatacenter + { + StartingRecordNumber = startingRecordNumber, + MaximumNumberOfItems = maximumNumberOfItems, + Issues = issues, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListTransitionsResponse ListTransitionsResponse( + List transitions = default) + { + return new ListTransitionsResponse + { + Transitions = transitions, + }; + } + + /// + /// Creates a new instance of . + /// + public static Transition Transition( + string id = default, + string name = default, + TransitionStatus to = default, + object fields = default) + { + return new Transition + { + Id = id, + Name = name, + To = to, + Fields = fields, + }; + } + + /// + /// Creates a new instance of . + /// + public static TransitionStatus TransitionStatus( + string id = default, + string name = default) + { + return new TransitionStatus + { + Id = id, + Name = name, + }; + } + + /// + /// Creates a new instance of . + /// + public static MCPQueryResponse MCPQueryResponse( + string jsonrpc = default, + string id = default, + string method = default, + object @params = default, + object result = default, + object error = default) + { + return new MCPQueryResponse + { + Jsonrpc = jsonrpc, + Id = id, + Method = method, + Params = @params, + Result = result, + Error = error, + }; + } + + /// + /// Creates a new instance of . + /// + public static CommentResponse CommentResponse( + string commentId = default, + string commentBody = default, + DateTime? createdDateTime = default) + { + return new CommentResponse + { + CommentId = commentId, + CommentBody = commentBody, + CreatedDateTime = createdDateTime, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateIssueResponse CreateIssueResponse( + string issueId = default, + string issueKey = default) + { + return new CreateIssueResponse + { + IssueId = issueId, + IssueKey = issueKey, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateProjectInput CreateProjectInput( + string projectKey = default, + string name = default, + ProjectTypeKey? type = default, + string leadId = default, + string description = default) + { + return new CreateProjectInput + { + ProjectKey = projectKey, + Name = name, + Type = type, + LeadId = leadId, + Description = description, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateProjectResponse CreateProjectResponse( + int? projectId = default, + string projectKey = default) + { + return new CreateProjectResponse + { + ProjectId = projectId, + ProjectKey = projectKey, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateProjectCategoryInput CreateProjectCategoryInput( + string name = default, + string description = default) + { + return new CreateProjectCategoryInput + { + Name = name, + Description = description, + }; + } + + /// + /// Creates a new instance of . + /// + public static EditIssueInput EditIssueInput( + object transition = default, + object fields = default, + object update = default, + object historyMetadata = default, + List properties = default) + { + return new EditIssueInput + { + Transition = transition, + Fields = fields, + Update = update, + HistoryMetadata = historyMetadata, + Properties = properties, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListFiltersResponse ListFiltersResponse( + string nextPage = default, + List values = default) + { + return new ListFiltersResponse + { + NextPage = nextPage, + Values = values, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListProjectsResponse ListProjectsResponse( + string nextPage = default, + List values = default) + { + return new ListProjectsResponse + { + NextPage = nextPage, + Values = values, + }; + } + + /// + /// Creates a new instance of . + /// + public static UpdateProjectInput UpdateProjectInput( + string key = default, + string name = default, + string projectTypeKey = default, + string projectTemplateKey = default, + string description = default, + string lead = default, + string leadAccountId = default, + string url = default, + string assigneeType = default, + string avatarId = default, + string issueSecurityScheme = default, + string permissionScheme = default, + string notificationScheme = default, + string categoryId = default) + { + return new UpdateProjectInput + { + Key = key, + Name = name, + ProjectTypeKey = projectTypeKey, + ProjectTemplateKey = projectTemplateKey, + Description = description, + Lead = lead, + LeadAccountId = leadAccountId, + Url = url, + AssigneeType = assigneeType, + AvatarId = avatarId, + IssueSecurityScheme = issueSecurityScheme, + PermissionScheme = permissionScheme, + NotificationScheme = notificationScheme, + CategoryId = categoryId, + }; + } + + /// + /// Creates a new instance of . + /// + public static Comment Comment( + string commentValue = default) + { + return new Comment + { + CommentValue = commentValue, + }; + } + + /// + /// Creates a new instance of . + /// + public static TransitionInput TransitionInput( + object fields = default, + object historyMetadata = default, + object transition = default, + object update = default) + { + return new TransitionInput + { + Fields = fields, + HistoryMetadata = historyMetadata, + Transition = transition, + Update = update, + }; + } + + /// + /// Creates a new instance of . + /// + public static MCPQueryRequest MCPQueryRequest( + string jsonrpc = default, + string id = default, + string method = default, + object @params = default, + object result = default, + object error = default, + string callbackEndpoint = default) + { + return new MCPQueryRequest + { + Jsonrpc = jsonrpc, + Id = id, + Method = method, + Params = @params, + Result = result, + Error = error, + CallbackEndpoint = callbackEndpoint, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnNewIssueDatacenter trigger (Jira "When a new issue is created (Datacenter)", operationId: OnNewIssue_Datacenter). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<JiraOnNewIssueDatacenterTriggerPayload>(body). + /// + public class JiraOnNewIssueDatacenterTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnCloseIssueDatacenter trigger (Jira "When an issue is closed (Datacenter)", operationId: OnCloseIssue_Datacenter). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<JiraOnCloseIssueDatacenterTriggerPayload>(body). + /// + public class JiraOnCloseIssueDatacenterTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnNewIssueJQLDatacenter trigger (Jira "When a new issue is returned by a JQL query (Datacenter)", operationId: OnNewIssueJQL_Datacenter). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<JiraOnNewIssueJQLDatacenterTriggerPayload>(body). + /// + public class JiraOnNewIssueJQLDatacenterTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnCloseIssue trigger (Jira "When an issue is closed (V2)", operationId: OnCloseIssue_V2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<JiraOnCloseIssueTriggerPayload>(body). + /// + public class JiraOnCloseIssueTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnNewIssue trigger (Jira "When a new issue is created (V2)", operationId: OnNewIssue_V2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<JiraOnNewIssueTriggerPayload>(body). + /// + public class JiraOnNewIssueTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnNewIssueJQL trigger (Jira "When a new issue is returned by a JQL query (V2)", operationId: OnNewIssueJQL_V2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<JiraOnNewIssueJQLTriggerPayload>(body). + /// + public class JiraOnNewIssueJQLTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Jira connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class JiraTriggers + { + /// + /// Trigger operations with typed payloads for the Jira connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnNewIssue_Datacenter"] = typeof(JiraOnNewIssueDatacenterTriggerPayload), + ["OnCloseIssue_Datacenter"] = typeof(JiraOnCloseIssueDatacenterTriggerPayload), + ["OnNewIssueJQL_Datacenter"] = typeof(JiraOnNewIssueJQLDatacenterTriggerPayload), + ["OnCloseIssue_V2"] = typeof(JiraOnCloseIssueTriggerPayload), + ["OnNewIssue_V2"] = typeof(JiraOnNewIssueTriggerPayload), + ["OnNewIssueJQL_V2"] = typeof(JiraOnNewIssueJQLTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Jira +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Jira connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class JiraTriggerOperations + { + /// + /// When a new issue is created (Datacenter). + /// Payload type: . + /// + public const string OnNewIssueDatacenter = "OnNewIssue_Datacenter"; + + /// + /// When an issue is closed (Datacenter). + /// Payload type: . + /// + public const string OnCloseIssueDatacenter = "OnCloseIssue_Datacenter"; + + /// + /// When a new issue is returned by a JQL query (Datacenter). + /// Payload type: . + /// + public const string OnNewIssueJQLDatacenter = "OnNewIssueJQL_Datacenter"; + + /// + /// When an issue is closed (V2). + /// Payload type: . + /// + public const string OnCloseIssue = "OnCloseIssue_V2"; + + /// + /// When a new issue is created (V2). + /// Payload type: . + /// + public const string OnNewIssue = "OnNewIssue_V2"; + + /// + /// When a new issue is returned by a JQL query (V2). + /// Payload type: . + /// + public const string OnNewIssueJQL = "OnNewIssueJQL_V2"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Jira connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class JiraTriggerParameters + { + /// + /// Input parameters for the OnNewIssueDatacenter trigger operation (operationId: OnNewIssue_Datacenter). + /// + public static class OnNewIssueDatacenter + { + /// + /// The url where your Jira instance is hosted (must support https). + /// Dynamic values from: ListResources. + /// + public const string XRequestJirainstance = "X-Request-Jirainstance"; + + /// + /// Unique key of the project to look for new issues. + /// Required. + /// Dynamic values from: ListProjects_V3. + /// + public const string ProjectKey = "projectKey"; + + } + + /// + /// Input parameters for the OnCloseIssueDatacenter trigger operation (operationId: OnCloseIssue_Datacenter). + /// + public static class OnCloseIssueDatacenter + { + /// + /// The url where your Jira instance is hosted (must support https). + /// Dynamic values from: ListResources. + /// + public const string XRequestJirainstance = "X-Request-Jirainstance"; + + /// + /// Unique key of the project to look for new issues. + /// Required. + /// Dynamic values from: ListProjects_V3. + /// + public const string ProjectKey = "projectKey"; + + } + + /// + /// Input parameters for the OnNewIssueJQLDatacenter trigger operation (operationId: OnNewIssueJQL_Datacenter). + /// + public static class OnNewIssueJQLDatacenter + { + /// + /// The url where your Jira instance is hosted (must support https). + /// Dynamic values from: ListResources. + /// + public const string XRequestJirainstance = "X-Request-Jirainstance"; + + /// + /// Query to use. + /// Required. + /// Default: . + /// + public const string Jql = "jql"; + + } + + /// + /// Input parameters for the OnCloseIssue trigger operation (operationId: OnCloseIssue_V2). + /// + public static class OnCloseIssue + { + /// + /// The url where your Jira instance is hosted (must support https). + /// Dynamic values from: ListResources. + /// + public const string XRequestJirainstance = "X-Request-Jirainstance"; + + /// + /// Unique key of the project to look for new issues. + /// Required. + /// Dynamic values from: ListProjects_V3. + /// + public const string ProjectKey = "projectKey"; + + } + + /// + /// Input parameters for the OnNewIssue trigger operation (operationId: OnNewIssue_V2). + /// + public static class OnNewIssue + { + /// + /// The url where your Jira instance is hosted (must support https). + /// Dynamic values from: ListResources. + /// + public const string XRequestJirainstance = "X-Request-Jirainstance"; + + /// + /// Unique key of the project to look for new issues. + /// Required. + /// Dynamic values from: ListProjects_V3. + /// + public const string ProjectKey = "projectKey"; + + } + + /// + /// Input parameters for the OnNewIssueJQL trigger operation (operationId: OnNewIssueJQL_V2). + /// + public static class OnNewIssueJQL + { + /// + /// The url where your Jira instance is hosted (must support https). + /// Dynamic values from: ListResources. + /// + public const string XRequestJirainstance = "X-Request-Jirainstance"; + + /// + /// Query to use. + /// Required. + /// Default: . + /// + public const string Jql = "jql"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for jira connector. + /// + public class JiraClient : ConnectorClientBase + { + /// + /// Creates a new JiraClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public JiraClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new JiraClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public JiraClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new JiraClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public JiraClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new JiraClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public JiraClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected JiraClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "jira"; + + /// + /// Get list of Resources + /// + /// This operation returns a list of resources accessible to user. + /// Cancellation token. + /// The Get list of Resources response. + public virtual async Task> ListResourcesAsync(CancellationToken cancellationToken = default) + { + var path = $"/oauth/token/accessible-resources"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get list of issues + /// + /// This operation returns a list of issues using JQL. + /// Cancellation token. + /// The Get list of issues response. + public virtual async Task ListIssuesAsync(CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("jql=created%20%3E%3D%20-3650d"); + queryParams.Add("expand=%2A"); + queryParams.Add("fields=%2Aall"); + var path = $"/2/search" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get list of issues (Datacenter) + /// + /// This operation returns a list of issues using JQL. + /// Cancellation token. + /// The Get list of issues (Datacenter) response. + public virtual async Task ListIssuesDatacenterAsync(CancellationToken cancellationToken = default) + { + var path = $"/datacenter/search"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get list of Transitions + /// + /// Returns a list of the transitions possible for this issue by the current user + /// Issue ID or Key + /// Cancellation token. + /// The Get list of Transitions response. + public virtual async Task ListTransitionsAsync(string issueIdOrKey, CancellationToken cancellationToken = default) + { + var path = $"/3/issue/{Uri.EscapeDataString(issueIdOrKey.ToString())}/transitions"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Performs an issue transition + /// + /// Transitions an issue to a new status. + /// Issue ID or Key + /// The request body. + /// Cancellation token. + /// The Performs an issue transition response. + public virtual async Task UpdateTransitionAsync(string issueIdOrKey, TransitionInput input, CancellationToken cancellationToken = default) + { + var path = $"/3/issue/{Uri.EscapeDataString(issueIdOrKey.ToString())}/transitions"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get current user + /// + /// This operation returns details for the current user + /// Expand + /// Cancellation token. + /// The Get current user response. + public virtual async Task GetCurrentUserAsync(string expand = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (expand != default) + queryParams.Add($"expand={Uri.EscapeDataString(expand.ToString())}"); + var path = $"/3/myself" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Jira MCP Server + /// + /// Jira MCP Server + /// The request body. + /// sessionId + /// Cancellation token. + /// The Jira MCP Server response. + public virtual async Task McpJiraIssueManagementAsync(MCPQueryRequest input, string sessionId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (sessionId != default) + queryParams.Add($"sessionId={Uri.EscapeDataString(sessionId.ToString())}"); + var path = $"/mcp/JiraIssueManagement" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add comment (V2) + /// + /// This operation is used to add a comment to an existing Jira issue. + /// Issue Key + /// The request body. + /// Cancellation token. + /// The Add comment (V2) response. + public virtual async Task AddCommentAsync(string issueKey, Comment input, CancellationToken cancellationToken = default) + { + var path = $"/v2/issue/{Uri.EscapeDataString(issueKey.ToString())}/comment"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Cancel Task (V2) + /// + /// Cancels a task. Permissions required: either of: Administer Jira or Creator of the task. + /// Task ID + /// Cancellation token. + /// The Cancel Task (V2) response. + public virtual async Task CancelTaskAsync(string taskId, CancellationToken cancellationToken = default) + { + var path = $"/v2/task/{Uri.EscapeDataString(taskId.ToString())}/cancel"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a new issue (V3) + /// + /// This operation is used to create a new issue. + /// The request body. + /// Project + /// Issue Type Id + /// Cancellation token. + /// The Create a new issue (V3) response. + public virtual async Task CreateIssueAsync(CreateIssueInput input, [DynamicValues("ListProjects_V3")] string project, [DynamicValues("ListIssueTypes_V2")] string issueTypeId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"projectKey={Uri.EscapeDataString(project.ToString())}"); + queryParams.Add($"issueTypeIds={Uri.EscapeDataString(issueTypeId.ToString())}"); + var path = $"/v3/issue" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a new project (V2) + /// + /// This operation is used to create a new Jira project. + /// The request body. + /// Cancellation token. + /// The Create a new project (V2) response. + public virtual async Task CreateProjectAsync(CreateProjectInput input, CancellationToken cancellationToken = default) + { + var path = $"/v2/project"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create Project Category (V2) + /// + /// Creates a project category. Permissions required: Administer Jira (global permissions) + /// The request body. + /// Cancellation token. + /// The Create Project Category (V2) response. + public virtual async Task CreateProjectCategoryAsync(CreateProjectCategoryInput input, CancellationToken cancellationToken = default) + { + var path = $"/v2/projectCategory"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete Project (V2) + /// + /// Deletes a project. Permissions required: Administer Jira (global permissions) + /// Project ID or Key + /// Enable Undo + /// Cancellation token. + public virtual async Task DeleteProjectAsync(string projectIdOrKey, bool? enableUndo = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (enableUndo.HasValue) + queryParams.Add($"enableUndo={Uri.EscapeDataString(enableUndo.Value.ToString())}"); + var path = $"/v2/project/{Uri.EscapeDataString(projectIdOrKey.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Edit Issue (V2) + /// + /// Edits an issue. A transition may be applied and issue properties updated as part of the edit. The edits to the issue's fields are defined using update and fields. + /// Issue ID or Key + /// The request body. + /// Notify Users + /// Override Screen Security + /// Override Editable Flag + /// Cancellation token. + /// The Edit Issue (V2) response. + public virtual async Task EditIssueAsync(string issueIdOrKey, EditIssueInput input, bool? notifyUsers = default, bool? overrideScreenSecurity = default, bool? overrideEditableFlag = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (notifyUsers.HasValue) + queryParams.Add($"notifyUsers={Uri.EscapeDataString(notifyUsers.Value.ToString())}"); + if (overrideScreenSecurity.HasValue) + queryParams.Add($"overrideScreenSecurity={Uri.EscapeDataString(overrideScreenSecurity.Value.ToString())}"); + if (overrideEditableFlag.HasValue) + queryParams.Add($"overrideEditableFlag={Uri.EscapeDataString(overrideEditableFlag.Value.ToString())}"); + var path = $"/v2/3/issue/{Uri.EscapeDataString(issueIdOrKey.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get All Project Categories (V2) + /// + /// Returns all project categories. + /// Cancellation token. + /// The Get All Project Categories (V2) response. + public virtual async Task> GetAllProjectCategoriesAsync(CancellationToken cancellationToken = default) + { + var path = $"/v2/projectCategory"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get issue by key (V2) + /// + /// This operation is used to retrieve the issue object for a given issue Key. + /// Issue Key + /// Cancellation token. + /// The Get issue by key (V2) response. + public virtual async Task GetIssueAsync(string issueKey, CancellationToken cancellationToken = default) + { + var path = $"/v2/issue/{Uri.EscapeDataString(issueKey.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Task (V2) + /// + /// Returns the status of a long-running asynchronous task. When a task has finished, this operation returns the JSON blob applicable to the task. + /// Task ID + /// Cancellation token. + /// The Get Task (V2) response. + public virtual async Task GetTaskAsync(string taskId, CancellationToken cancellationToken = default) + { + var path = $"/v2/task/{Uri.EscapeDataString(taskId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get User (V2) + /// + /// Returns a user. Permissions required: Browse users and groups. + /// Account ID + /// Expand + /// Cancellation token. + /// The Get User (V2) response. + public virtual async Task GetUserAsync(string accountId, string expand = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"accountId={Uri.EscapeDataString(accountId.ToString())}"); + if (expand != default) + queryParams.Add($"expand={Uri.EscapeDataString(expand.ToString())}"); + var path = $"/v2/user" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get list of Filters (V2) + /// + /// This operation returns a list of Filters accessible to user. + /// Cancellation token. + /// The Get list of Filters (V2) response. + public virtual async Task ListFiltersAsync(CancellationToken cancellationToken = default) + { + var path = $"/v2/filter/search"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get issue types (V2) + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Project + /// Cancellation token. + /// The Get issue types (V2) response. + public virtual async Task> ListIssueTypesAsync([DynamicValues("ListProjects_V3")] string project, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"projectKey={Uri.EscapeDataString(project.ToString())}"); + var path = $"/v2/types/issue/createmeta" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get issue types fields (V2) + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Project + /// Issue Types + /// Cancellation token. + /// The Get issue types fields (V2) response. + public virtual async Task> ListIssueTypesFieldsAsync(string project, string issueTypes, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"projectKey={Uri.EscapeDataString(project.ToString())}"); + queryParams.Add($"issuetypeIds={Uri.EscapeDataString(issueTypes.ToString())}"); + var path = $"/v3/issue/createmeta" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get projects (V2) + /// + /// This operation is used to retrieve a list of projects for your Jira instance. + /// Cancellation token. + /// The Get projects (V2) response. + public virtual async Task ListProjectsAsync(CancellationToken cancellationToken = default) + { + var path = $"/v2/project/search"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List users by project (V2) + /// + /// This operation is used to retrieve a list of all users associated with a project. + /// Project key + /// Cancellation token. + /// The List users by project (V2) response. + public virtual async Task> ListProjectUsersAsync([DynamicValues("ListProjects_V3")] string projectKey, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"projectKey={Uri.EscapeDataString(projectKey.ToString())}"); + var path = $"/v2/user/permission/search" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Remove Project Category (V2) + /// + /// Deletes a project category. Permissions required: Administer Jira (global permissions) + /// Project ID + /// Cancellation token. + public virtual async Task RemoveProjectCategoryAsync(int projectId, CancellationToken cancellationToken = default) + { + var path = $"/v2/projectCategory/{Uri.EscapeDataString(projectId.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update Project (V2) + /// + /// Updates the project details of a project. + /// Project ID or Key + /// The request body. + /// Cancellation token. + /// The Update Project (V2) response. + public virtual async Task UpdateProjectAsync(string projectIdOrKey, UpdateProjectInput input, CancellationToken cancellationToken = default) + { + var path = $"/v2/project/{Uri.EscapeDataString(projectIdOrKey.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/MailChimpExtensions.cs b/src/Azure.Connectors.Sdk/Generated/MailChimpExtensions.cs new file mode 100644 index 0000000..2b4d4a9 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/MailChimpExtensions.cs @@ -0,0 +1,2866 @@ +// MailChimpExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.MailChimp.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.MailChimp.Models +{ + + #region Types + + /// + /// Response for List campaigns + /// + public class GetCampaignsResponse + { + /// An array of objects, each representing a campaign + [JsonPropertyName("campaigns")] + public List Campaigns { get; set; } + } + + /// + /// Item in An array of objects, each representing a campaign + /// + public class CampaignResponseModel + { + /// A string that uniquely identifies this campaign + [JsonPropertyName("id")] + public string CampaignId { get; set; } + + /// There are four types of campaigns you can create in MailChimp. A/B Split campaigns have been deprecated and variate campaigns should be used instead + [JsonPropertyName("type")] + public MailchimpType? CampaignType { get; set; } + + /// The date and time the campaign was created + [JsonPropertyName("create_time")] + [JsonInclude] + public string CreatedTime { get; internal set; } + + /// The link to the campaign's archive version + [JsonPropertyName("archive_url")] + public string ArchiveURL { get; set; } + + /// The link to the campaign's archive version + [JsonPropertyName("status")] + public string Status { get; set; } + + /// The total number of emails sent for this campaign + [JsonPropertyName("emails_sent")] + public int? EmailsSent { get; set; } + + /// The time and date a campaign was sent + [JsonPropertyName("send_time")] + public string SendTime { get; set; } + + /// How the campaign's content is put together (`template', `drag_and_drop', `html', `url') + [JsonPropertyName("content_type")] + public string ContentType { get; set; } + + /// List settings for the campaign + [JsonPropertyName("recipient")] + public List List { get; set; } + + /// settings + [JsonPropertyName("settings")] + public Settings Settings { get; set; } + + /// variate_settings + [JsonPropertyName("variate_settings")] + public VariateSettings VariateSettings { get; set; } + + /// tracking + [JsonPropertyName("tracking")] + public Tracking Tracking { get; set; } + + /// rss_opts + [JsonPropertyName("rss_opts")] + public RSSOpts RssOpts { get; set; } + + /// ab_split_opts + [JsonPropertyName("ab_split_opts")] + public ABSplitOpts AbSplitOpts { get; set; } + + /// social_card + [JsonPropertyName("social_card")] + public SocialCard SocialCard { get; set; } + + /// report_summary + [JsonPropertyName("report_summary")] + public ReportSummary ReportSummary { get; set; } + + /// delivery_status + [JsonPropertyName("delivery_status")] + public DeliveryStatus DeliveryStatus { get; set; } + + /// A list of link types and descriptions for the API schema documents + [JsonPropertyName("_links")] + public List Links { get; set; } + } + + /// + /// Item in List settings for the campaign + /// + public class Recipient + { + /// The unique list id + [JsonPropertyName("list_id")] + public string ListId { get; set; } + + /// segment_opts + [JsonPropertyName("segment_opts")] + public SegmentOpts SegmentOpts { get; set; } + } + + /// + /// segment_opts + /// + public class SegmentOpts + { + /// The id for an existing saved segment + [JsonPropertyName("saved_segment_id")] + public int? SavedSegmentId { get; set; } + + /// Segment match type: Possible Values: any, all + [JsonPropertyName("match")] + public string MatchType { get; set; } + } + + /// + /// settings + /// + public class Settings + { + /// The subject line for the campaign + [JsonPropertyName("subject_line")] + public string CampaignSubjectLine { get; set; } + + /// The title of the campaign + [JsonPropertyName("title")] + public string Title { get; set; } + + /// The 'from' name on the campaign (not an email address) + [JsonPropertyName("from_name")] + public string FromName { get; set; } + + /// The reply-to email address for the campaign + [JsonPropertyName("reply_to")] + public string ReplyToAddress { get; set; } + + /// Use MailChimp Conversation feature to manage out-of-office replies + [JsonPropertyName("use_conversation")] + public bool? Conversation { get; set; } + + /// The campaign's custom 'To' name. Typically the first name merge field + [JsonPropertyName("to_name")] + public string ToName { get; set; } + + /// If the campaign is listed in a folder, the id for that folder + [JsonPropertyName("folder_id")] + public string FolderId { get; set; } + + /// Whether MailChimp authenticated the campaign. Defaults to true + [JsonPropertyName("authenticate")] + public bool? Authentication { get; set; } + + /// Automatically append MailChimp's default footer to the campaign + [JsonPropertyName("auto_footer")] + public bool? AutoFooter { get; set; } + + /// Automatically inline the CSS included with the campaign content + [JsonPropertyName("inline_css")] + public bool? InlineCSS { get; set; } + + /// Automatically tweet a link to the campaign archive page when the campaign is sent + [JsonPropertyName("auto_tweet")] + public bool? AutoTweet { get; set; } + + /// An array of Facebook page ids to auto-post to + [JsonPropertyName("auto_fb_post")] + public List AutoPostToFacebook { get; set; } + + /// Allows Facebook comments on the campaign (also force-enables the Campaign Archive toolbar). Defaults to true + [JsonPropertyName("fb_comments")] + public bool? FacebookComments { get; set; } + } + + /// + /// variate_settings + /// + public class VariateSettings + { + /// The combination that performs the best. This may be determined automatically by click rate, open rate, or total revenue-or you may choose manually based on the reporting data you find the most valuable. For Multivariate Campaigns testing send_time, winner_critera is ignored. For Multivariate Campaigns with 'manual' as the winner_citeria, the winner must be chosen in the MailChimp web application + [JsonPropertyName("winner_criteria")] + public string WinningCriteria { get; set; } + + /// The number of minutes to wait before choosing the winning campaign. The value of wait_time must be greater than 0 and in whole hours, specified in minutes + [JsonPropertyName("wait_time")] + public int? WaitTime { get; set; } + + /// The percentage of recipients to send the test combinations to, must be a value between 10 and 100 + [JsonPropertyName("test_size")] + public int? TestSize { get; set; } + + /// The possible subject lines to test. If no subject lines are provided, settings.subject_line will be used + [JsonPropertyName("subject_lines")] + public List SubjectLines { get; set; } + + /// The possible send times to test. The times provided should be in the format YYYY-MM-DD HH:MM:SS. If send_times are provided to test, the test_size will be set to 100% and winner_criteria will be ignored + [JsonPropertyName("send_times")] + public List SendTimes { get; set; } + + /// The possible from names. The number of from_names provided must match the number of reply_to_addresses. If no from_names are provided, settings.from_name will be used + [JsonPropertyName("from_names")] + public List FromNames { get; set; } + + /// The possible from names. The number of from_names provided must match the number of reply_to_addresses. If no from_names are provided, settings.from_name will be used + [JsonPropertyName("reply_to_addresses")] + public List ReplyToAddresses { get; set; } + } + + /// + /// tracking + /// + public class Tracking + { + /// Whether to track opens. Defaults to true. Cannot be set to false for variate campaigns + [JsonPropertyName("opens")] + public bool? Opens { get; set; } + + /// Whether to track clicks in the HTML version of the campaign. Defaults to true. Cannot be set to false for variate campaigns + [JsonPropertyName("html_clicks")] + public bool? HTMLClickTracking { get; set; } + + /// Whether to track clicks in the plain-text version of the campaign. Defaults to true. Cannot be set to false for variate campaigns + [JsonPropertyName("text_clicks")] + public bool? PlainTextClickTracking { get; set; } + + /// Whether to enable Goal tracking + [JsonPropertyName("goal_tracking")] + public bool? MailChimpGoalTracking { get; set; } + + /// Whether to enable eCommerce360 tracking + [JsonPropertyName("ecomm360")] + public bool? ECommerce360Tracking { get; set; } + + /// The custom slug for Google Analytics tracking (max of 50 bytes) + [JsonPropertyName("google_analytics")] + public string GoogleAnalyticsTracking { get; set; } + + /// The custom slug for ClickTale tracking (max of 50 bytes) + [JsonPropertyName("clicktale")] + public string ClickTaleAnalyticsTracking { get; set; } + + /// salesforce + [JsonPropertyName("salesforce")] + public Salesforce Salesforce { get; set; } + + /// highrise + [JsonPropertyName("highrise")] + public Highrise Highrise { get; set; } + + /// capsule + [JsonPropertyName("capsule")] + public Capsule Capsule { get; set; } + } + + /// + /// salesforce + /// + public class Salesforce + { + /// Create a campaign in a connected Salesforce account + [JsonPropertyName("campaign")] + public bool? SalesforceCampaign { get; set; } + + /// Update contact notes for a campaign based on subscriber email addresses + [JsonPropertyName("notes")] + public bool? SalesforceNote { get; set; } + } + + /// + /// highrise + /// + public class Highrise + { + /// Create a campaign in a connected Highrise account + [JsonPropertyName("campaign")] + public bool? HighriseCampaign { get; set; } + + /// Update contact notes for a campaign based on subscriber email addresses + [JsonPropertyName("notes")] + public bool? HighriseNote { get; set; } + } + + /// + /// capsule + /// + public class Capsule + { + /// Update contact notes for a campaign based on subscriber email addresses + [JsonPropertyName("notes")] + public bool? CapsuleNote { get; set; } + } + + /// + /// rss_opts + /// + public class RSSOpts + { + /// The URL for the RSS feed + [JsonPropertyName("feed_url")] + public string FeedURL { get; set; } + + /// The frequency of the RSS Campaign + [JsonPropertyName("frequency")] + public Frequency? Frequency { get; set; } + + /// Whether to add CSS to images in the RSS feed to constrain their width in campaigns + [JsonPropertyName("constrain_rss_img")] + public string ConstrainRSSImages { get; set; } + + /// schedule + [JsonPropertyName("schedule")] + public Schedule Schedule { get; set; } + } + + /// + /// schedule + /// + public class Schedule + { + /// The hour to send the campaign in local time. Acceptable hours are 0-23. For example, `4' would be 4am in your account's default time zone + [JsonPropertyName("hour")] + public int? SendingHour { get; set; } + + /// daily_send + [JsonPropertyName("daily_send")] + public DailySend DailySend { get; set; } + + /// The day of the week to send a weekly RSS Campaign + [JsonPropertyName("weekly_send_day")] + public WeeklySendDay? WeeklySendingDay { get; set; } + + /// The day of the month to send a monthly RSS Campaign. Acceptable days are 1-32, where `0' is always the last day of a month. Months with fewer than the selected number of days will not have an RSS campaign sent out that day. For example, RSS Campaigns set to send on the 30th will not go out in February + [JsonPropertyName("monthly_send_date")] + public float? MonthlySendingDay { get; set; } + } + + /// + /// daily_send + /// + public class DailySend + { + /// Sends the daily RSS Campaign on Sundays + [JsonPropertyName("sunday")] + public bool? Sunday { get; set; } + + /// Sends the daily RSS Campaign on Mondays + [JsonPropertyName("monday")] + public bool? Monday { get; set; } + + /// Sends the daily RSS Campaign on Tuesdays + [JsonPropertyName("tuesday")] + public bool? Tuesday { get; set; } + + /// Sends the daily RSS Campaign on Wednesdays + [JsonPropertyName("wednesday")] + public bool? Wednesday { get; set; } + + /// Sends the daily RSS Campaign on Thursdays + [JsonPropertyName("thursday")] + public bool? Thursday { get; set; } + + /// Sends the daily RSS Campaign on Fridays + [JsonPropertyName("friday")] + public bool? Friday { get; set; } + + /// Sends the daily RSS Campaign on Saturdays + [JsonPropertyName("saturday")] + public bool? Saturday { get; set; } + } + + /// + /// ab_split_opts + /// + public class ABSplitOpts + { + /// The type of AB split to run + [JsonPropertyName("split_test")] + public string SplitTest { get; set; } + + /// How we should evaluate a winner. Based on 'opens', 'clicks', or 'manual' + [JsonPropertyName("pick_winner")] + public string PickWinner { get; set; } + + /// How unit of time for measuring the winner ('hours' or 'days'). This cannot be changed after a campaign is sent + [JsonPropertyName("wait_units")] + public string WaitTime { get; set; } + + /// The size of the split groups. Campaigns split based on 'schedule' are forced to have a 50/50 split. Valid split integers are between 1-50 + [JsonPropertyName("split_size")] + public int? SplitSize { get; set; } + + /// For campaigns split on 'From Name', the name for Group A + [JsonPropertyName("from_name_a")] + public string FromNameGroupA { get; set; } + + /// For campaigns split on 'From Name', the name for Group B + [JsonPropertyName("from_name_b")] + public string FromNameGroupB { get; set; } + + /// For campaigns split on `From Name', the reply-to address for Group A + [JsonPropertyName("reply_email_a")] + public string ReplyEmailGroupA { get; set; } + + /// For campaigns split on `From Name', the reply-to address for Group B + [JsonPropertyName("reply_email_b")] + public string ReplyEmailGroupB { get; set; } + + /// For campaigns split on `Subject Line', the subject line for Group A + [JsonPropertyName("subject_a")] + public string SubjectLineGroupA { get; set; } + + /// For campaigns split on `Subject Line', the subject line for Group B + [JsonPropertyName("subject_b")] + public string SubjectLineGroupB { get; set; } + + /// The send time for Group A + [JsonPropertyName("send_time_a")] + public string SendTimeGroupA { get; set; } + + /// The send time for Group B + [JsonPropertyName("send_time_b")] + public string SendTimeGroupB { get; set; } + + /// The send time for the winning version + [JsonPropertyName("send_time_winner")] + public string SendTimeWinner { get; set; } + } + + /// + /// social_card + /// + public class SocialCard + { + /// The url for the header image for the card + [JsonPropertyName("image_url")] + public string ImageURL { get; set; } + + /// A short summary of the campaign to display + [JsonPropertyName("description")] + public string CampaignDescription { get; set; } + + /// The title for the card. Typically the subject line of the campaign + [JsonPropertyName("title")] + public string Title { get; set; } + } + + /// + /// report_summary + /// + public class ReportSummary + { + /// The total number of opens for a campaign + [JsonPropertyName("opens")] + public int? AutomationOpens { get; set; } + + /// The number of unique opens + [JsonPropertyName("unique_opens")] + public int? UniqueOpens { get; set; } + + /// The number of unique opens divided by the total number of successful deliveries + [JsonPropertyName("open_rate")] + public float? OpenRate { get; set; } + + /// The total number of clicks for an campaign + [JsonPropertyName("clicks")] + public int? TotalClicks { get; set; } + + /// The number of unique clicks + [JsonPropertyName("subscriber_clicks")] + public float? UniqueSubscriberClicks { get; set; } + + /// The number of unique clicks divided by the total number of successful deliveries + [JsonPropertyName("click_rate")] + public float? ClickRate { get; set; } + } + + /// + /// delivery_status + /// + public class DeliveryStatus + { + /// Whether Campaign Delivery Status is enabled for this account and campaign + [JsonPropertyName("enabled")] + public bool? DeliveryStautEnabled { get; set; } + + /// Whether a campaign send can be canceled + [JsonPropertyName("can_cancel")] + public bool? CampaignCancelable { get; set; } + + /// The current state of a campaign delivery + [JsonPropertyName("status")] + public string CampaignDeliveryStatus { get; set; } + + /// The total number of emails confirmed sent for this campaign so far + [JsonPropertyName("emails_sent")] + public int? EmailsSent { get; set; } + + /// The total number of emails canceled for this campaign + [JsonPropertyName("emails_canceled")] + public int? EmailsCanceled { get; set; } + } + + /// + /// Item in A list of link types and descriptions for the API schema documents + /// + public class Link + { + /// As with an HTML `rel' attribute, this describes the type of link + [JsonPropertyName("rel")] + public string Rel { get; set; } + + /// This property contains a fully-qualified URL that can be called to retrieve the linked resource or perform the linked action + [JsonPropertyName("href")] + public string Href { get; set; } + + /// The HTTP method that should be used when accessing the URL defined in `href'. (GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD) + [JsonPropertyName("method")] + public string Method { get; set; } + + /// For GETs, this is a URL representing the schema that the response should conform to + [JsonPropertyName("targetSchema")] + public string TargetSchema { get; set; } + + /// For HTTP methods that can receive bodies (POST and PUT), this is a URL representing the schema that the body should conform to + [JsonPropertyName("schema")] + public string Schema { get; set; } + } + + /// + /// Response for Get all the lists + /// + public class GetListsResponseModel + { + /// An array of objects, each representing a list + [JsonPropertyName("lists")] + public List Lists { get; set; } + + /// The total number of items matching the query regardless of pagination + [JsonPropertyName("total_items")] + public int? ItemCount { get; set; } + } + + /// + /// Item in An array of objects, each representing a list + /// + public class CreateNewListResponseModel + { + /// A string that uniquely identifies this list + [JsonPropertyName("id")] + public string ListId { get; set; } + + /// The name of the list + [JsonPropertyName("name")] + public string ListName { get; set; } + + /// contact + [JsonPropertyName("contact")] + public Contact Contact { get; set; } + + /// The permission reminder for the list + [JsonPropertyName("permission_reminder")] + public string PermissionReminder { get; set; } + + /// Whether campaigns for this list use the Archive Bar in archives by default + [JsonPropertyName("use_archive_bar")] + public bool? UseArchiveBar { get; set; } + + /// campaign_defaults + [JsonPropertyName("campaign_defaults")] + public CampaignDefaults CampaignDefaults { get; set; } + + /// The email address to send subscribe notifications to + [JsonPropertyName("notify_on_subscribe")] + public string NotifyOnSubscribe { get; set; } + + /// The email address to send unsubscribe notifications to + [JsonPropertyName("notify_on_unsubscribe")] + public string NotifyOnUnsubscribe { get; set; } + + /// The date and time that this list was created + [JsonPropertyName("date_created")] + public string CreationDate { get; set; } + + /// An auto-generated activity score for the list (0-5) + [JsonPropertyName("list_rating")] + public int? ListRating { get; set; } + + /// Whether the list supports multiple formats for emails.When set to true, subscribers can choose whether they want to receive HTML or plain-text emails.When set to false, subscribers will receive HTML emails, with a plain-text alternative backup + [JsonPropertyName("email_type_option")] + public bool? EmailTypeOption { get; set; } + + /// Our EepURL shortened version of this list's subscribe form + [JsonPropertyName("subscribe_url_short")] + public string SubscribeURLShort { get; set; } + + /// The full version of this list's subscribe form (host will vary) + [JsonPropertyName("subscribe_url_long")] + public string SubscribeURLLong { get; set; } + + /// The list's Email Beamer address + [JsonPropertyName("beamer_address")] + public string BeamerAddress { get; set; } + + /// Whether this list is public or private + [JsonPropertyName("visibility")] + public string Visibility { get; set; } + + /// Any list-specific modules installed for this list + [JsonPropertyName("modules")] + public List Modules { get; set; } + + /// stats + [JsonPropertyName("stats")] + public Stats Stats { get; set; } + + /// A list of link types and descriptions for the API schema documents + [JsonPropertyName("_links")] + public List Links { get; set; } + } + + /// + /// contact + /// + public class Contact + { + /// The company name for the list + [JsonPropertyName("company")] + public string CompanyName { get; set; } + + /// The street address for the list contact + [JsonPropertyName("address1")] + public string AddressLine1 { get; set; } + + /// The street address for the list contact + [JsonPropertyName("address2")] + public string AddressLine2 { get; set; } + + /// The city for the list contact + [JsonPropertyName("city")] + public string City { get; set; } + + /// The state for the list contact + [JsonPropertyName("state")] + public string State { get; set; } + + /// The postal or zip code for the list contact + [JsonPropertyName("zip")] + public string PostalCode { get; set; } + + /// A two-character ISO3166 country code. Defaults to US if invalid + [JsonPropertyName("country")] + public string CountryCode { get; set; } + + /// The phone number for the list contact + [JsonPropertyName("phone")] + public string PhoneNumber { get; set; } + } + + /// + /// campaign_defaults + /// + public class CampaignDefaults + { + /// The default from name for campaigns sent to this list + [JsonPropertyName("from_name")] + public string SenderSName { get; set; } + + /// The default from email for campaigns sent to this list + [JsonPropertyName("from_email")] + public string SenderSEmailAddress { get; set; } + + /// The default subject line for campaigns sent to this list + [JsonPropertyName("subject")] + public string Subject { get; set; } + + /// The default language for this lists's forms + [JsonPropertyName("language")] + public Language? Language { get; set; } + } + + /// + /// stats + /// + public class Stats + { + /// The number of active members in the list + [JsonPropertyName("member_count")] + public int? MemberCount { get; set; } + + /// The number of members who have unsubscribed from the list + [JsonPropertyName("unsubscribe_count")] + public int? UnsubscribeCount { get; set; } + + /// The number of members cleaned from the list + [JsonPropertyName("cleaned_count")] + public int? CleanedCount { get; set; } + + /// The number of active members in the list since the last campaign was sent + [JsonPropertyName("member_count_since_send")] + public int? MemberCountSinceSend { get; set; } + + /// The number of members who have unsubscribed since the last campaign was sent + [JsonPropertyName("unsubscribe_count_since_send")] + public int? UnsubscribeCountSinceSend { get; set; } + + /// The number of members cleaned from the list since the last campaign was sent + [JsonPropertyName("cleaned_count_since_send")] + public int? CleanedCountSinceSend { get; set; } + + /// The number of campaigns in any status that use this list + [JsonPropertyName("campaign_count")] + public int? CampaignCount { get; set; } + + /// The date and time the last campaign was sent to this list + [JsonPropertyName("campaign_last_sent")] + public DateTime? CampaignLastSent { get; set; } + + /// The number of merge vars for this list (not EMAIL, which is required) + [JsonPropertyName("merge_field_count")] + public int? MergeVarCount { get; set; } + + /// The average number of subscriptions per month for the list(not returned if we haven't calculated it yet) + [JsonPropertyName("avg_sub_rate")] + public float? AverageSubscriptionRate { get; set; } + + /// The average number of unsubscriptions per month for the list(not returned if we haven't calculated it yet) + [JsonPropertyName("avg_unsub_rate")] + public float? AverageUnsubscriptionRate { get; set; } + + /// The target number of subscriptions per month for the list to keep it growing(not returned if we haven't calculated it yet) + [JsonPropertyName("target_sub_rate")] + public float? TargetSubscriptionRate { get; set; } + + /// The average open rate(a percentage represented as a number between 0 and 100) per campaign for the list(not returned if we haven't calculated it yet) + [JsonPropertyName("open_rate")] + public float? OpenRate { get; set; } + + /// The average click rate(a percentage represented as a number between 0 and 100) per campaign for the list(not returned if we haven't calculated it yet) + [JsonPropertyName("click_rate")] + public float? ClickRate { get; set; } + + /// The date and time of the last time someone subscribed to this list + [JsonPropertyName("last_sub_date")] + public string DateOfLastListSubscribe { get; set; } + + /// The date and time of the last time someone unsubscribed from this list + [JsonPropertyName("last_unsub_date")] + public string DateOfLastListUnsubscribe { get; set; } + } + + /// + /// Response for Subscribe or unsubscribe list members + /// + public class GetAddMembersBatchResponseModel + { + /// Total number of members that were added to the list + [JsonPropertyName("total_created")] + public int? TotalCreated { get; set; } + + /// The total number of an existing list members whose subscription status was updated + [JsonPropertyName("total_updated")] + public int? TotalUpdated { get; set; } + + /// The number email addresses that could not be added to the list or updated + [JsonPropertyName("error_count")] + public int? ErrorCount { get; set; } + } + + /// + /// Response for Show list members + /// + public class GetAllMembersResponseModel + { + /// An array of objects, each representing a specific list member + [JsonPropertyName("members")] + public List Members { get; set; } + + /// The list id + [JsonPropertyName("list_id")] + public string ListId { get; set; } + + /// The total number of items matching the query regardless of pagination + [JsonPropertyName("total_items")] + public int? TotalItems { get; set; } + } + + /// + /// Item in An array of objects, each representing a specific list member + /// + public class MemberResponseModel + { + /// The MD5 hash of the lowercase version of the list member's email address + [JsonPropertyName("id")] + public string EmailId { get; set; } + + /// Email address for a subscriber + [JsonPropertyName("email_address")] + public string EmailAddress { get; set; } + + /// An identifier for the address across all of MailChimp + [JsonPropertyName("unique_email_id")] + public string UniqueEmailId { get; set; } + + /// Type of email this member asked to get (`html' or `text'). + [JsonPropertyName("email_type")] + public string EmailType { get; set; } + + /// Subscriber's current status. Possible Values: subscribed, unsubscribed, cleaned, pending + [JsonPropertyName("status")] + public string Status { get; set; } + + /// merge_fields + [JsonPropertyName("merge_fields")] + public FirstAndLastName MergeFields { get; set; } + + /// stats + [JsonPropertyName("stats")] + public Stats Stats { get; set; } + + /// IP address the subscriber signed up from + [JsonPropertyName("ip_signup")] + public string SignupIP { get; set; } + + /// Date and time the subscriber signed up for the list + [JsonPropertyName("timestamp_signup")] + [JsonInclude] + public string SignupTimestamp { get; internal set; } + + /// The IP address the subscriber used to confirm their opt-in status + [JsonPropertyName("ip_opt")] + public string OptInIP { get; set; } + + /// Date and time the subscribe confirmed their opt-in status + [JsonPropertyName("timestamp_opt")] + [JsonInclude] + public string OptInTimestamp { get; internal set; } + + /// Star rating for this member, between 1 and 5 + [JsonPropertyName("member_rating")] + public int? MemberRating { get; set; } + + /// Date and time the member's info was last changed + [JsonPropertyName("last_changed")] + public string LastChangedDate { get; set; } + + /// If set/detected, the subscriber's language + [JsonPropertyName("language")] + public string Language { get; set; } + + /// VIP status for subscriber + [JsonPropertyName("vip")] + public bool? VIP { get; set; } + + /// The list member's email client + [JsonPropertyName("email_client")] + public string EmailClient { get; set; } + + /// location + [JsonPropertyName("location")] + public Location Location { get; set; } + + /// last_note + [JsonPropertyName("last_note")] + public LastNote LastNote { get; set; } + + /// The list id + [JsonPropertyName("list_id")] + public string ListId { get; set; } + + /// A list of link types and descriptions for the API schema documents + [JsonPropertyName("_links")] + public List Links { get; set; } + } + + /// + /// merge_fields + /// + public class FirstAndLastName + { + /// First name of the subscriber + [JsonPropertyName("FNAME")] + public string FirstName { get; set; } + + /// Last name of the subscriber + [JsonPropertyName("LNAME")] + public string LastName { get; set; } + } + + /// + /// location + /// + public class Location + { + /// The location latitude + [JsonPropertyName("latitude")] + public float? Latitude { get; set; } + + /// The location longitude + [JsonPropertyName("longitude")] + public float? Longitude { get; set; } + } + + /// + /// last_note + /// + public class LastNote + { + /// The note id + [JsonPropertyName("note_id")] + public int? NoteId { get; set; } + + /// The date the note was created + [JsonPropertyName("created_at")] + [JsonInclude] + public string CreatedTime { get; internal set; } + + /// The author of the note + [JsonPropertyName("created_by")] + public string Author { get; set; } + + /// The content of the note + [JsonPropertyName("note")] + public string Note { get; set; } + } + + /// + /// Response for When a Member has been added to a list + /// + public class GetMembersResponseModel + { + /// An array of objects, each representing a specific list member + [JsonPropertyName("members")] + public List Members { get; set; } + + /// The list id + [JsonPropertyName("list_id")] + public string ListId { get; set; } + + /// The total number of items matching the query regardless of pagination + [JsonPropertyName("total_items")] + public int? ItemCount { get; set; } + } + + /// + /// Item in An array of objects, each representing a specific list member + /// + public class AddUserResponseModel + { + /// The MD5 hash of the lowercase version of the list member's email address + [JsonPropertyName("id")] + public string EmailId { get; set; } + + /// Email address for a subscriber + [JsonPropertyName("email_address")] + public string EmailAddress { get; set; } + + /// An identifier for the address across all of MailChimp + [JsonPropertyName("unique_email_id")] + public string UniqueEmailId { get; set; } + + /// Type of email this member asked to get (`html' or `text'). + [JsonPropertyName("email_type")] + public string EmailType { get; set; } + + /// Subscriber's current status. Possible Values: subscribed, unsubscribed, cleaned, pending + [JsonPropertyName("status")] + public string Status { get; set; } + + /// merge_fields + [JsonPropertyName("merge_fields")] + public FirstAndLastName MergeFields { get; set; } + + /// stats + [JsonPropertyName("stats")] + public Stats Stats { get; set; } + + /// IP address the subscriber signed up from + [JsonPropertyName("ip_signup")] + public string SignupIP { get; set; } + + /// Date and time the subscriber signed up for the list + [JsonPropertyName("timestamp_signup")] + [JsonInclude] + public string SignupTimestamp { get; internal set; } + + /// The IP address the subscriber used to confirm their opt-in status + [JsonPropertyName("ip_opt")] + public string OptInIP { get; set; } + + /// Date and time the subscribe confirmed their opt-in status + [JsonPropertyName("timestamp_opt")] + [JsonInclude] + public string OptInTimestamp { get; internal set; } + + /// Star rating for this member, between 1 and 5 + [JsonPropertyName("member_rating")] + public int? MemberRating { get; set; } + + /// Date and time the member's info was last changed + [JsonPropertyName("last_changed")] + public string LastChangedDate { get; set; } + + /// If set/detected, the subscriber's language + [JsonPropertyName("language")] + public string Language { get; set; } + + /// VIP status for subscriber + [JsonPropertyName("vip")] + public bool? VIP { get; set; } + + /// The list member's email client + [JsonPropertyName("email_client")] + public string EmailClient { get; set; } + + /// location + [JsonPropertyName("location")] + public Location Location { get; set; } + + /// last_note + [JsonPropertyName("last_note")] + public LastNote LastNote { get; set; } + + /// The list id + [JsonPropertyName("list_id")] + public string ListId { get; set; } + + /// A list of link types and descriptions for the API schema documents + [JsonPropertyName("_links")] + public List Links { get; set; } + } + + /// + /// NewCampaignRequestV2 + /// + public class NewCampaignRequest + { + /// There are four types of campaigns you can create in MailChimp. A/B Split campaigns have been deprecated and variate campaigns should be used instead. Possible Values: regular, plaintext, absplit, rss, variate + [JsonPropertyName("type")] + public MailchimpType? CampaignType { get; set; } + + /// recipients + [JsonPropertyName("recipients")] + public Recipient Recipients { get; set; } + + /// settings + [JsonPropertyName("settings")] + public Settings Settings { get; set; } + + /// variate_settings + [JsonPropertyName("variate_settings")] + public VariateSettings VariateSettings { get; set; } + + /// tracking + [JsonPropertyName("tracking")] + public Tracking Tracking { get; set; } + + /// rss_opts + [JsonPropertyName("rss_opts")] + public RSSOpts RssOpts { get; set; } + + /// social_card + [JsonPropertyName("social_card")] + public SocialCard SocialCard { get; set; } + } + + /// + /// NewListRequest + /// + public class NewListRequest + { + /// The name of the list + [JsonPropertyName("name")] + public string ListName { get; set; } + + /// contact + [JsonPropertyName("contact")] + public Contact Contact { get; set; } + + /// Text to remind people how they signed up to this list + [JsonPropertyName("permission_reminder")] + public string PermissionReminder { get; set; } + + /// Whether campaigns for this list use the Archive Bar in archives by default + [JsonPropertyName("use_archive_bar")] + public bool? UseArchiveBar { get; set; } + + /// campaign_defaults + [JsonPropertyName("campaign_defaults")] + public CampaignDefaults CampaignDefaults { get; set; } + + /// The email address to send subscribe notifications to + [JsonPropertyName("notify_on_subscribe")] + public string NotifyOnSubscribe { get; set; } + + /// The email address to send unsubscribe notifications to + [JsonPropertyName("notify_on_unsubscribe")] + public string NotifyOnUnsubscribe { get; set; } + + /// When set to true, subscribers can choose whether they want to receive HTML or plain-text emails. When set to false, subscribers will receive HTML emails, with a plain-text alternative backup + [JsonPropertyName("email_type_option")] + public bool? AllowUsersToChooseBetweenHTMLAndPlainTextTrueFalse { get; set; } + + /// Whether this list is public or private + [JsonPropertyName("visibility")] + public Visibility? Visibility { get; set; } + } + + /// + /// NewMembersInListRequest + /// + public class NewMembersInListRequest + { + /// An array of objects, each representing an email address and the subscription status for a specific list. Up to 500 members may be added or updated with each API call. + [JsonPropertyName("members")] + public List Members { get; set; } + + /// Whether this batch operation will change existing members' subscription status. + [JsonPropertyName("update_existing")] + public bool? UpdateExisting { get; set; } + } + + /// + /// Item in An array of objects, each representing an email address and the subscription status for a specific list. Up to 500 members may be added or updated with each API call. + /// + public class NewMemberInListRequest + { + /// Type of email this member asked to get (`html' or `text') + [JsonPropertyName("email_type")] + public EmailType? EmailType { get; set; } + + /// Subscriber's current status. Possible Values: subscribed, unsubscribed, cleaned, pending + [JsonPropertyName("status")] + public Status? Status { get; set; } + + /// merge_fields + [JsonPropertyName("merge_fields")] + public FirstAndLastName MergeFields { get; set; } + + /// If set/detected, the subscriber's language + [JsonPropertyName("language")] + public string Language { get; set; } + + /// VIP status for subscriber + [JsonPropertyName("vip")] + public bool? VIP { get; set; } + + /// location + [JsonPropertyName("location")] + public Location Location { get; set; } + + /// Email address for a subscriber + [JsonPropertyName("email_address")] + public string EmailAddress { get; set; } + } + + /// + /// UpdateMemberInListRequest + /// + public class UpdateMemberInListRequest + { + /// Type of email this member asked to get (`html' or `text') + [JsonPropertyName("email_type")] + public EmailType? EmailType { get; set; } + + /// Subscriber's current status. Possible Values: subscribed, unsubscribed, cleaned, pending + [JsonPropertyName("status")] + public Status? Status { get; set; } + + /// merge_fields + [JsonPropertyName("merge_fields")] + public FirstAndLastName MergeFields { get; set; } + + /// If set/detected, the subscriber's language + [JsonPropertyName("language")] + public string Language { get; set; } + + /// VIP status for subscriber + [JsonPropertyName("vip")] + public bool? VIP { get; set; } + + /// location + [JsonPropertyName("location")] + public Location Location { get; set; } + } + + /// + /// Extensible enum for known EmailType values. + /// + [JsonConverter(typeof(EmailType.EmailTypeJsonConverter))] + public readonly struct EmailType : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public EmailType(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// html + public static EmailType Html { get; } = new("html"); + + /// text + public static EmailType Text { get; } = new("text"); + + /// Converts a string to . + public static implicit operator EmailType(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(EmailType value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(EmailType other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is EmailType other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(EmailType left, EmailType right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(EmailType left, EmailType right) => !left.Equals(right); + + internal sealed class EmailTypeJsonConverter : JsonConverter + { + public EmailTypeJsonConverter() { } + public override EmailType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for EmailType, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, EmailType value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known Frequency values. + /// + [JsonConverter(typeof(Frequency.FrequencyJsonConverter))] + public readonly struct Frequency : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public Frequency(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// daily + public static Frequency Daily { get; } = new("daily"); + + /// weekly + public static Frequency Weekly { get; } = new("weekly"); + + /// monthly + public static Frequency Monthly { get; } = new("monthly"); + + /// Converts a string to . + public static implicit operator Frequency(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(Frequency value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(Frequency other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is Frequency other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(Frequency left, Frequency right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(Frequency left, Frequency right) => !left.Equals(right); + + internal sealed class FrequencyJsonConverter : JsonConverter + { + public FrequencyJsonConverter() { } + public override Frequency Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for Frequency, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, Frequency value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known Language values. + /// + [JsonConverter(typeof(Language.LanguageJsonConverter))] + public readonly struct Language : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public Language(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// en + public static Language En { get; } = new("en"); + + /// ar + public static Language Ar { get; } = new("ar"); + + /// af + public static Language Af { get; } = new("af"); + + /// be + public static Language Be { get; } = new("be"); + + /// bg + public static Language Bg { get; } = new("bg"); + + /// ca + public static Language Ca { get; } = new("ca"); + + /// zh + public static Language Zh { get; } = new("zh"); + + /// hr + public static Language Hr { get; } = new("hr"); + + /// cs + public static Language Cs { get; } = new("cs"); + + /// da + public static Language Da { get; } = new("da"); + + /// nl + public static Language Nl { get; } = new("nl"); + + /// et + public static Language Et { get; } = new("et"); + + /// fa + public static Language Fa { get; } = new("fa"); + + /// fi + public static Language Fi { get; } = new("fi"); + + /// fr + public static Language Fr { get; } = new("fr"); + + /// fr_CA + public static Language FrCA { get; } = new("fr_CA"); + + /// de + public static Language De { get; } = new("de"); + + /// el + public static Language El { get; } = new("el"); + + /// he + public static Language He { get; } = new("he"); + + /// hi + public static Language Hi { get; } = new("hi"); + + /// hu + public static Language Hu { get; } = new("hu"); + + /// is + public static Language Is { get; } = new("is"); + + /// id + public static Language Id { get; } = new("id"); + + /// ga + public static Language Ga { get; } = new("ga"); + + /// it + public static Language It { get; } = new("it"); + + /// ja + public static Language Ja { get; } = new("ja"); + + /// km + public static Language Km { get; } = new("km"); + + /// ko + public static Language Ko { get; } = new("ko"); + + /// lv + public static Language Lv { get; } = new("lv"); + + /// lt + public static Language Lt { get; } = new("lt"); + + /// mt + public static Language Mt { get; } = new("mt"); + + /// ms + public static Language Ms { get; } = new("ms"); + + /// mk + public static Language Mk { get; } = new("mk"); + + /// no + public static Language No { get; } = new("no"); + + /// pl + public static Language Pl { get; } = new("pl"); + + /// pt + public static Language Pt { get; } = new("pt"); + + /// pt_PT + public static Language PtPT { get; } = new("pt_PT"); + + /// ro + public static Language Ro { get; } = new("ro"); + + /// ru + public static Language Ru { get; } = new("ru"); + + /// sr + public static Language Sr { get; } = new("sr"); + + /// sk + public static Language Sk { get; } = new("sk"); + + /// sl + public static Language Sl { get; } = new("sl"); + + /// es + public static Language Es { get; } = new("es"); + + /// es_ES + public static Language EsES { get; } = new("es_ES"); + + /// sw + public static Language Sw { get; } = new("sw"); + + /// sv + public static Language Sv { get; } = new("sv"); + + /// ta + public static Language Ta { get; } = new("ta"); + + /// th + public static Language Th { get; } = new("th"); + + /// tr + public static Language Tr { get; } = new("tr"); + + /// uk + public static Language Uk { get; } = new("uk"); + + /// vi + public static Language Vi { get; } = new("vi"); + + /// Converts a string to . + public static implicit operator Language(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(Language value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(Language other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is Language other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(Language left, Language right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(Language left, Language right) => !left.Equals(right); + + internal sealed class LanguageJsonConverter : JsonConverter + { + public LanguageJsonConverter() { } + public override Language Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for Language, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, Language value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known MailchimpType values. + /// + [JsonConverter(typeof(MailchimpType.MailchimpTypeJsonConverter))] + public readonly struct MailchimpType : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public MailchimpType(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// regular + public static MailchimpType Regular { get; } = new("regular"); + + /// plaintext + public static MailchimpType Plaintext { get; } = new("plaintext"); + + /// absplit + public static MailchimpType Absplit { get; } = new("absplit"); + + /// rss + public static MailchimpType Rss { get; } = new("rss"); + + /// variate + public static MailchimpType Variate { get; } = new("variate"); + + /// Converts a string to . + public static implicit operator MailchimpType(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(MailchimpType value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(MailchimpType other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is MailchimpType other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(MailchimpType left, MailchimpType right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(MailchimpType left, MailchimpType right) => !left.Equals(right); + + internal sealed class MailchimpTypeJsonConverter : JsonConverter + { + public MailchimpTypeJsonConverter() { } + public override MailchimpType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for MailchimpType, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, MailchimpType value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known Status values. + /// + [JsonConverter(typeof(Status.StatusJsonConverter))] + public readonly struct Status : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public Status(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// subscribed + public static Status Subscribed { get; } = new("subscribed"); + + /// unsubscribed + public static Status Unsubscribed { get; } = new("unsubscribed"); + + /// cleaned + public static Status Cleaned { get; } = new("cleaned"); + + /// pending + public static Status Pending { get; } = new("pending"); + + /// Converts a string to . + public static implicit operator Status(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(Status value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(Status other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is Status other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(Status left, Status right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(Status left, Status right) => !left.Equals(right); + + internal sealed class StatusJsonConverter : JsonConverter + { + public StatusJsonConverter() { } + public override Status Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for Status, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, Status value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known Visibility values. + /// + [JsonConverter(typeof(Visibility.VisibilityJsonConverter))] + public readonly struct Visibility : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public Visibility(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// pub + public static Visibility Pub { get; } = new("pub"); + + /// prv + public static Visibility Prv { get; } = new("prv"); + + /// Converts a string to . + public static implicit operator Visibility(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(Visibility value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(Visibility other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is Visibility other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(Visibility left, Visibility right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(Visibility left, Visibility right) => !left.Equals(right); + + internal sealed class VisibilityJsonConverter : JsonConverter + { + public VisibilityJsonConverter() { } + public override Visibility Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for Visibility, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, Visibility value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known WeeklySendDay values. + /// + [JsonConverter(typeof(WeeklySendDay.WeeklySendDayJsonConverter))] + public readonly struct WeeklySendDay : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public WeeklySendDay(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// sunday + public static WeeklySendDay Sunday { get; } = new("sunday"); + + /// monday + public static WeeklySendDay Monday { get; } = new("monday"); + + /// tuesday + public static WeeklySendDay Tuesday { get; } = new("tuesday"); + + /// wednesday + public static WeeklySendDay Wednesday { get; } = new("wednesday"); + + /// thursday + public static WeeklySendDay Thursday { get; } = new("thursday"); + + /// friday + public static WeeklySendDay Friday { get; } = new("friday"); + + /// saturday + public static WeeklySendDay Saturday { get; } = new("saturday"); + + /// Converts a string to . + public static implicit operator WeeklySendDay(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(WeeklySendDay value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(WeeklySendDay other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is WeeklySendDay other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(WeeklySendDay left, WeeklySendDay right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(WeeklySendDay left, WeeklySendDay right) => !left.Equals(right); + + internal sealed class WeeklySendDayJsonConverter : JsonConverter + { + public WeeklySendDayJsonConverter() { } + public override WeeklySendDay Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for WeeklySendDay, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, WeeklySendDay value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of MailChimp models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class MailChimpModelFactory + { + /// + /// Creates a new instance of . + /// + public static GetCampaignsResponse GetCampaignsResponse( + List campaigns = default) + { + return new GetCampaignsResponse + { + Campaigns = campaigns, + }; + } + + /// + /// Creates a new instance of . + /// + public static CampaignResponseModel CampaignResponseModel( + string campaignId = default, + MailchimpType? campaignType = default, + string createdTime = default, + string archiveURL = default, + string status = default, + int? emailsSent = default, + string sendTime = default, + string contentType = default, + List list = default, + Settings settings = default, + VariateSettings variateSettings = default, + Tracking tracking = default, + RSSOpts rssOpts = default, + ABSplitOpts abSplitOpts = default, + SocialCard socialCard = default, + ReportSummary reportSummary = default, + DeliveryStatus deliveryStatus = default, + List links = default) + { + return new CampaignResponseModel + { + CampaignId = campaignId, + CampaignType = campaignType, + CreatedTime = createdTime, + ArchiveURL = archiveURL, + Status = status, + EmailsSent = emailsSent, + SendTime = sendTime, + ContentType = contentType, + List = list, + Settings = settings, + VariateSettings = variateSettings, + Tracking = tracking, + RssOpts = rssOpts, + AbSplitOpts = abSplitOpts, + SocialCard = socialCard, + ReportSummary = reportSummary, + DeliveryStatus = deliveryStatus, + Links = links, + }; + } + + /// + /// Creates a new instance of . + /// + public static Recipient Recipient( + string listId = default, + SegmentOpts segmentOpts = default) + { + return new Recipient + { + ListId = listId, + SegmentOpts = segmentOpts, + }; + } + + /// + /// Creates a new instance of . + /// + public static SegmentOpts SegmentOpts( + int? savedSegmentId = default, + string matchType = default) + { + return new SegmentOpts + { + SavedSegmentId = savedSegmentId, + MatchType = matchType, + }; + } + + /// + /// Creates a new instance of . + /// + public static Settings Settings( + string campaignSubjectLine = default, + string title = default, + string fromName = default, + string replyToAddress = default, + bool? conversation = default, + string toName = default, + string folderId = default, + bool? authentication = default, + bool? autoFooter = default, + bool? inlineCSS = default, + bool? autoTweet = default, + List autoPostToFacebook = default, + bool? facebookComments = default) + { + return new Settings + { + CampaignSubjectLine = campaignSubjectLine, + Title = title, + FromName = fromName, + ReplyToAddress = replyToAddress, + Conversation = conversation, + ToName = toName, + FolderId = folderId, + Authentication = authentication, + AutoFooter = autoFooter, + InlineCSS = inlineCSS, + AutoTweet = autoTweet, + AutoPostToFacebook = autoPostToFacebook, + FacebookComments = facebookComments, + }; + } + + /// + /// Creates a new instance of . + /// + public static VariateSettings VariateSettings( + string winningCriteria = default, + int? waitTime = default, + int? testSize = default, + List subjectLines = default, + List sendTimes = default, + List fromNames = default, + List replyToAddresses = default) + { + return new VariateSettings + { + WinningCriteria = winningCriteria, + WaitTime = waitTime, + TestSize = testSize, + SubjectLines = subjectLines, + SendTimes = sendTimes, + FromNames = fromNames, + ReplyToAddresses = replyToAddresses, + }; + } + + /// + /// Creates a new instance of . + /// + public static Tracking Tracking( + bool? opens = default, + bool? htmlClickTracking = default, + bool? plainTextClickTracking = default, + bool? mailChimpGoalTracking = default, + bool? eCommerce360Tracking = default, + string googleAnalyticsTracking = default, + string clickTaleAnalyticsTracking = default, + Salesforce salesforce = default, + Highrise highrise = default, + Capsule capsule = default) + { + return new Tracking + { + Opens = opens, + HTMLClickTracking = htmlClickTracking, + PlainTextClickTracking = plainTextClickTracking, + MailChimpGoalTracking = mailChimpGoalTracking, + ECommerce360Tracking = eCommerce360Tracking, + GoogleAnalyticsTracking = googleAnalyticsTracking, + ClickTaleAnalyticsTracking = clickTaleAnalyticsTracking, + Salesforce = salesforce, + Highrise = highrise, + Capsule = capsule, + }; + } + + /// + /// Creates a new instance of . + /// + public static Salesforce Salesforce( + bool? salesforceCampaign = default, + bool? salesforceNote = default) + { + return new Salesforce + { + SalesforceCampaign = salesforceCampaign, + SalesforceNote = salesforceNote, + }; + } + + /// + /// Creates a new instance of . + /// + public static Highrise Highrise( + bool? highriseCampaign = default, + bool? highriseNote = default) + { + return new Highrise + { + HighriseCampaign = highriseCampaign, + HighriseNote = highriseNote, + }; + } + + /// + /// Creates a new instance of . + /// + public static Capsule Capsule( + bool? capsuleNote = default) + { + return new Capsule + { + CapsuleNote = capsuleNote, + }; + } + + /// + /// Creates a new instance of . + /// + public static RSSOpts RSSOpts( + string feedURL = default, + Frequency? frequency = default, + string constrainRSSImages = default, + Schedule schedule = default) + { + return new RSSOpts + { + FeedURL = feedURL, + Frequency = frequency, + ConstrainRSSImages = constrainRSSImages, + Schedule = schedule, + }; + } + + /// + /// Creates a new instance of . + /// + public static Schedule Schedule( + int? sendingHour = default, + DailySend dailySend = default, + WeeklySendDay? weeklySendingDay = default, + float? monthlySendingDay = default) + { + return new Schedule + { + SendingHour = sendingHour, + DailySend = dailySend, + WeeklySendingDay = weeklySendingDay, + MonthlySendingDay = monthlySendingDay, + }; + } + + /// + /// Creates a new instance of . + /// + public static DailySend DailySend( + bool? sunday = default, + bool? monday = default, + bool? tuesday = default, + bool? wednesday = default, + bool? thursday = default, + bool? friday = default, + bool? saturday = default) + { + return new DailySend + { + Sunday = sunday, + Monday = monday, + Tuesday = tuesday, + Wednesday = wednesday, + Thursday = thursday, + Friday = friday, + Saturday = saturday, + }; + } + + /// + /// Creates a new instance of . + /// + public static ABSplitOpts ABSplitOpts( + string splitTest = default, + string pickWinner = default, + string waitTime = default, + int? splitSize = default, + string fromNameGroupA = default, + string fromNameGroupB = default, + string replyEmailGroupA = default, + string replyEmailGroupB = default, + string subjectLineGroupA = default, + string subjectLineGroupB = default, + string sendTimeGroupA = default, + string sendTimeGroupB = default, + string sendTimeWinner = default) + { + return new ABSplitOpts + { + SplitTest = splitTest, + PickWinner = pickWinner, + WaitTime = waitTime, + SplitSize = splitSize, + FromNameGroupA = fromNameGroupA, + FromNameGroupB = fromNameGroupB, + ReplyEmailGroupA = replyEmailGroupA, + ReplyEmailGroupB = replyEmailGroupB, + SubjectLineGroupA = subjectLineGroupA, + SubjectLineGroupB = subjectLineGroupB, + SendTimeGroupA = sendTimeGroupA, + SendTimeGroupB = sendTimeGroupB, + SendTimeWinner = sendTimeWinner, + }; + } + + /// + /// Creates a new instance of . + /// + public static SocialCard SocialCard( + string imageURL = default, + string campaignDescription = default, + string title = default) + { + return new SocialCard + { + ImageURL = imageURL, + CampaignDescription = campaignDescription, + Title = title, + }; + } + + /// + /// Creates a new instance of . + /// + public static ReportSummary ReportSummary( + int? automationOpens = default, + int? uniqueOpens = default, + float? openRate = default, + int? totalClicks = default, + float? uniqueSubscriberClicks = default, + float? clickRate = default) + { + return new ReportSummary + { + AutomationOpens = automationOpens, + UniqueOpens = uniqueOpens, + OpenRate = openRate, + TotalClicks = totalClicks, + UniqueSubscriberClicks = uniqueSubscriberClicks, + ClickRate = clickRate, + }; + } + + /// + /// Creates a new instance of . + /// + public static DeliveryStatus DeliveryStatus( + bool? deliveryStautEnabled = default, + bool? campaignCancelable = default, + string campaignDeliveryStatus = default, + int? emailsSent = default, + int? emailsCanceled = default) + { + return new DeliveryStatus + { + DeliveryStautEnabled = deliveryStautEnabled, + CampaignCancelable = campaignCancelable, + CampaignDeliveryStatus = campaignDeliveryStatus, + EmailsSent = emailsSent, + EmailsCanceled = emailsCanceled, + }; + } + + /// + /// Creates a new instance of . + /// + public static Link Link( + string rel = default, + string href = default, + string method = default, + string targetSchema = default, + string schema = default) + { + return new Link + { + Rel = rel, + Href = href, + Method = method, + TargetSchema = targetSchema, + Schema = schema, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetListsResponseModel GetListsResponseModel( + List lists = default, + int? itemCount = default) + { + return new GetListsResponseModel + { + Lists = lists, + ItemCount = itemCount, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateNewListResponseModel CreateNewListResponseModel( + string listId = default, + string listName = default, + Contact contact = default, + string permissionReminder = default, + bool? useArchiveBar = default, + CampaignDefaults campaignDefaults = default, + string notifyOnSubscribe = default, + string notifyOnUnsubscribe = default, + string creationDate = default, + int? listRating = default, + bool? emailTypeOption = default, + string subscribeURLShort = default, + string subscribeURLLong = default, + string beamerAddress = default, + string visibility = default, + List modules = default, + Stats stats = default, + List links = default) + { + return new CreateNewListResponseModel + { + ListId = listId, + ListName = listName, + Contact = contact, + PermissionReminder = permissionReminder, + UseArchiveBar = useArchiveBar, + CampaignDefaults = campaignDefaults, + NotifyOnSubscribe = notifyOnSubscribe, + NotifyOnUnsubscribe = notifyOnUnsubscribe, + CreationDate = creationDate, + ListRating = listRating, + EmailTypeOption = emailTypeOption, + SubscribeURLShort = subscribeURLShort, + SubscribeURLLong = subscribeURLLong, + BeamerAddress = beamerAddress, + Visibility = visibility, + Modules = modules, + Stats = stats, + Links = links, + }; + } + + /// + /// Creates a new instance of . + /// + public static Contact Contact( + string companyName = default, + string addressLine1 = default, + string addressLine2 = default, + string city = default, + string state = default, + string postalCode = default, + string countryCode = default, + string phoneNumber = default) + { + return new Contact + { + CompanyName = companyName, + AddressLine1 = addressLine1, + AddressLine2 = addressLine2, + City = city, + State = state, + PostalCode = postalCode, + CountryCode = countryCode, + PhoneNumber = phoneNumber, + }; + } + + /// + /// Creates a new instance of . + /// + public static CampaignDefaults CampaignDefaults( + string senderSName = default, + string senderSEmailAddress = default, + string subject = default, + Language? language = default) + { + return new CampaignDefaults + { + SenderSName = senderSName, + SenderSEmailAddress = senderSEmailAddress, + Subject = subject, + Language = language, + }; + } + + /// + /// Creates a new instance of . + /// + public static Stats Stats( + int? memberCount = default, + int? unsubscribeCount = default, + int? cleanedCount = default, + int? memberCountSinceSend = default, + int? unsubscribeCountSinceSend = default, + int? cleanedCountSinceSend = default, + int? campaignCount = default, + DateTime? campaignLastSent = default, + int? mergeVarCount = default, + float? averageSubscriptionRate = default, + float? averageUnsubscriptionRate = default, + float? targetSubscriptionRate = default, + float? openRate = default, + float? clickRate = default, + string dateOfLastListSubscribe = default, + string dateOfLastListUnsubscribe = default) + { + return new Stats + { + MemberCount = memberCount, + UnsubscribeCount = unsubscribeCount, + CleanedCount = cleanedCount, + MemberCountSinceSend = memberCountSinceSend, + UnsubscribeCountSinceSend = unsubscribeCountSinceSend, + CleanedCountSinceSend = cleanedCountSinceSend, + CampaignCount = campaignCount, + CampaignLastSent = campaignLastSent, + MergeVarCount = mergeVarCount, + AverageSubscriptionRate = averageSubscriptionRate, + AverageUnsubscriptionRate = averageUnsubscriptionRate, + TargetSubscriptionRate = targetSubscriptionRate, + OpenRate = openRate, + ClickRate = clickRate, + DateOfLastListSubscribe = dateOfLastListSubscribe, + DateOfLastListUnsubscribe = dateOfLastListUnsubscribe, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetAddMembersBatchResponseModel GetAddMembersBatchResponseModel( + int? totalCreated = default, + int? totalUpdated = default, + int? errorCount = default) + { + return new GetAddMembersBatchResponseModel + { + TotalCreated = totalCreated, + TotalUpdated = totalUpdated, + ErrorCount = errorCount, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetAllMembersResponseModel GetAllMembersResponseModel( + List members = default, + string listId = default, + int? totalItems = default) + { + return new GetAllMembersResponseModel + { + Members = members, + ListId = listId, + TotalItems = totalItems, + }; + } + + /// + /// Creates a new instance of . + /// + public static MemberResponseModel MemberResponseModel( + string emailId = default, + string emailAddress = default, + string uniqueEmailId = default, + string emailType = default, + string status = default, + FirstAndLastName mergeFields = default, + Stats stats = default, + string signupIP = default, + string signupTimestamp = default, + string optInIP = default, + string optInTimestamp = default, + int? memberRating = default, + string lastChangedDate = default, + string language = default, + bool? vip = default, + string emailClient = default, + Location location = default, + LastNote lastNote = default, + string listId = default, + List links = default) + { + return new MemberResponseModel + { + EmailId = emailId, + EmailAddress = emailAddress, + UniqueEmailId = uniqueEmailId, + EmailType = emailType, + Status = status, + MergeFields = mergeFields, + Stats = stats, + SignupIP = signupIP, + SignupTimestamp = signupTimestamp, + OptInIP = optInIP, + OptInTimestamp = optInTimestamp, + MemberRating = memberRating, + LastChangedDate = lastChangedDate, + Language = language, + VIP = vip, + EmailClient = emailClient, + Location = location, + LastNote = lastNote, + ListId = listId, + Links = links, + }; + } + + /// + /// Creates a new instance of . + /// + public static FirstAndLastName FirstAndLastName( + string firstName = default, + string lastName = default) + { + return new FirstAndLastName + { + FirstName = firstName, + LastName = lastName, + }; + } + + /// + /// Creates a new instance of . + /// + public static Location Location( + float? latitude = default, + float? longitude = default) + { + return new Location + { + Latitude = latitude, + Longitude = longitude, + }; + } + + /// + /// Creates a new instance of . + /// + public static LastNote LastNote( + int? noteId = default, + string createdTime = default, + string author = default, + string note = default) + { + return new LastNote + { + NoteId = noteId, + CreatedTime = createdTime, + Author = author, + Note = note, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetMembersResponseModel GetMembersResponseModel( + List members = default, + string listId = default, + int? itemCount = default) + { + return new GetMembersResponseModel + { + Members = members, + ListId = listId, + ItemCount = itemCount, + }; + } + + /// + /// Creates a new instance of . + /// + public static AddUserResponseModel AddUserResponseModel( + string emailId = default, + string emailAddress = default, + string uniqueEmailId = default, + string emailType = default, + string status = default, + FirstAndLastName mergeFields = default, + Stats stats = default, + string signupIP = default, + string signupTimestamp = default, + string optInIP = default, + string optInTimestamp = default, + int? memberRating = default, + string lastChangedDate = default, + string language = default, + bool? vip = default, + string emailClient = default, + Location location = default, + LastNote lastNote = default, + string listId = default, + List links = default) + { + return new AddUserResponseModel + { + EmailId = emailId, + EmailAddress = emailAddress, + UniqueEmailId = uniqueEmailId, + EmailType = emailType, + Status = status, + MergeFields = mergeFields, + Stats = stats, + SignupIP = signupIP, + SignupTimestamp = signupTimestamp, + OptInIP = optInIP, + OptInTimestamp = optInTimestamp, + MemberRating = memberRating, + LastChangedDate = lastChangedDate, + Language = language, + VIP = vip, + EmailClient = emailClient, + Location = location, + LastNote = lastNote, + ListId = listId, + Links = links, + }; + } + + /// + /// Creates a new instance of . + /// + public static NewCampaignRequest NewCampaignRequest( + MailchimpType? campaignType = default, + Recipient recipients = default, + Settings settings = default, + VariateSettings variateSettings = default, + Tracking tracking = default, + RSSOpts rssOpts = default, + SocialCard socialCard = default) + { + return new NewCampaignRequest + { + CampaignType = campaignType, + Recipients = recipients, + Settings = settings, + VariateSettings = variateSettings, + Tracking = tracking, + RssOpts = rssOpts, + SocialCard = socialCard, + }; + } + + /// + /// Creates a new instance of . + /// + public static NewListRequest NewListRequest( + string listName = default, + Contact contact = default, + string permissionReminder = default, + bool? useArchiveBar = default, + CampaignDefaults campaignDefaults = default, + string notifyOnSubscribe = default, + string notifyOnUnsubscribe = default, + bool? allowUsersToChooseBetweenHTMLAndPlainTextTrueFalse = default, + Visibility? visibility = default) + { + return new NewListRequest + { + ListName = listName, + Contact = contact, + PermissionReminder = permissionReminder, + UseArchiveBar = useArchiveBar, + CampaignDefaults = campaignDefaults, + NotifyOnSubscribe = notifyOnSubscribe, + NotifyOnUnsubscribe = notifyOnUnsubscribe, + AllowUsersToChooseBetweenHTMLAndPlainTextTrueFalse = allowUsersToChooseBetweenHTMLAndPlainTextTrueFalse, + Visibility = visibility, + }; + } + + /// + /// Creates a new instance of . + /// + public static NewMembersInListRequest NewMembersInListRequest( + List members = default, + bool? updateExisting = default) + { + return new NewMembersInListRequest + { + Members = members, + UpdateExisting = updateExisting, + }; + } + + /// + /// Creates a new instance of . + /// + public static NewMemberInListRequest NewMemberInListRequest( + EmailType? emailType = default, + Status? status = default, + FirstAndLastName mergeFields = default, + string language = default, + bool? vip = default, + Location location = default, + string emailAddress = default) + { + return new NewMemberInListRequest + { + EmailType = emailType, + Status = status, + MergeFields = mergeFields, + Language = language, + VIP = vip, + Location = location, + EmailAddress = emailAddress, + }; + } + + /// + /// Creates a new instance of . + /// + public static UpdateMemberInListRequest UpdateMemberInListRequest( + EmailType? emailType = default, + Status? status = default, + FirstAndLastName mergeFields = default, + string language = default, + bool? vip = default, + Location location = default) + { + return new UpdateMemberInListRequest + { + EmailType = emailType, + Status = status, + MergeFields = mergeFields, + Language = language, + VIP = vip, + Location = location, + }; + } + } + + #endregion Model Factory + +} + +namespace Azure.Connectors.Sdk.MailChimp +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the MailChimp connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class MailChimpTriggerOperations + { + /// + /// When a Member has been added to a list. + /// + public const string OnMemberSubscribed = "OnMemberSubscribed"; + + /// + /// When a new list is created. + /// + public const string OnCreateList = "OnCreateList"; + + } + + #endregion Trigger Operation Constants + + #region Client + + /// + /// Typed client for mailchimp connector. + /// + public class MailChimpClient : ConnectorClientBase + { + /// + /// Creates a new MailChimpClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public MailChimpClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new MailChimpClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public MailChimpClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new MailChimpClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public MailChimpClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new MailChimpClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public MailChimpClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected MailChimpClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "mailchimp"; + + /// + /// List campaigns + /// + /// This operation retrieves a list of campaigns in an account + /// Cancellation token. + /// The List campaigns response. + public virtual async Task GetCampaignsAsync(CancellationToken cancellationToken = default) + { + var path = $"/campaigns"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Send Campaign + /// + /// Send an existing campaign + /// Campaign + /// Cancellation token. + public virtual async Task SendcampaignAsync([DynamicValues("GetCampaigns")] string campaign, CancellationToken cancellationToken = default) + { + var path = $"/campaigns/{Uri.EscapeDataString(campaign.ToString())}/actions/send"; + await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get all the lists + /// + /// Find all the lists for the current user + /// Maximum Results + /// Offset + /// Cancellation token. + /// The Get all the lists response. + public virtual async Task GetListsAsync(int? maximumResults = default, int? offset = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (maximumResults.HasValue) + queryParams.Add($"count={Uri.EscapeDataString(maximumResults.Value.ToString())}"); + if (offset.HasValue) + queryParams.Add($"offset={Uri.EscapeDataString(offset.Value.ToString())}"); + var path = $"/lists" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// New List + /// + /// Create a new list in your MailChimp account + /// The request body. + /// Cancellation token. + /// The New List response. + public virtual async Task NewlistAsync(NewListRequest input, CancellationToken cancellationToken = default) + { + var path = $"/lists"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Subscribe or unsubscribe list members + /// + /// Batch subscribe or unsubscribe list members. + /// List Id + /// The request body. + /// Skip Merge Validation + /// Skip Duplicate Check + /// Cancellation token. + /// The Subscribe or unsubscribe list members response. + public virtual async Task AddMembersAsync([DynamicValues("GetLists")] string listId, NewMembersInListRequest input, bool? skipMergeValidation = default, bool? skipDuplicateCheck = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (skipMergeValidation.HasValue) + queryParams.Add($"skip_merge_validation={Uri.EscapeDataString(skipMergeValidation.Value.ToString())}"); + if (skipDuplicateCheck.HasValue) + queryParams.Add($"skip_duplicate_check={Uri.EscapeDataString(skipDuplicateCheck.Value.ToString())}"); + var path = $"/lists/{Uri.EscapeDataString(listId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Show list members + /// + /// Show all the members of a list + /// List Id + /// Maximum Results + /// Offset + /// Cancellation token. + /// The Show list members response. + public virtual async Task GetListMembersAsync([DynamicValues("GetLists")] string listId, int? maximumResults = default, int? offset = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (maximumResults.HasValue) + queryParams.Add($"count={Uri.EscapeDataString(maximumResults.Value.ToString())}"); + if (offset.HasValue) + queryParams.Add($"offset={Uri.EscapeDataString(offset.Value.ToString())}"); + var path = $"/lists/{Uri.EscapeDataString(listId.ToString())}/members" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add member to list + /// + /// Add or update a list member + /// List Id + /// The request body. + /// Cancellation token. + /// The Add member to list response. + public virtual async Task AddmemberAsync([DynamicValues("GetLists")] string listId, NewMemberInListRequest input, CancellationToken cancellationToken = default) + { + var path = $"/lists/{Uri.EscapeDataString(listId.ToString())}/members"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// New Campaign (V2) + /// + /// Create a new campaign based on a Campaign Type, Recipients list and Campaign Settings (subject line, title, from_name and reply_to) (V2). + /// The request body. + /// Cancellation token. + /// The New Campaign (V2) response. + public virtual async Task NewcampaignAsync(NewCampaignRequest input, CancellationToken cancellationToken = default) + { + var path = $"/v2/campaigns"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Remove Member from list + /// + /// Delete a member from a list. + /// List Id + /// Cancellation token. + public virtual async Task RemovememberAsync([DynamicValues("GetLists")] string listId, CancellationToken cancellationToken = default) + { + var path = $"/lists/replacemailwithhash/{Uri.EscapeDataString(listId.ToString())}/members"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update member information + /// + /// Update information for a specific list member. + /// List Id + /// The request body. + /// Cancellation token. + /// The Update member information response. + public virtual async Task UpdatememberAsync([DynamicValues("GetLists")] string listId, UpdateMemberInListRequest input, CancellationToken cancellationToken = default) + { + var path = $"/lists/replacemailwithhash/{Uri.EscapeDataString(listId.ToString())}/members"; + return await this + .CallConnectorAsync(HttpMethod.Patch, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/ManagedConnectors.cs b/src/Azure.Connectors.Sdk/Generated/ManagedConnectors.cs index 98b01af..c7c331d 100644 --- a/src/Azure.Connectors.Sdk/Generated/ManagedConnectors.cs +++ b/src/Azure.Connectors.Sdk/Generated/ManagedConnectors.cs @@ -201,33 +201,47 @@ public static class SdkConnectors "azurequeues", "azuretables", "azurevm", + "box", "campfire", "clicksendsms", "cloudmersiveconvert", "documentdb", + "docusign", "docuware", + "dropbox", + "dynamicsax", "elfsquaddata", "etsy", + "eventbrite", "eventhubs", "excelonline", "excelonlinebusiness", "formstackforms", "freshservice", + "ftp", + "github", + "googlecalendar", + "googledrive", + "googletasks", "impexium", "infusionsoft", "insightly", "jedoxodatahub", - "kusto", + "jira", "keyvault", + "kusto", + "mailchimp", "meetingroommap", "microsoftbookings", "microsoftforms", + "monday", "mq", "msgraphgroupsanduser", "office365", "office365groups", "office365groupsmail", "office365users", + "onedrive", "onedriveforbusiness", "onenote", "orderful", @@ -241,24 +255,35 @@ public static class SdkConnectors "projectplace", "replicon", "revai", + "rss", + "salesforce", "seismicplanner", + "sendgrid", "servicebus", "sharepointonline", "shifts", "signinghub", + "slack", "smtp", + "sql", "starmind", "starrezrestv1", "tallyfy", "teams", - "todo", "textrequest", "ticketmaster", + "todo", + "trello", + "twitter", + "typeform", "universalprint", "waywedo", "wdatp", + "webex", "wordonlinebusiness", + "wordpress", "yammer", + "zendesk", "zohosign", ]; } diff --git a/src/Azure.Connectors.Sdk/Generated/MondayExtensions.cs b/src/Azure.Connectors.Sdk/Generated/MondayExtensions.cs new file mode 100644 index 0000000..2bc9325 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/MondayExtensions.cs @@ -0,0 +1,2291 @@ +// MondayExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Monday.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Monday.Models +{ + + #region Types + + /// + /// When an item is created + /// + public class WebhookCreateItemInput + { + /// Select a workspace from the drop-down or specify a workspace ID. + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Select a board from the drop-down or specify a board ID. + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Specify the callback URL + [JsonPropertyName("callbackUrl")] + public string CallbackUrl { get; set; } + } + + /// + /// Response for When an item is created + /// + public class WebhookCreateItemResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// When a new update is posted + /// + public class WebhookCreateUpdateInput + { + /// Select a workspace from the drop-down or specify a workspace ID. + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Select a board from the drop-down or specify a board ID. + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Specify the callback URL. + [JsonPropertyName("callbackUrl")] + public string CallbackUrl { get; set; } + } + + /// + /// Response for When a new update is posted + /// + public class WebhookCreateUpdateResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// When an item's name changes + /// + public class WebhookChangeNameInput + { + /// Select a workspace from the drop-down or specify a workspace ID. + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Select a board from the drop-down or specify a board ID. + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Specify the callback URL. + [JsonPropertyName("callbackUrl")] + public string CallbackUrl { get; set; } + } + + /// + /// Response for When an item's name changes + /// + public class WebhookChangeNameResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// When a subitem's name changes + /// + public class WebhookChangeSubitemNameInput + { + /// Select a workspace from the drop-down or specify a workspace ID. + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Select a board from the drop-down or specify a board ID. + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Specify the callback URL. + [JsonPropertyName("callbackUrl")] + public string CallbackUrl { get; set; } + } + + /// + /// Response for When a subitem's name changes + /// + public class WebhookChangeSubitemNameResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// When a subitem is created + /// + public class WebhookCreateSubitemInput + { + /// Select a workspace from the drop-down or specify a workspace ID. + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Select a board from the drop-down or specify a board ID. + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Specify the callback URL. + [JsonPropertyName("callbackUrl")] + public string CallbackUrl { get; set; } + } + + /// + /// Response for When a subitem is created + /// + public class WebhookCreateSubitemResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// When a column changes + /// + public class WebhookColumnChangesInput + { + /// Select a workspace from the drop-down or specify a workspace ID. + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Select a board from the drop-down or specify a board ID. + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Select a column from the drop-down. + [JsonPropertyName("columnId")] + public string ColumnId { get; set; } + + /// Specify the callback URL. + [JsonPropertyName("callbackUrl")] + public string CallbackUrl { get; set; } + } + + /// + /// Response for When a column changes + /// + public class WebhookColumnChangesResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// When any column changes + /// + public class WebhookAnyColumnChangesInput + { + /// Select a workspace from the drop-down or specify a workspace ID. + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Select a board from the drop-down or specify a board ID. + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Specify the callback URL. + [JsonPropertyName("callbackUrl")] + public string CallbackUrl { get; set; } + } + + /// + /// Response for When any column changes + /// + public class WebhookAnyColumnChangesResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// When any subitem column changes + /// + public class WebhookSubitemColumnChangesInput + { + /// Select a workspace from the drop-down or specify a workspace ID. + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Select a board from the drop-down or specify a board ID. + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Specify the callback URL. + [JsonPropertyName("callbackUrl")] + public string CallbackUrl { get; set; } + } + + /// + /// Response for When any subitem column changes + /// + public class WebhookSubitemColumnChangesResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get column names for a board ID + /// + public class GetColumnNamesSchemaResponse + { + /// Schema of the requested schema type + [JsonPropertyName("schema")] + public object Schema { get; set; } + } + + /// + /// Response for Gets single column schema for a board ID + /// + public class GetSingleColumnSchemaResponse + { + /// Schema of the requested schema type + [JsonPropertyName("schema")] + public object Schema { get; set; } + } + + /// + /// Response for Get column names for a board ID for a webhook + /// + public class GetColumnNamesSchemaForWebhookResponse + { + /// Schema of the requested schema type + [JsonPropertyName("schema")] + public object Schema { get; set; } + } + + /// + /// Response for Get column names for a board ID for a webhook + /// + public class GetSchemaForGetItemsActionResponse + { + /// Schema of the requested schema type + [JsonPropertyName("schema")] + public object Schema { get; set; } + } + + /// + /// Response for Get column names for a board ID for an update webhook + /// + public class GetColumnNamesSchemaForUpdateWebhookResponse + { + /// Schema of the requested schema type + [JsonPropertyName("schema")] + public object Schema { get; set; } + } + + /// + /// Create an item + /// + public class CreateItemInput + { + /// workspaceId + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// boardId + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Select a group from the drop-down or specify a group ID. + [JsonPropertyName("groupId")] + public string GroupId { get; set; } + + /// Specify the name of the item you want to create. + [JsonPropertyName("itemName")] + public string ItemName { get; set; } + + /// columnValues + [JsonPropertyName("columnValues")] + public DynamicResponseGetListSchema ColumnValues { get; set; } + } + + /// + /// columnValues + /// + [DynamicSchema("GetColumnNamesSchema")] + public class DynamicResponseGetListSchema + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Create an item + /// + public class CreateItemResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Duplicate a board + /// + public class DuplicateBoardInput + { + /// Select the workspace for the board you want to duplicate. + [JsonPropertyName("sourceWorkspaceId")] + public string SourceWorkspaceId { get; set; } + + /// Select the board to duplicate. + [JsonPropertyName("sourceBoardId")] + public string SourceBoardId { get; set; } + + /// Specify the name of the duplicated board. + [JsonPropertyName("duplicatedBoardName")] + public string DuplicatedBoardName { get; set; } + + /// Select the duplication type from the drop-down. + [JsonPropertyName("duplicationType")] + public DuplicationType? DuplicationType { get; set; } + + /// Select the destination workspace for the duplicated board. + [JsonPropertyName("destinationWorkspaceId")] + public string DestinationWorkspaceId { get; set; } + + /// Select the destination folder for the duplicated board. + [JsonPropertyName("destinationFolder")] + public string DestinationFolder { get; set; } + + /// Select whether to keep board subscribers. + [JsonPropertyName("keepBoardSubscribers")] + public bool? KeepBoardSubscribers { get; set; } + } + + /// + /// Response for Duplicate a board + /// + public class DuplicateBoardResponse + { + /// The ID of the duplicated board + [JsonPropertyName("id")] + public string Id { get; set; } + } + + /// + /// Create a board + /// + public class CreateBoardInput + { + /// Specify the ID of a monday.com workspace. + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Specify the desired name of the board you want to create. + [JsonPropertyName("boardName")] + public string BoardName { get; set; } + } + + /// + /// Response for Create a board + /// + public class CreateBoardResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Create a column + /// + public class CreateColumnInput + { + /// workspaceId + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// boardId + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Specify the title of the column you want to create. + [JsonPropertyName("title")] + public string Title { get; set; } + + /// Specify the description of the column you want to create. + [JsonPropertyName("description")] + public string Description { get; set; } + + /// Select a column type from the drop-down. + [JsonPropertyName("columnType")] + public ColumnType? ColumnType { get; set; } + } + + /// + /// Response for Create a column + /// + public class CreateColumnResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Create a group + /// + public class CreateGroupInput + { + /// workspaceId + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// boardId + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Specify your desired group name. + [JsonPropertyName("groupName")] + public string GroupName { get; set; } + } + + /// + /// Response for Create a group + /// + public class CreateGroupResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Update an item's column value + /// + public class UpdateItemColumnInput + { + /// Select the workspace the item belongs to from the drop-down. + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Select the board the item belongs to from the drop-down. + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// columnId + [JsonPropertyName("columnId")] + public string ColumnId { get; set; } + + /// Specify the ID of the item to update. + [JsonPropertyName("itemId")] + public string ItemId { get; set; } + + /// columnValues + [JsonPropertyName("columnValues")] + public DynamicResponseGetSingleColumnSchema ColumnValues { get; set; } + } + + /// + /// columnValues + /// + [DynamicSchema("GetSingleColumnSchema")] + public class DynamicResponseGetSingleColumnSchema + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Update an item's column value + /// + public class UpdateItemColumnResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Update multiple item column values + /// + public class UpdateMultipleItemColumnsInput + { + /// Select the workspace the item belongs to from the drop-down. + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Select the board the item belongs to from the drop-down. + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Specify the ID of the item to update. + [JsonPropertyName("itemId")] + public string ItemId { get; set; } + + /// Specify a new name for the item. Leave blank to keep the current name. + [JsonPropertyName("itemName")] + public string ItemName { get; set; } + + /// columnValues + [JsonPropertyName("columnValues")] + public DynamicResponseGetListSchema ColumnValues { get; set; } + } + + /// + /// Response for Update multiple item column values + /// + public class UpdateMultipleItemColumnsResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Move an item to a group + /// + public class MoveItemToGroupInput + { + /// workspaceId + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// boardId + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Select the group to move the item to from the drop-down. + [JsonPropertyName("groupId")] + public string GroupId { get; set; } + + /// Specify the ID of the item to move. + [JsonPropertyName("itemId")] + public string ItemId { get; set; } + } + + /// + /// Response for Move an item to a group + /// + public class MoveItemToGroupResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Create a notification + /// + public class CreateNotificationInput + { + /// Select a user from the drop-down or specify a user ID. + [JsonPropertyName("userId")] + public string UserId { get; set; } + + /// Specify a board ID or item ID the notification will go to. + [JsonPropertyName("targetId")] + public string TargetId { get; set; } + + /// Specify the notification text. + [JsonPropertyName("text")] + public string Text { get; set; } + } + + /// + /// Response for Create a notification + /// + public class CreateNotificationResponse + { + /// Data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Create a subitem + /// + public class CreateSubitemInput + { + /// workspaceId + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// Select a board from the drop-down or specify a board ID. + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Select a parent item from the drop-down or specify a parent item ID. + [JsonPropertyName("parentItemId")] + public string ParentItemId { get; set; } + + /// Specify a name for the subitem. + [JsonPropertyName("itemName")] + public string ItemName { get; set; } + + /// columnValues + [JsonPropertyName("columnValues")] + public DynamicResponseGetListSchema ColumnValues { get; set; } + } + + /// + /// Response for Create a subitem + /// + public class CreateSubitemResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Response for Get subitem column names + /// + public class GetSubitemColumnNamesResponse + { + /// Schema of the requested schema type + [JsonPropertyName("schema")] + public object Schema { get; set; } + } + + /// + /// Response for Get subitem column names + /// + public class GetSubitemSchemaResponse + { + /// Schema of the requested schema type + [JsonPropertyName("schema")] + public object Schema { get; set; } + } + + /// + /// Response for Get subitems + /// + [DynamicSchema("GetSubitemSchema")] + public class GetSubitemColumnNamesForGetSubitems + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Create an update + /// + public class CreateUpdateInput + { + /// workspaceId + [JsonPropertyName("workspaceId")] + public string WorkspaceId { get; set; } + + /// boardId + [JsonPropertyName("boardId")] + public string BoardId { get; set; } + + /// Select a group from the drop-down or specify a group ID. + [JsonPropertyName("groupId")] + public string GroupId { get; set; } + + /// Select an item from the drop-down or specify an item ID. + [JsonPropertyName("itemId")] + public string ItemId { get; set; } + + /// Specify text for the update. + [JsonPropertyName("body")] + public string Body { get; set; } + } + + /// + /// Response for Create an update + /// + public class CreateUpdateResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Response for Get an item by ID + /// + [DynamicSchema("GetColumnNamesSchemaForWebhook")] + public class DynamicResponseGetListSchemaGet + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Create a workspace + /// + public class CreateWorkspaceInput + { + /// Specify a name for the new workspace. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Specify a description for the new workspace. + [JsonPropertyName("description")] + public string Description { get; set; } + } + + /// + /// Response for Create a workspace + /// + public class CreateWorkspaceResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Response for Get items + /// + [DynamicSchema("GetSchemaForGetItemsAction")] + public class DynamicGetGetItemsSchema + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get tags + /// + public class GetTagsResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Response for Get users + /// + public class GetUsersResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Response for Get workspaces + /// + public class GetWorkspacesResponse + { + /// data + [JsonPropertyName("data")] + public object Data { get; set; } + } + + /// + /// Extensible enum for known ColumnType values. + /// + [JsonConverter(typeof(ColumnType.ColumnTypeJsonConverter))] + public readonly struct ColumnType : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public ColumnType(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// auto_number + public static ColumnType AutoNumber { get; } = new("auto_number"); + + /// checkbox + public static ColumnType Checkbox { get; } = new("checkbox"); + + /// country + public static ColumnType Country { get; } = new("country"); + + /// color_picker + public static ColumnType ColorPicker { get; } = new("color_picker"); + + /// creation_log + public static ColumnType CreationLog { get; } = new("creation_log"); + + /// date + public static ColumnType Date { get; } = new("date"); + + /// dependency + public static ColumnType Dependency { get; } = new("dependency"); + + /// dropdown + public static ColumnType Dropdown { get; } = new("dropdown"); + + /// email + public static ColumnType Email { get; } = new("email"); + + /// file + public static ColumnType File { get; } = new("file"); + + /// hour + public static ColumnType Hour { get; } = new("hour"); + + /// item_id + public static ColumnType ItemId { get; } = new("item_id"); + + /// last_updated + public static ColumnType LastUpdated { get; } = new("last_updated"); + + /// link + public static ColumnType Link { get; } = new("link"); + + /// location + public static ColumnType Location { get; } = new("location"); + + /// long_text + public static ColumnType LongText { get; } = new("long_text"); + + /// numbers + public static ColumnType Numbers { get; } = new("numbers"); + + /// people + public static ColumnType People { get; } = new("people"); + + /// phone + public static ColumnType Phone { get; } = new("phone"); + + /// progress + public static ColumnType Progress { get; } = new("progress"); + + /// rating + public static ColumnType Rating { get; } = new("rating"); + + /// status + public static ColumnType Status { get; } = new("status"); + + /// team + public static ColumnType Team { get; } = new("team"); + + /// tags + public static ColumnType Tags { get; } = new("tags"); + + /// text + public static ColumnType Text { get; } = new("text"); + + /// timeline + public static ColumnType Timeline { get; } = new("timeline"); + + /// time_tracking + public static ColumnType TimeTracking { get; } = new("time_tracking"); + + /// vote + public static ColumnType Vote { get; } = new("vote"); + + /// week + public static ColumnType Week { get; } = new("week"); + + /// world_clock + public static ColumnType WorldClock { get; } = new("world_clock"); + + /// Converts a string to . + public static implicit operator ColumnType(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(ColumnType value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(ColumnType other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is ColumnType other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(ColumnType left, ColumnType right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(ColumnType left, ColumnType right) => !left.Equals(right); + + internal sealed class ColumnTypeJsonConverter : JsonConverter + { + public ColumnTypeJsonConverter() { } + public override ColumnType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for ColumnType, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, ColumnType value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known DuplicationType values. + /// + [JsonConverter(typeof(DuplicationType.DuplicationTypeJsonConverter))] + public readonly struct DuplicationType : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public DuplicationType(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// Duplicate board with structure + public static DuplicationType DuplicateBoardWithStructure { get; } = new("Duplicate board with structure"); + + /// Duplicate board with items + public static DuplicationType DuplicateBoardWithItems { get; } = new("Duplicate board with items"); + + /// Duplicate board with items and updates + public static DuplicationType DuplicateBoardWithItemsAndUpdates { get; } = new("Duplicate board with items and updates"); + + /// Converts a string to . + public static implicit operator DuplicationType(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(DuplicationType value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(DuplicationType other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is DuplicationType other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(DuplicationType left, DuplicationType right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(DuplicationType left, DuplicationType right) => !left.Equals(right); + + internal sealed class DuplicationTypeJsonConverter : JsonConverter + { + public DuplicationTypeJsonConverter() { } + public override DuplicationType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for DuplicationType, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, DuplicationType value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Monday models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class MondayModelFactory + { + /// + /// Creates a new instance of . + /// + public static WebhookCreateItemInput WebhookCreateItemInput( + string workspaceId = default, + string boardId = default, + string callbackUrl = default) + { + return new WebhookCreateItemInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + CallbackUrl = callbackUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static WebhookCreateUpdateInput WebhookCreateUpdateInput( + string workspaceId = default, + string boardId = default, + string callbackUrl = default) + { + return new WebhookCreateUpdateInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + CallbackUrl = callbackUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static WebhookChangeNameInput WebhookChangeNameInput( + string workspaceId = default, + string boardId = default, + string callbackUrl = default) + { + return new WebhookChangeNameInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + CallbackUrl = callbackUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static WebhookChangeSubitemNameInput WebhookChangeSubitemNameInput( + string workspaceId = default, + string boardId = default, + string callbackUrl = default) + { + return new WebhookChangeSubitemNameInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + CallbackUrl = callbackUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static WebhookCreateSubitemInput WebhookCreateSubitemInput( + string workspaceId = default, + string boardId = default, + string callbackUrl = default) + { + return new WebhookCreateSubitemInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + CallbackUrl = callbackUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static WebhookColumnChangesInput WebhookColumnChangesInput( + string workspaceId = default, + string boardId = default, + string columnId = default, + string callbackUrl = default) + { + return new WebhookColumnChangesInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + ColumnId = columnId, + CallbackUrl = callbackUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static WebhookAnyColumnChangesInput WebhookAnyColumnChangesInput( + string workspaceId = default, + string boardId = default, + string callbackUrl = default) + { + return new WebhookAnyColumnChangesInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + CallbackUrl = callbackUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static WebhookSubitemColumnChangesInput WebhookSubitemColumnChangesInput( + string workspaceId = default, + string boardId = default, + string callbackUrl = default) + { + return new WebhookSubitemColumnChangesInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + CallbackUrl = callbackUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetColumnNamesSchemaResponse GetColumnNamesSchemaResponse( + object schema = default) + { + return new GetColumnNamesSchemaResponse + { + Schema = schema, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetSingleColumnSchemaResponse GetSingleColumnSchemaResponse( + object schema = default) + { + return new GetSingleColumnSchemaResponse + { + Schema = schema, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetColumnNamesSchemaForWebhookResponse GetColumnNamesSchemaForWebhookResponse( + object schema = default) + { + return new GetColumnNamesSchemaForWebhookResponse + { + Schema = schema, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetSchemaForGetItemsActionResponse GetSchemaForGetItemsActionResponse( + object schema = default) + { + return new GetSchemaForGetItemsActionResponse + { + Schema = schema, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetColumnNamesSchemaForUpdateWebhookResponse GetColumnNamesSchemaForUpdateWebhookResponse( + object schema = default) + { + return new GetColumnNamesSchemaForUpdateWebhookResponse + { + Schema = schema, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateItemInput CreateItemInput( + string workspaceId = default, + string boardId = default, + string groupId = default, + string itemName = default, + DynamicResponseGetListSchema columnValues = default) + { + return new CreateItemInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + GroupId = groupId, + ItemName = itemName, + ColumnValues = columnValues, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateItemResponse CreateItemResponse( + object data = default) + { + return new CreateItemResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static DuplicateBoardInput DuplicateBoardInput( + string sourceWorkspaceId = default, + string sourceBoardId = default, + string duplicatedBoardName = default, + DuplicationType? duplicationType = default, + string destinationWorkspaceId = default, + string destinationFolder = default, + bool? keepBoardSubscribers = default) + { + return new DuplicateBoardInput + { + SourceWorkspaceId = sourceWorkspaceId, + SourceBoardId = sourceBoardId, + DuplicatedBoardName = duplicatedBoardName, + DuplicationType = duplicationType, + DestinationWorkspaceId = destinationWorkspaceId, + DestinationFolder = destinationFolder, + KeepBoardSubscribers = keepBoardSubscribers, + }; + } + + /// + /// Creates a new instance of . + /// + public static DuplicateBoardResponse DuplicateBoardResponse( + string id = default) + { + return new DuplicateBoardResponse + { + Id = id, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateBoardInput CreateBoardInput( + string workspaceId = default, + string boardName = default) + { + return new CreateBoardInput + { + WorkspaceId = workspaceId, + BoardName = boardName, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateBoardResponse CreateBoardResponse( + object data = default) + { + return new CreateBoardResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateColumnInput CreateColumnInput( + string workspaceId = default, + string boardId = default, + string title = default, + string description = default, + ColumnType? columnType = default) + { + return new CreateColumnInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + Title = title, + Description = description, + ColumnType = columnType, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateColumnResponse CreateColumnResponse( + object data = default) + { + return new CreateColumnResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateGroupInput CreateGroupInput( + string workspaceId = default, + string boardId = default, + string groupName = default) + { + return new CreateGroupInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + GroupName = groupName, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateGroupResponse CreateGroupResponse( + object data = default) + { + return new CreateGroupResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static UpdateItemColumnInput UpdateItemColumnInput( + string workspaceId = default, + string boardId = default, + string columnId = default, + string itemId = default, + DynamicResponseGetSingleColumnSchema columnValues = default) + { + return new UpdateItemColumnInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + ColumnId = columnId, + ItemId = itemId, + ColumnValues = columnValues, + }; + } + + /// + /// Creates a new instance of . + /// + public static UpdateItemColumnResponse UpdateItemColumnResponse( + object data = default) + { + return new UpdateItemColumnResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static UpdateMultipleItemColumnsInput UpdateMultipleItemColumnsInput( + string workspaceId = default, + string boardId = default, + string itemId = default, + string itemName = default, + DynamicResponseGetListSchema columnValues = default) + { + return new UpdateMultipleItemColumnsInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + ItemId = itemId, + ItemName = itemName, + ColumnValues = columnValues, + }; + } + + /// + /// Creates a new instance of . + /// + public static UpdateMultipleItemColumnsResponse UpdateMultipleItemColumnsResponse( + object data = default) + { + return new UpdateMultipleItemColumnsResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static MoveItemToGroupInput MoveItemToGroupInput( + string workspaceId = default, + string boardId = default, + string groupId = default, + string itemId = default) + { + return new MoveItemToGroupInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + GroupId = groupId, + ItemId = itemId, + }; + } + + /// + /// Creates a new instance of . + /// + public static MoveItemToGroupResponse MoveItemToGroupResponse( + object data = default) + { + return new MoveItemToGroupResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateNotificationInput CreateNotificationInput( + string userId = default, + string targetId = default, + string text = default) + { + return new CreateNotificationInput + { + UserId = userId, + TargetId = targetId, + Text = text, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateNotificationResponse CreateNotificationResponse( + object data = default) + { + return new CreateNotificationResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateSubitemInput CreateSubitemInput( + string workspaceId = default, + string boardId = default, + string parentItemId = default, + string itemName = default, + DynamicResponseGetListSchema columnValues = default) + { + return new CreateSubitemInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + ParentItemId = parentItemId, + ItemName = itemName, + ColumnValues = columnValues, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateSubitemResponse CreateSubitemResponse( + object data = default) + { + return new CreateSubitemResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetSubitemColumnNamesResponse GetSubitemColumnNamesResponse( + object schema = default) + { + return new GetSubitemColumnNamesResponse + { + Schema = schema, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetSubitemSchemaResponse GetSubitemSchemaResponse( + object schema = default) + { + return new GetSubitemSchemaResponse + { + Schema = schema, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateUpdateInput CreateUpdateInput( + string workspaceId = default, + string boardId = default, + string groupId = default, + string itemId = default, + string body = default) + { + return new CreateUpdateInput + { + WorkspaceId = workspaceId, + BoardId = boardId, + GroupId = groupId, + ItemId = itemId, + Body = body, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateUpdateResponse CreateUpdateResponse( + object data = default) + { + return new CreateUpdateResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateWorkspaceInput CreateWorkspaceInput( + string name = default, + string description = default) + { + return new CreateWorkspaceInput + { + Name = name, + Description = description, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateWorkspaceResponse CreateWorkspaceResponse( + object data = default) + { + return new CreateWorkspaceResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetTagsResponse GetTagsResponse( + object data = default) + { + return new GetTagsResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetUsersResponse GetUsersResponse( + object data = default) + { + return new GetUsersResponse + { + Data = data, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetWorkspacesResponse GetWorkspacesResponse( + object data = default) + { + return new GetWorkspacesResponse + { + Data = data, + }; + } + } + + #endregion Model Factory + +} + +namespace Azure.Connectors.Sdk.Monday +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Monday connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class MondayTriggerOperations + { + /// + /// When an item is created. + /// + public const string OnWebhookCreateItem = "WebhookCreateItem"; + + /// + /// When a new update is posted. + /// + public const string OnWebhookCreateUpdate = "WebhookCreateUpdate"; + + /// + /// When an item's name changes. + /// + public const string OnWebhookChangeName = "WebhookChangeName"; + + /// + /// When a subitem's name changes. + /// + public const string OnWebhookChangeSubitemName = "WebhookChangeSubitemName"; + + /// + /// When a subitem is created. + /// + public const string OnWebhookCreateSubitem = "WebhookCreateSubitem"; + + /// + /// When a column changes. + /// + public const string OnWebhookColumnChanges = "WebhookColumnChanges"; + + /// + /// When any column changes. + /// + public const string OnWebhookAnyColumnChanges = "WebhookAnyColumnChanges"; + + /// + /// When any subitem column changes. + /// + public const string OnWebhookSubitemColumnChanges = "WebhookSubitemColumnChanges"; + + } + + #endregion Trigger Operation Constants + + #region Client + + /// + /// Typed client for monday connector. + /// + public class MondayClient : ConnectorClientBase + { + /// + /// Creates a new MondayClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public MondayClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new MondayClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public MondayClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new MondayClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public MondayClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new MondayClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public MondayClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected MondayClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "monday"; + + /// + /// Get boards + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// workspaceId + /// Cancellation token. + /// The Get boards response. + public virtual async Task> GetBoardsAsync(string workspaceId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (workspaceId != default) + queryParams.Add($"workspaceId={Uri.EscapeDataString(workspaceId.ToString())}"); + var path = $"/getData/getBoards" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get groups for the Get Items operation + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// boardId + /// Cancellation token. + /// The Get groups for the Get Items operation response. + public virtual async Task> GetGroupsForGetItemsAsync(string boardId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"boardId={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/getData/getGroupsForGetItems" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get columns for item filtering + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// boardId + /// Cancellation token. + /// The Get columns for item filtering response. + public virtual async Task> GetColumnsForItemFilteringAsync(string boardId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"boardId={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/getData/getColumnsForItemFiltering" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get column filter operator + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// boardId + /// columnId + /// Cancellation token. + /// The Get column filter operator response. + public virtual async Task> GetColumnFilterOperatorAsync(string boardId, string columnId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"boardId={Uri.EscapeDataString(boardId.ToString())}"); + if (columnId != default) + queryParams.Add($"columnId={Uri.EscapeDataString(columnId.ToString())}"); + var path = $"/getData/getColumnFilterOperator" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get column names for a board ID + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// boardId + /// Cancellation token. + /// The Get column names for a board ID response. + public virtual async Task GetColumnNamesSchemaAsync(string boardId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (boardId != default) + queryParams.Add($"boardId={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/getSchema/getColumnNames" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Gets single column schema for a board ID + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// boardId + /// columnId + /// Cancellation token. + /// The Gets single column schema for a board ID response. + public virtual async Task GetSingleColumnSchemaAsync(string boardId = default, string columnId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (boardId != default) + queryParams.Add($"boardId={Uri.EscapeDataString(boardId.ToString())}"); + if (columnId != default) + queryParams.Add($"columnId={Uri.EscapeDataString(columnId.ToString())}"); + var path = $"/getSchema/getSingleColumnSchema" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get column names for a board ID for a webhook + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// boardId + /// Cancellation token. + /// The Get column names for a board ID for a webhook response. + public virtual async Task GetColumnNamesSchemaForWebhookAsync(string boardId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (boardId != default) + queryParams.Add($"boardId={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/getSchema/getColumnNamesForWebhook" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get column names for a board ID for a webhook + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// boardId + /// Cancellation token. + /// The Get column names for a board ID for a webhook response. + public virtual async Task GetSchemaForGetItemsActionAsync(string boardId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (boardId != default) + queryParams.Add($"boardId={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/getSchema/getSchemaForGetItemsAction" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get column names for a board ID for an update webhook + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// boardId + /// Cancellation token. + /// The Get column names for a board ID for an update webhook response. + public virtual async Task GetColumnNamesSchemaForUpdateWebhookAsync(string boardId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (boardId != default) + queryParams.Add($"boardId={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/getSchema/getColumnNamesForUpdateWebhook" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create an item + /// + /// Creates an item in the selected monday.com board and group. + /// The request body. + /// Cancellation token. + /// The Create an item response. + public virtual async Task CreateItemAsync(CreateItemInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/CreateItem"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Duplicate a board + /// + /// Duplicates a board in monday.com. + /// The request body. + /// Cancellation token. + /// The Duplicate a board response. + public virtual async Task DuplicateBoardAsync(DuplicateBoardInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/DuplicateBoard"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a board + /// + /// Creates a board in monday.com. + /// The request body. + /// Cancellation token. + /// The Create a board response. + public virtual async Task CreateBoardAsync(CreateBoardInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/CreateBoard"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a column + /// + /// Creates a column in monday.com for the specified board. + /// The request body. + /// Cancellation token. + /// The Create a column response. + public virtual async Task CreateColumnAsync(CreateColumnInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/CreateColumn"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a group + /// + /// Creates a group in monday.com for the specified board. + /// The request body. + /// Cancellation token. + /// The Create a group response. + public virtual async Task CreateGroupAsync(CreateGroupInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/CreateGroup"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update an item's column value + /// + /// Updates a single item's column. If the value is blank, the column value will be cleared. + /// The request body. + /// Cancellation token. + /// The Update an item's column value response. + public virtual async Task UpdateItemColumnAsync(UpdateItemColumnInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/UpdateItemColumn"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update multiple item column values + /// + /// Updates multiple item columns. Leave the column value blank to keep the current value. + /// The request body. + /// Cancellation token. + /// The Update multiple item column values response. + public virtual async Task UpdateMultipleItemColumnsAsync(UpdateMultipleItemColumnsInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/UpdateMultipleItemColumns"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Move an item to a group + /// + /// Moves an item to another group on the same board. + /// The request body. + /// Cancellation token. + /// The Move an item to a group response. + public virtual async Task MoveItemToGroupAsync(MoveItemToGroupInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/MoveItemToGroup"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a notification + /// + /// Creates a notification in monday.com for a user for either a specific board or item. + /// The request body. + /// Cancellation token. + /// The Create a notification response. + public virtual async Task CreateNotificationAsync(CreateNotificationInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/CreateNotification"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a subitem + /// + /// Creates a subitem in monday.com for the selected board and parent item. + /// The request body. + /// Cancellation token. + /// The Create a subitem response. + public virtual async Task CreateSubitemAsync(CreateSubitemInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/CreateSubitem"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get subitem column names + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// parentBoardId + /// Cancellation token. + /// The Get subitem column names response. + public virtual async Task GetSubitemColumnNamesAsync(string parentBoardId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"parentBoardId={Uri.EscapeDataString(parentBoardId.ToString())}"); + var path = $"/getSchema/getSubitemColumnNames" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get subitem column names + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// parentBoardId + /// Cancellation token. + /// The Get subitem column names response. + public virtual async Task GetSubitemSchemaAsync(string parentBoardId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"parentBoardId={Uri.EscapeDataString(parentBoardId.ToString())}"); + var path = $"/getSchema/getSubitemSchema" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get subitems + /// + /// Gets subitems in monday.com for a specific item in a board. + /// Workspace + /// Board + /// Item ID + /// Cancellation token. + /// The Get subitems response. + public virtual async Task GetSubitemsAsync([DynamicValues("GetWorkspaces_V2")] string workspace, [DynamicValues("GetBoards")] string board, string itemId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"workspaceId={Uri.EscapeDataString(workspace.ToString())}"); + queryParams.Add($"boardId={Uri.EscapeDataString(board.ToString())}"); + queryParams.Add($"itemId={Uri.EscapeDataString(itemId.ToString())}"); + var path = $"/getData/getSubitems" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create an update + /// + /// Creates an update in monday.com for a specific item. + /// The request body. + /// Cancellation token. + /// The Create an update response. + public virtual async Task CreateUpdateAsync(CreateUpdateInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/CreateUpdate"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get an item by ID + /// + /// Gets a monday.com item using the specified item ID and board. + /// Item ID + /// Workspace + /// Board + /// Cancellation token. + /// The Get an item by ID response. + public virtual async Task GetItemByIdAsync(string itemId, [DynamicValues("GetWorkspaces_V2")] string workspace, [DynamicValues("GetBoards")] string board, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"itemId={Uri.EscapeDataString(itemId.ToString())}"); + queryParams.Add($"workspaceId={Uri.EscapeDataString(workspace.ToString())}"); + queryParams.Add($"boardId={Uri.EscapeDataString(board.ToString())}"); + var path = $"/getData/getItemById" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a workspace + /// + /// Creates a monday.com workspace with a user-specified name and description. + /// The request body. + /// Cancellation token. + /// The Create a workspace response. + public virtual async Task CreateWorkspaceAsync(CreateWorkspaceInput input, CancellationToken cancellationToken = default) + { + var path = $"/executePowerAutomateAction/CreateWorkspaceV2"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get items + /// + /// Gets items in monday.com for a specific board and group. Filter items by column values using the filters found under advanced options. More info on filtering can be found here: https://plugingenie.com/docs/filtering-items. + /// Workspace + /// Board + /// Group + /// Filter 1 - Column + /// Filter 1 - Operator + /// Filter 1 - Value + /// Filter 2 - Column + /// Filter 2 - Operator + /// Filter 2 - Value + /// Filter 3 - Column + /// Filter 3 - Operator + /// Filter 3 - Value + /// Filter 4 - Column + /// Filter 4 - Operator + /// Filter 4 - Value + /// Cancellation token. + /// The Get items response. + public virtual async Task GetItemsAsync([DynamicValues("GetWorkspaces_V2")] string workspace, [DynamicValues("GetBoards")] string board, [DynamicValues("GetGroupsForGetItems")] string group, [DynamicValues("GetColumnsForItemFiltering")] string filter1Column = default, [DynamicValues("GetColumnFilterOperator")] string filter1Operator = default, string filter1Value = default, [DynamicValues("GetColumnsForItemFiltering")] string filter2Column = default, [DynamicValues("GetColumnFilterOperator")] string filter2Operator = default, string filter2Value = default, [DynamicValues("GetColumnsForItemFiltering")] string filter3Column = default, [DynamicValues("GetColumnFilterOperator")] string filter3Operator = default, string filter3Value = default, [DynamicValues("GetColumnsForItemFiltering")] string filter4Column = default, [DynamicValues("GetColumnFilterOperator")] string filter4Operator = default, string filter4Value = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"workspaceId={Uri.EscapeDataString(workspace.ToString())}"); + queryParams.Add($"boardId={Uri.EscapeDataString(board.ToString())}"); + queryParams.Add($"groupId={Uri.EscapeDataString(group.ToString())}"); + if (filter1Column != default) + queryParams.Add($"filter1Column={Uri.EscapeDataString(filter1Column.ToString())}"); + if (filter1Operator != default) + queryParams.Add($"filter1Operator={Uri.EscapeDataString(filter1Operator.ToString())}"); + if (filter1Value != default) + queryParams.Add($"filter1Value={Uri.EscapeDataString(filter1Value.ToString())}"); + if (filter2Column != default) + queryParams.Add($"filter2Column={Uri.EscapeDataString(filter2Column.ToString())}"); + if (filter2Operator != default) + queryParams.Add($"filter2Operator={Uri.EscapeDataString(filter2Operator.ToString())}"); + if (filter2Value != default) + queryParams.Add($"filter2Value={Uri.EscapeDataString(filter2Value.ToString())}"); + if (filter3Column != default) + queryParams.Add($"filter3Column={Uri.EscapeDataString(filter3Column.ToString())}"); + if (filter3Operator != default) + queryParams.Add($"filter3Operator={Uri.EscapeDataString(filter3Operator.ToString())}"); + if (filter3Value != default) + queryParams.Add($"filter3Value={Uri.EscapeDataString(filter3Value.ToString())}"); + if (filter4Column != default) + queryParams.Add($"filter4Column={Uri.EscapeDataString(filter4Column.ToString())}"); + if (filter4Operator != default) + queryParams.Add($"filter4Operator={Uri.EscapeDataString(filter4Operator.ToString())}"); + if (filter4Value != default) + queryParams.Add($"filter4Value={Uri.EscapeDataString(filter4Value.ToString())}"); + var path = $"/getData/getItemsV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get tags + /// + /// This operation gets monday.com tags. + /// Cancellation token. + /// The Get tags response. + public virtual async Task GetTagsAsync(CancellationToken cancellationToken = default) + { + var path = $"/getData/getTagsV2"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get users + /// + /// This operation gets the name, email, and ID of users in your monday.com account. + /// Cancellation token. + /// The Get users response. + public virtual async Task GetUsersAsync(CancellationToken cancellationToken = default) + { + var path = $"/getData/getUsersV2"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get workspaces + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The Get workspaces response. + public virtual async Task GetWorkspacesAsync(CancellationToken cancellationToken = default) + { + var path = $"/getData/getWorkspacesV2"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/Office365Extensions.cs b/src/Azure.Connectors.Sdk/Generated/Office365Extensions.cs index f8edafe..ca31c0e 100644 --- a/src/Azure.Connectors.Sdk/Generated/Office365Extensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/Office365Extensions.cs @@ -790,20 +790,6 @@ public class ContactResponse public DateTime? LastModifiedTime { get; internal set; } } - /// - /// Item in The contact's email addresses - /// - public class EmailAddressV2 - { - /// name - [JsonPropertyName("name")] - public string Name { get; set; } - - /// address - [JsonPropertyName("address")] - public string Address { get; set; } - } - /// /// homeAddress /// @@ -840,154 +826,6 @@ public class EntityListResponseContactResponse public List Value { get; set; } } - /// - /// Item in List of values - /// - public class ContactResponseV2 - { - /// The contact's unique identifier. - [JsonPropertyName("id")] - public string Id { get; set; } - - /// The ID of the contact's parent folder - [JsonPropertyName("parentFolderId")] - public string ParentFolderId { get; set; } - - /// The contact's birthday - [JsonPropertyName("birthday")] - public DateTime? Birthday { get; set; } - - /// The name the contact is filed under - [JsonPropertyName("fileAs")] - public string FileAs { get; set; } - - /// The contact's display name - [JsonPropertyName("displayName")] - public string DisplayName { get; set; } - - /// The contact's given name - [JsonPropertyName("givenName")] - public string GivenName { get; set; } - - /// The contact's initials - [JsonPropertyName("initials")] - public string Initials { get; set; } - - /// The contact's middle name - [JsonPropertyName("middleName")] - public string MiddleName { get; set; } - - /// The contact's nickname - [JsonPropertyName("nickName")] - public string Nickname { get; set; } - - /// The contact's surname - [JsonPropertyName("surname")] - public string Surname { get; set; } - - /// The contact's title - [JsonPropertyName("title")] - public string Title { get; set; } - - /// The contact's generation - [JsonPropertyName("generation")] - public string Generation { get; set; } - - /// The contact's email addresses - [JsonPropertyName("emailAddresses")] - public List EmailAddresses { get; set; } - - /// The contact's instant messaging (IM) addresses - [JsonPropertyName("imAddresses")] - public List IMAddresses { get; set; } - - /// The contact's job title - [JsonPropertyName("jobTitle")] - public string JobTitle { get; set; } - - /// The name of the contact's company - [JsonPropertyName("companyName")] - public string CompanyName { get; set; } - - /// The contact's department - [JsonPropertyName("department")] - public string Department { get; set; } - - /// The location of the contact's office - [JsonPropertyName("officeLocation")] - public string OfficeLocation { get; set; } - - /// The contact's profession - [JsonPropertyName("profession")] - public string Profession { get; set; } - - /// The business home page of the contact - [JsonPropertyName("businessHomePage")] - public string BusinessHomePage { get; set; } - - /// The name of the contact's assistant - [JsonPropertyName("assistantName")] - public string AssistantName { get; set; } - - /// The name of the contact's manager - [JsonPropertyName("manager")] - public string Manager { get; set; } - - /// The contact's home phone numbers - [JsonPropertyName("homePhones")] - public List HomePhones { get; set; } - - /// The contact's business phone numbers - [JsonPropertyName("businessPhones")] - public List BusinessPhones { get; set; } - - /// The contact's mobile phone number - [JsonPropertyName("mobilePhone")] - public string MobilePhone { get; set; } - - /// homeAddress - [JsonPropertyName("homeAddress")] - public PhysicalAddress HomeAddress { get; set; } - - /// businessAddress - [JsonPropertyName("businessAddress")] - public PhysicalAddress BusinessAddress { get; set; } - - /// otherAddress - [JsonPropertyName("otherAddress")] - public PhysicalAddress OtherAddress { get; set; } - - /// The phonetic Japanese company name of the contact - [JsonPropertyName("yomiCompanyName")] - public string YomiCompanyName { get; set; } - - /// The phonetic Japanese given name (first name) of the contact - [JsonPropertyName("yomiGivenName")] - public string YomiGivenName { get; set; } - - /// The phonetic Japanese surname (last name) of the contact - [JsonPropertyName("yomiSurname")] - public string YomiSurname { get; set; } - - /// The categories associated with the contact - [JsonPropertyName("categories")] - public List Categories { get; set; } - - /// Identifies the version of the event object - [JsonPropertyName("changeKey")] - public string ChangeKey { get; set; } - - /// The time the contact was created - [JsonPropertyName("createdDateTime")] - [JsonInclude] - public DateTime? CreatedTime { get; internal set; } - - /// The time the contact was modified - [JsonPropertyName("lastModifiedDateTime")] - [JsonInclude] - public DateTime? LastModifiedTime { get; internal set; } - } - /// /// Response for Get contact folders (V2) /// @@ -1330,7 +1168,7 @@ public class GetMailTipsResponse /// /// Item in value /// - public class MailTipsClientReceiveV2 + public class MailTipsClientReceive { /// automaticReplies [JsonPropertyName("automaticReplies")] @@ -1879,36 +1717,6 @@ public class GraphCalendarEventClient public Sensitivity? Sensitivity { get; set; } } - /// - /// MailTipsClientReceive_V2 - /// - public class MailTipsClientReceive - { - /// automaticReplies - [JsonPropertyName("automaticReplies")] - public MailTipsAutomaticReplies AutomaticReplies { get; set; } - - /// Is delivery restricted - [JsonPropertyName("deliveryRestricted")] - public bool? IsDeliveryRestricted { get; set; } - - /// Number of external members - [JsonPropertyName("externalMemberCount")] - public int? IsModerated { get; set; } - - /// Is mailbox full - [JsonPropertyName("mailboxFull")] - public bool? IsMailboxFull { get; set; } - - /// Maximum message size - [JsonPropertyName("maxMessageSize")] - public long? MaximumMessageSize { get; set; } - - /// Total member count - [JsonPropertyName("totalMemberCount")] - public long? TotalMemberCount { get; set; } - } - /// /// UpdateEmailFlag /// @@ -3618,20 +3426,6 @@ public static ContactResponse ContactResponse( }; } - /// - /// Creates a new instance of . - /// - public static EmailAddressV2 EmailAddressV2( - string name = default, - string address = default) - { - return new EmailAddressV2 - { - Name = name, - Address = address, - }; - } - /// /// Creates a new instance of . /// @@ -3664,86 +3458,6 @@ public static EntityListResponseContactResponse EntityListResponseContactRespons }; } - /// - /// Creates a new instance of . - /// - public static ContactResponseV2 ContactResponseV2( - string id = default, - string parentFolderId = default, - DateTime? birthday = default, - string fileAs = default, - string displayName = default, - string givenName = default, - string initials = default, - string middleName = default, - string nickname = default, - string surname = default, - string title = default, - string generation = default, - List emailAddresses = default, - List imAddresses = default, - string jobTitle = default, - string companyName = default, - string department = default, - string officeLocation = default, - string profession = default, - string businessHomePage = default, - string assistantName = default, - string manager = default, - List homePhones = default, - List businessPhones = default, - string mobilePhone = default, - PhysicalAddress homeAddress = default, - PhysicalAddress businessAddress = default, - PhysicalAddress otherAddress = default, - string yomiCompanyName = default, - string yomiGivenName = default, - string yomiSurname = default, - List categories = default, - string changeKey = default, - DateTime? createdTime = default, - DateTime? lastModifiedTime = default) - { - return new ContactResponseV2 - { - Id = id, - ParentFolderId = parentFolderId, - Birthday = birthday, - FileAs = fileAs, - DisplayName = displayName, - GivenName = givenName, - Initials = initials, - MiddleName = middleName, - Nickname = nickname, - Surname = surname, - Title = title, - Generation = generation, - EmailAddresses = emailAddresses, - IMAddresses = imAddresses, - JobTitle = jobTitle, - CompanyName = companyName, - Department = department, - OfficeLocation = officeLocation, - Profession = profession, - BusinessHomePage = businessHomePage, - AssistantName = assistantName, - Manager = manager, - HomePhones = homePhones, - BusinessPhones = businessPhones, - MobilePhone = mobilePhone, - HomeAddress = homeAddress, - BusinessAddress = businessAddress, - OtherAddress = otherAddress, - YomiCompanyName = yomiCompanyName, - YomiGivenName = yomiGivenName, - YomiSurname = yomiSurname, - Categories = categories, - ChangeKey = changeKey, - CreatedTime = createdTime, - LastModifiedTime = lastModifiedTime, - }; - } - /// /// Creates a new instance of . /// @@ -3997,9 +3711,9 @@ public static GetMailTipsResponse GetMailTipsResponse( } /// - /// Creates a new instance of . + /// Creates a new instance of . /// - public static MailTipsClientReceiveV2 MailTipsClientReceiveV2( + public static MailTipsClientReceive MailTipsClientReceive( MailTipsAutomaticReplies automaticReplies = default, bool? isDeliveryRestricted = default, int? isModerated = default, @@ -4007,7 +3721,7 @@ public static MailTipsClientReceiveV2 MailTipsClientReceiveV2( long? maximumMessageSize = default, long? totalMemberCount = default) { - return new MailTipsClientReceiveV2 + return new MailTipsClientReceive { AutomaticReplies = automaticReplies, IsDeliveryRestricted = isDeliveryRestricted, @@ -4412,28 +4126,6 @@ public static GraphCalendarEventClient GraphCalendarEventClient( }; } - /// - /// Creates a new instance of . - /// - public static MailTipsClientReceive MailTipsClientReceive( - MailTipsAutomaticReplies automaticReplies = default, - bool? isDeliveryRestricted = default, - int? isModerated = default, - bool? isMailboxFull = default, - long? maximumMessageSize = default, - long? totalMemberCount = default) - { - return new MailTipsClientReceive - { - AutomaticReplies = automaticReplies, - IsDeliveryRestricted = isDeliveryRestricted, - IsModerated = isModerated, - IsMailboxFull = isMailboxFull, - MaximumMessageSize = maximumMessageSize, - TotalMemberCount = totalMemberCount, - }; - } - /// /// Creates a new instance of . /// @@ -5215,8 +4907,7 @@ public virtual async Task DraftEmailAsync(DraftEmailInput public virtual async Task UpdateDraftEmailAsync(DraftEmailInput input, string messageId, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (messageId != default) - queryParams.Add($"messageId={Uri.EscapeDataString(messageId.ToString())}"); + queryParams.Add($"messageId={Uri.EscapeDataString(messageId.ToString())}"); var path = $"/Draft" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Patch, path, input, cancellationToken) @@ -5247,10 +4938,8 @@ await this public virtual async Task AssignCategoryAsync(string messageId, string category, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (messageId != default) - queryParams.Add($"messageId={Uri.EscapeDataString(messageId.ToString())}"); - if (category != default) - queryParams.Add($"category={Uri.EscapeDataString(category.ToString())}"); + queryParams.Add($"messageId={Uri.EscapeDataString(messageId.ToString())}"); + queryParams.Add($"category={Uri.EscapeDataString(category.ToString())}"); var path = $"/Mail/Category" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -5433,17 +5122,17 @@ public virtual async Task CalendarGetItemAsync( /// Skip Count /// Cancellation token. /// The Get events (V4) response. - public virtual async Task CalendarGetItemsAsync([DynamicValues("CalendarGetTables_V2")] string calendarId, string filterQuery = default, string orderBy = default, int topCount = default, int skipCount = default, CancellationToken cancellationToken = default) + public virtual async Task CalendarGetItemsAsync([DynamicValues("CalendarGetTables_V2")] string calendarId, string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (filterQuery != default) queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); if (orderBy != default) queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); - if (topCount != default) - queryParams.Add($"$top={Uri.EscapeDataString(topCount.ToString())}"); - if (skipCount != default) - queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); var path = $"/datasets/calendars/v4/tables/{Uri.EscapeDataString(calendarId.ToString())}/items" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -5543,17 +5232,17 @@ public virtual async Task ContactGetItemAsync([DynamicValues("C /// Skip Count /// Cancellation token. /// The Get contacts (V2) response. - public virtual async Task ContactGetItemsAsync([DynamicValues("ContactGetTablesV2")] string folderId, string filterQuery = default, string orderBy = default, int topCount = default, int skipCount = default, CancellationToken cancellationToken = default) + public virtual async Task ContactGetItemsAsync([DynamicValues("ContactGetTablesV2")] string folderId, string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (filterQuery != default) queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); if (orderBy != default) queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); - if (topCount != default) - queryParams.Add($"$top={Uri.EscapeDataString(topCount.ToString())}"); - if (skipCount != default) - queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); var path = $"/codeless/v1.0/me/contactFolders/{Uri.EscapeDataString(folderId.ToString())}/contacts" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -5708,15 +5397,15 @@ await this /// Sensitivity Label Metadata /// Cancellation token. /// The Get Attachment (V2) response. - public virtual async Task GetAttachmentAsync(string messageId, string attachementId, string originalMailboxAddress = default, bool extractSensitivityLabel = default, bool sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) + public virtual async Task GetAttachmentAsync(string messageId, string attachementId, string originalMailboxAddress = default, bool? extractSensitivityLabel = default, bool? sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (originalMailboxAddress != default) queryParams.Add($"mailboxAddress={Uri.EscapeDataString(originalMailboxAddress.ToString())}"); - if (extractSensitivityLabel != default) - queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.ToString())}"); - if (sensitivityLabelMetadata != default) - queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.ToString())}"); + if (extractSensitivityLabel.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.Value.ToString())}"); + if (sensitivityLabelMetadata.HasValue) + queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.Value.ToString())}"); var path = $"/codeless/v1.0/me/messages/{Uri.EscapeDataString(messageId.ToString())}/attachments/{Uri.EscapeDataString(attachementId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -5735,19 +5424,19 @@ public virtual async Task GetAttachmentAsync(string messa /// Sensitivity Label Metadata /// Cancellation token. /// The Get email (V2) response. - public virtual async Task GetEmailAsync(string messageId, string originalMailboxAddress = default, bool includeAttachments = default, string internetMessageId = default, bool extractSensitivityLabel = default, bool sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) + public virtual async Task GetEmailAsync(string messageId, string originalMailboxAddress = default, bool? includeAttachments = default, string internetMessageId = default, bool? extractSensitivityLabel = default, bool? sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (originalMailboxAddress != default) queryParams.Add($"mailboxAddress={Uri.EscapeDataString(originalMailboxAddress.ToString())}"); - if (includeAttachments != default) - queryParams.Add($"includeAttachments={Uri.EscapeDataString(includeAttachments.ToString())}"); + if (includeAttachments.HasValue) + queryParams.Add($"includeAttachments={Uri.EscapeDataString(includeAttachments.Value.ToString())}"); if (internetMessageId != default) queryParams.Add($"internetMessageId={Uri.EscapeDataString(internetMessageId.ToString())}"); - if (extractSensitivityLabel != default) - queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.ToString())}"); - if (sensitivityLabelMetadata != default) - queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.ToString())}"); + if (extractSensitivityLabel.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.Value.ToString())}"); + if (sensitivityLabelMetadata.HasValue) + queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.Value.ToString())}"); var path = $"/v2/Mail/{Uri.EscapeDataString(messageId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -5773,7 +5462,7 @@ public virtual async Task GetEmailAsync(string messag /// Top /// Cancellation token. /// The Get emails (V3) response. - public virtual async Task GetEmailsAsync(string folder = default, string to = default, string cC = default, string toOrCC = default, string from = default, string importance = default, bool onlyWithAttachments = default, string subjectFilter = default, bool fetchOnlyUnreadMessages = default, string originalMailboxAddress = default, bool includeAttachments = default, string searchQuery = default, int top = default, CancellationToken cancellationToken = default) + public virtual async Task GetEmailsAsync(string folder = default, string to = default, string cC = default, string toOrCC = default, string from = default, string importance = default, bool? onlyWithAttachments = default, string subjectFilter = default, bool? fetchOnlyUnreadMessages = default, string originalMailboxAddress = default, bool? includeAttachments = default, string searchQuery = default, int? top = default, CancellationToken cancellationToken = default) { var queryParams = new List(); queryParams.Add("fetchOnlyFlagged=false"); @@ -5789,20 +5478,20 @@ public virtual async Task GetEmailsAsync queryParams.Add($"from={Uri.EscapeDataString(from.ToString())}"); if (importance != default) queryParams.Add($"importance={Uri.EscapeDataString(importance.ToString())}"); - if (onlyWithAttachments != default) - queryParams.Add($"fetchOnlyWithAttachment={Uri.EscapeDataString(onlyWithAttachments.ToString())}"); + if (onlyWithAttachments.HasValue) + queryParams.Add($"fetchOnlyWithAttachment={Uri.EscapeDataString(onlyWithAttachments.Value.ToString())}"); if (subjectFilter != default) queryParams.Add($"subjectFilter={Uri.EscapeDataString(subjectFilter.ToString())}"); - if (fetchOnlyUnreadMessages != default) - queryParams.Add($"fetchOnlyUnread={Uri.EscapeDataString(fetchOnlyUnreadMessages.ToString())}"); + if (fetchOnlyUnreadMessages.HasValue) + queryParams.Add($"fetchOnlyUnread={Uri.EscapeDataString(fetchOnlyUnreadMessages.Value.ToString())}"); if (originalMailboxAddress != default) queryParams.Add($"mailboxAddress={Uri.EscapeDataString(originalMailboxAddress.ToString())}"); - if (includeAttachments != default) - queryParams.Add($"includeAttachments={Uri.EscapeDataString(includeAttachments.ToString())}"); + if (includeAttachments.HasValue) + queryParams.Add($"includeAttachments={Uri.EscapeDataString(includeAttachments.Value.ToString())}"); if (searchQuery != default) queryParams.Add($"searchQuery={Uri.EscapeDataString(searchQuery.ToString())}"); - if (top != default) - queryParams.Add($"top={Uri.EscapeDataString(top.ToString())}"); + if (top.HasValue) + queryParams.Add($"top={Uri.EscapeDataString(top.Value.ToString())}"); var path = $"/v3/Mail" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -5823,23 +5512,20 @@ public virtual async Task GetEmailsAsync /// Search /// Cancellation token. /// The Get calendar view of events (V3) response. - public virtual async Task GetEventsCalendarViewAsync([DynamicValues("CalendarGetTables_V2")] string calendarId, string startTime, string endTime, string filterQuery = default, string orderBy = default, int topCount = default, int skipCount = default, string search = default, CancellationToken cancellationToken = default) + public virtual async Task GetEventsCalendarViewAsync([DynamicValues("CalendarGetTables_V2")] string calendarId, string startTime, string endTime, string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, string search = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (calendarId != default) - queryParams.Add($"calendarId={Uri.EscapeDataString(calendarId.ToString())}"); - if (startTime != default) - queryParams.Add($"startDateTimeUtc={Uri.EscapeDataString(startTime.ToString())}"); - if (endTime != default) - queryParams.Add($"endDateTimeUtc={Uri.EscapeDataString(endTime.ToString())}"); + queryParams.Add($"calendarId={Uri.EscapeDataString(calendarId.ToString())}"); + queryParams.Add($"startDateTimeUtc={Uri.EscapeDataString(startTime.ToString())}"); + queryParams.Add($"endDateTimeUtc={Uri.EscapeDataString(endTime.ToString())}"); if (filterQuery != default) queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); if (orderBy != default) queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); - if (topCount != default) - queryParams.Add($"$top={Uri.EscapeDataString(topCount.ToString())}"); - if (skipCount != default) - queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); if (search != default) queryParams.Add($"search={Uri.EscapeDataString(search.ToString())}"); var path = $"/datasets/calendars/v3/tables/items/calendarview" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); @@ -5937,8 +5623,7 @@ await this public virtual async Task MoveAsync(string messageId, string folder, string originalMailboxAddress = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (folder != default) - queryParams.Add($"folderPath={Uri.EscapeDataString(folder.ToString())}"); + queryParams.Add($"folderPath={Uri.EscapeDataString(folder.ToString())}"); if (originalMailboxAddress != default) queryParams.Add($"mailboxAddress={Uri.EscapeDataString(originalMailboxAddress.ToString())}"); var path = $"/v2/Mail/Move/{Uri.EscapeDataString(messageId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); diff --git a/src/Azure.Connectors.Sdk/Generated/Office365GroupsExtensions.cs b/src/Azure.Connectors.Sdk/Generated/Office365GroupsExtensions.cs index 28c06c4..8bcd5ec 100644 --- a/src/Azure.Connectors.Sdk/Generated/Office365GroupsExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/Office365GroupsExtensions.cs @@ -43,20 +43,6 @@ public class ListGroupMembersResponse : IPageable public List Value { get; set; } } - /// - /// Item in Response for When a group member is added or removed - /// - public class OnGroupMemberAddedOrRemovedResponseItem - { - /// Unique id of the user. - [JsonPropertyName("id")] - public string UserId { get; set; } - - /// @removed - [JsonPropertyName("@removed")] - public object Removed { get; set; } - } - /// /// Response for List groups /// @@ -129,60 +115,6 @@ public class CreateCalendarEventResponse public object Location { get; set; } } - /// - /// Item in Response for When there is a new event - /// - public class OnNewEventResponseItem - { - /// Unique id of the event. - [JsonPropertyName("id")] - public string Id { get; set; } - - /// The number of minutes before the start of the event the reminder will fire. - [JsonPropertyName("reminderMinutesBeforeStart")] - public int? ReminderStartDuration { get; set; } - - /// Set to true if the event has a reminder. - [JsonPropertyName("isReminderOn")] - public bool? IsReminderOn { get; set; } - - /// Title of the event. - [JsonPropertyName("subject")] - public string Subject { get; set; } - - /// The importance of the event: Low, Normal, or High. - [JsonPropertyName("importance")] - public string Importance { get; set; } - - /// Set to true if the event lasts all day. - [JsonPropertyName("isAllDay")] - public bool? IsAllDay { get; set; } - - /// Set to true if the sender would like a response when the event is accepted or declined. - [JsonPropertyName("responseRequested")] - public bool? ResponseRequested { get; set; } - - /// Status to show during the event. - [JsonPropertyName("showAs")] - public string ShowAs { get; set; } - - /// body - [JsonPropertyName("body")] - public object Body { get; set; } - - /// start - [JsonPropertyName("start")] - public object Start { get; set; } - - /// end - [JsonPropertyName("end")] - public object End { get; set; } - - /// location - [JsonPropertyName("location")] - public object Location { get; set; } - } - /// /// Response for Send an HTTP request V2 /// @@ -451,20 +383,6 @@ public static ListGroupMembersResponse ListGroupMembersResponse( }; } - /// - /// Creates a new instance of . - /// - public static OnGroupMemberAddedOrRemovedResponseItem OnGroupMemberAddedOrRemovedResponseItem( - string userId = default, - object removed = default) - { - return new OnGroupMemberAddedOrRemovedResponseItem - { - UserId = userId, - Removed = removed, - }; - } - /// /// Creates a new instance of . /// @@ -515,40 +433,6 @@ public static CreateCalendarEventResponse CreateCalendarEventResponse( }; } - /// - /// Creates a new instance of . - /// - public static OnNewEventResponseItem OnNewEventResponseItem( - string id = default, - int? reminderStartDuration = default, - bool? isReminderOn = default, - string subject = default, - string importance = default, - bool? isAllDay = default, - bool? responseRequested = default, - string showAs = default, - object body = default, - object start = default, - object end = default, - object location = default) - { - return new OnNewEventResponseItem - { - Id = id, - ReminderStartDuration = reminderStartDuration, - IsReminderOn = isReminderOn, - Subject = subject, - Importance = importance, - IsAllDay = isAllDay, - ResponseRequested = responseRequested, - ShowAs = showAs, - Body = body, - Start = start, - End = end, - Location = location, - }; - } - /// /// Creates a new instance of . /// @@ -630,6 +514,43 @@ public static UpdateCalendarEventHTMLRequest UpdateCalendarEventHTMLRequest( #region Trigger Payloads + /// + /// Typed trigger payload for the OnGroupMembershipChange trigger (Office365Groups "When a group member is added or removed", operationId: OnGroupMembershipChange). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<Office365GroupsOnGroupMembershipChangeTriggerPayload>(body). + /// + public class Office365GroupsOnGroupMembershipChangeTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnNewEvent trigger (Office365Groups "When there is a new event", operationId: OnNewEvent). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<Office365GroupsOnNewEventTriggerPayload>(body). + /// + public class Office365GroupsOnNewEventTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Office365Groups connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class Office365GroupsTriggers + { + /// + /// Trigger operations with typed payloads for the Office365Groups connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnGroupMembershipChange"] = typeof(Office365GroupsOnGroupMembershipChangeTriggerPayload), + ["OnNewEvent"] = typeof(Office365GroupsOnNewEventTriggerPayload), + }); + } + #endregion Trigger Payloads } @@ -648,11 +569,13 @@ public static class Office365GroupsTriggerOperations { /// /// When a group member is added or removed. + /// Payload type: . /// public const string OnGroupMembershipChange = "OnGroupMembershipChange"; /// /// When there is a new event. + /// Payload type: . /// public const string OnNewEvent = "OnNewEvent"; @@ -752,11 +675,11 @@ protected Office365GroupsClient() : this(new Uri("https://localhost")) { } /// Top /// Cancellation token. /// An async enumerable of items across all pages. - public virtual AsyncPageable ListGroupMembersAsync([DynamicValues("ListOwnedGroups_V2")] string groupId, int top = default, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListGroupMembersAsync([DynamicValues("ListOwnedGroups_V2")] string groupId, int? top = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (top != default) - queryParams.Add($"$top={Uri.EscapeDataString(top.ToString())}"); + if (top.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(top.Value.ToString())}"); var path = $"/v1.0/groups/{Uri.EscapeDataString(groupId.ToString())}/members" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), @@ -774,8 +697,7 @@ public virtual AsyncPageable ListGroupMembersAsync([DynamicValues("ListO public virtual async Task AddMemberToGroupAsync([DynamicValues("ListOwnedGroups_V2")] string groupId, string userPrincipalName, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (userPrincipalName != default) - queryParams.Add($"userUpn={Uri.EscapeDataString(userPrincipalName.ToString())}"); + queryParams.Add($"userUpn={Uri.EscapeDataString(userPrincipalName.ToString())}"); var path = $"/v1.0/groups/{Uri.EscapeDataString(groupId.ToString())}/members/$ref" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -793,17 +715,17 @@ await this /// Skip token /// Cancellation token. /// An async enumerable of items across all pages. - public virtual AsyncPageable ListGroupsAsync(bool extractSensitivityLabel = default, bool sensitivityLabelMetadata = default, string filterRows = default, int pageSize = default, string skipToken = default, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListGroupsAsync(bool? extractSensitivityLabel = default, bool? sensitivityLabelMetadata = default, string filterRows = default, int? pageSize = default, string skipToken = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (extractSensitivityLabel != default) - queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.ToString())}"); - if (sensitivityLabelMetadata != default) - queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.ToString())}"); + if (extractSensitivityLabel.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.Value.ToString())}"); + if (sensitivityLabelMetadata.HasValue) + queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.Value.ToString())}"); if (filterRows != default) queryParams.Add($"$filter={Uri.EscapeDataString(filterRows.ToString())}"); - if (pageSize != default) - queryParams.Add($"$top={Uri.EscapeDataString(pageSize.ToString())}"); + if (pageSize.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(pageSize.Value.ToString())}"); if (skipToken != default) queryParams.Add($"$skiptoken={Uri.EscapeDataString(skipToken.ToString())}"); var path = $"/v1.0/groups" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); @@ -840,8 +762,7 @@ public virtual async Task UpdateCalendarEventAsync( public virtual async Task RemoveMemberFromGroupAsync([DynamicValues("ListOwnedGroups_V2")] string groupId, string userPrincipalName, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (userPrincipalName != default) - queryParams.Add($"userUpn={Uri.EscapeDataString(userPrincipalName.ToString())}"); + queryParams.Add($"userUpn={Uri.EscapeDataString(userPrincipalName.ToString())}"); var path = $"/v1.0/groups/{Uri.EscapeDataString(groupId.ToString())}/members/memberId/$ref" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) @@ -946,13 +867,13 @@ public virtual async Task HttpRequestAsync(byte[] input, Canc /// Sensitivity Label Metadata /// Cancellation token. /// The List groups that I own and belong to response. - public virtual async Task ListOwnedGroupsAsync(bool extractSensitivityLabel = default, bool sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) + public virtual async Task ListOwnedGroupsAsync(bool? extractSensitivityLabel = default, bool? sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (extractSensitivityLabel != default) - queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.ToString())}"); - if (sensitivityLabelMetadata != default) - queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.ToString())}"); + if (extractSensitivityLabel.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.Value.ToString())}"); + if (sensitivityLabelMetadata.HasValue) + queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.Value.ToString())}"); var path = $"/v2/v1.0/me/memberOf/$/microsoft.graph.group" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) diff --git a/src/Azure.Connectors.Sdk/Generated/Office365UsersExtensions.cs b/src/Azure.Connectors.Sdk/Generated/Office365UsersExtensions.cs index c9fc35e..1101b02 100644 --- a/src/Azure.Connectors.Sdk/Generated/Office365UsersExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/Office365UsersExtensions.cs @@ -310,136 +310,6 @@ public class DirectReportsResponse /// /// Item in Value /// - public class GraphUserV1 - { - /// About Me - [JsonPropertyName("aboutMe")] - public string AboutMe { get; set; } - - /// true if the account is enabled; otherwise, false. This property is required when a user is created. - [JsonPropertyName("accountEnabled")] - public bool? AccountEnabled { get; set; } - - /// Birthday - [JsonPropertyName("birthday")] - public DateTime? Birthday { get; set; } - - /// Business Phones - [JsonPropertyName("businessPhones")] - public List BusinessPhones { get; set; } - - /// The city in which the user is located. - [JsonPropertyName("city")] - public string City { get; set; } - - /// The name of the company in which the user works. - [JsonPropertyName("companyName")] - public string CompanyName { get; set; } - - /// The country/region in which the user is located; for example, "US" or "UK". - [JsonPropertyName("country")] - public string Country { get; set; } - - /// The name of the department in which the user works. - [JsonPropertyName("department")] - public string Department { get; set; } - - /// Display Name - [JsonPropertyName("displayName")] - public string DisplayName { get; set; } - - /// Given Name - [JsonPropertyName("givenName")] - public string GivenName { get; set; } - - /// Hire Date - [JsonPropertyName("hireDate")] - public DateTime? HireDate { get; set; } - - /// Id - [JsonPropertyName("id")] - public string Id { get; set; } - - /// Interests - [JsonPropertyName("interests")] - public List Interests { get; set; } - - /// Job Title - [JsonPropertyName("jobTitle")] - public string JobTitle { get; set; } - - /// Mail - [JsonPropertyName("mail")] - public string Mail { get; set; } - - /// The mail alias for the user. This property must be specified when a user is created. - [JsonPropertyName("mailNickname")] - public string Nickname { get; set; } - - /// Mobile Phone - [JsonPropertyName("mobilePhone")] - public string MobilePhone { get; set; } - - /// My Site - [JsonPropertyName("mySite")] - public string MySite { get; set; } - - /// Office Location - [JsonPropertyName("officeLocation")] - public string OfficeLocation { get; set; } - - /// Past Projects - [JsonPropertyName("pastProjects")] - public List PastProjects { get; set; } - - /// The postal code for the user's postal address. The postal code is specific to the user's country/region. In the United States of America, this attribute contains the ZIP code. - [JsonPropertyName("postalCode")] - public string PostalCode { get; set; } - - /// Preferred Language - [JsonPropertyName("preferredLanguage")] - public string PreferredLanguage { get; set; } - - /// Preferred Name - [JsonPropertyName("preferredName")] - public string PreferredName { get; set; } - - /// Responsibilities - [JsonPropertyName("responsibilities")] - public List Responsibilities { get; set; } - - /// Schools - [JsonPropertyName("schools")] - public List Schools { get; set; } - - /// Skills - [JsonPropertyName("skills")] - public List Skills { get; set; } - - /// State - [JsonPropertyName("state")] - public string State { get; set; } - - /// Street Address - [JsonPropertyName("streetAddress")] - public string StreetAddress { get; set; } - - /// Surname - [JsonPropertyName("surname")] - public string Surname { get; set; } - - /// User Principal Name - [JsonPropertyName("userPrincipalName")] - public string UserPrincipalName { get; set; } - - /// User Type - [JsonPropertyName("userType")] - public string UserType { get; set; } - } - - /// - /// Response for Get manager (V2) - /// public class GraphUser { /// About Me @@ -917,78 +787,6 @@ public static DirectReportsResponse DirectReportsResponse( }; } - /// - /// Creates a new instance of . - /// - public static GraphUserV1 GraphUserV1( - string aboutMe = default, - bool? accountEnabled = default, - DateTime? birthday = default, - List businessPhones = default, - string city = default, - string companyName = default, - string country = default, - string department = default, - string displayName = default, - string givenName = default, - DateTime? hireDate = default, - string id = default, - List interests = default, - string jobTitle = default, - string mail = default, - string nickname = default, - string mobilePhone = default, - string mySite = default, - string officeLocation = default, - List pastProjects = default, - string postalCode = default, - string preferredLanguage = default, - string preferredName = default, - List responsibilities = default, - List schools = default, - List skills = default, - string state = default, - string streetAddress = default, - string surname = default, - string userPrincipalName = default, - string userType = default) - { - return new GraphUserV1 - { - AboutMe = aboutMe, - AccountEnabled = accountEnabled, - Birthday = birthday, - BusinessPhones = businessPhones, - City = city, - CompanyName = companyName, - Country = country, - Department = department, - DisplayName = displayName, - GivenName = givenName, - HireDate = hireDate, - Id = id, - Interests = interests, - JobTitle = jobTitle, - Mail = mail, - Nickname = nickname, - MobilePhone = mobilePhone, - MySite = mySite, - OfficeLocation = officeLocation, - PastProjects = pastProjects, - PostalCode = postalCode, - PreferredLanguage = preferredLanguage, - PreferredName = preferredName, - Responsibilities = responsibilities, - Schools = schools, - Skills = skills, - State = state, - StreetAddress = streetAddress, - Surname = surname, - UserPrincipalName = userPrincipalName, - UserType = userType, - }; - } - /// /// Creates a new instance of . /// @@ -1242,15 +1040,15 @@ await this /// Sensitivity Label Metadata /// Cancellation token. /// The Get my trending documents response. - public virtual async Task MyTrendingDocumentsAsync(string filterQuery = default, bool extractSensitivityLabel = default, bool sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) + public virtual async Task MyTrendingDocumentsAsync(string filterQuery = default, bool? extractSensitivityLabel = default, bool? sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (filterQuery != default) queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); - if (extractSensitivityLabel != default) - queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.ToString())}"); - if (sensitivityLabelMetadata != default) - queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.ToString())}"); + if (extractSensitivityLabel.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.Value.ToString())}"); + if (sensitivityLabelMetadata.HasValue) + queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.Value.ToString())}"); var path = $"/codeless/beta/me/insights/trending" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1282,8 +1080,7 @@ public virtual async Task RelevantPeopleAs public virtual async Task UserPhotoMetadataAsync(string userUPN, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (userUPN != default) - queryParams.Add($"userId={Uri.EscapeDataString(userUPN.ToString())}"); + queryParams.Add($"userId={Uri.EscapeDataString(userUPN.ToString())}"); var path = $"/users/photo" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1300,15 +1097,15 @@ public virtual async Task UserPhotoMetadataAsync(string use /// Sensitivity Label Metadata /// Cancellation token. /// The Get trending documents response. - public virtual async Task TrendingDocumentsAsync(string userUPN, string filterQuery = default, bool extractSensitivityLabel = default, bool sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) + public virtual async Task TrendingDocumentsAsync(string userUPN, string filterQuery = default, bool? extractSensitivityLabel = default, bool? sensitivityLabelMetadata = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (filterQuery != default) queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); - if (extractSensitivityLabel != default) - queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.ToString())}"); - if (sensitivityLabelMetadata != default) - queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.ToString())}"); + if (extractSensitivityLabel.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractSensitivityLabel.Value.ToString())}"); + if (sensitivityLabelMetadata.HasValue) + queryParams.Add($"fetchSensitivityLabelMetadata={Uri.EscapeDataString(sensitivityLabelMetadata.Value.ToString())}"); var path = $"/codeless/beta/users/{Uri.EscapeDataString(userUPN.ToString())}/insights/trending" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1339,13 +1136,13 @@ public virtual async Task HttpRequestAsync(byte[] input, Canc /// Top /// Cancellation token. /// The Get direct reports (V2) response. - public virtual async Task DirectReportsAsync(string userUPN, string selectFields = default, int top = default, CancellationToken cancellationToken = default) + public virtual async Task DirectReportsAsync(string userUPN, string selectFields = default, int? top = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (selectFields != default) queryParams.Add($"$select={Uri.EscapeDataString(selectFields.ToString())}"); - if (top != default) - queryParams.Add($"$top={Uri.EscapeDataString(top.ToString())}"); + if (top.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(top.Value.ToString())}"); var path = $"/codeless/v1.0/users/{Uri.EscapeDataString(userUPN.ToString())}/directReports" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1398,15 +1195,15 @@ public virtual async Task MyProfileAsync(string selectFields = defaul /// Is search term required /// Cancellation token. /// An async enumerable of items across all pages. - public virtual AsyncPageable SearchUserAsync(string searchTerm = default, int top = default, bool isSearchTermRequired = default, CancellationToken cancellationToken = default) + public virtual AsyncPageable SearchUserAsync(string searchTerm = default, int? top = default, bool? isSearchTermRequired = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (searchTerm != default) queryParams.Add($"searchTerm={Uri.EscapeDataString(searchTerm.ToString())}"); - if (top != default) - queryParams.Add($"top={Uri.EscapeDataString(top.ToString())}"); - if (isSearchTermRequired != default) - queryParams.Add($"isSearchTermRequired={Uri.EscapeDataString(isSearchTermRequired.ToString())}"); + if (top.HasValue) + queryParams.Add($"top={Uri.EscapeDataString(top.Value.ToString())}"); + if (isSearchTermRequired.HasValue) + queryParams.Add($"isSearchTermRequired={Uri.EscapeDataString(isSearchTermRequired.Value.ToString())}"); var path = $"/v2/users" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), diff --git a/src/Azure.Connectors.Sdk/Generated/OneDriveExtensions.cs b/src/Azure.Connectors.Sdk/Generated/OneDriveExtensions.cs new file mode 100644 index 0000000..676d37a --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/OneDriveExtensions.cs @@ -0,0 +1,1057 @@ +// OneDriveExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.OneDrive.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.OneDrive.Models +{ + + #region Types + + /// + /// Response for Get file metadata + /// + public class BlobMetadata + { + /// The unique identifier of the file or folder. + [JsonPropertyName("Id")] + public string Id { get; set; } + + /// The name of the file or folder. + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// The name of the file or folder, without the file extension. + [JsonPropertyName("NameNoExt")] + public string NameWithoutExtension { get; set; } + + /// The display name of the file or folder. + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + + /// The path of the file or folder. + [JsonPropertyName("Path")] + public string Path { get; set; } + + /// The date and time the file or folder was last modified. + [JsonPropertyName("LastModified")] + [JsonInclude] + public DateTime? LastModifiedTime { get; internal set; } + + /// The file or folder size in bytes. + [JsonPropertyName("Size")] + public long? Size { get; set; } + + /// The media type of the file or folder. + [JsonPropertyName("MediaType")] + public string MediaType { get; set; } + + /// A boolean value (true, false) to indicate whether or not the blob is a folder. + [JsonPropertyName("IsFolder")] + public bool? IsFolder { get; set; } + + /// The etag of the file or folder. + [JsonPropertyName("ETag")] + [JsonInclude] + public string ETag { get; internal set; } + + /// The file locator of the file or folder. + [JsonPropertyName("FileLocator")] + public string FileLocator { get; set; } + + /// The user who last modified the file or folder. + [JsonPropertyName("LastModifiedBy")] + public string LastModifiedBy { get; set; } + } + + /// + /// Response for Get file tags + /// + public class Tags + { + /// A list of tags. + [JsonPropertyName("Tags")] + public List TagsValue { get; set; } + } + + /// + /// Response for Get file thumbnail + /// + public class Thumbnail + { + /// A URL that points to the thumbnail. + [JsonPropertyName("Url")] + public string Url { get; set; } + + /// The thumbnail width in pixels. + [JsonPropertyName("Width")] + public int? Width { get; set; } + + /// The thumbnail height in pixels. + [JsonPropertyName("Height")] + public int? Height { get; set; } + } + + /// + /// Response for Create share link + /// + public class SharingLink + { + /// A URL that points to the file or folder. + [JsonPropertyName("WebUrl")] + public string WebURL { get; set; } + } + + /// + /// Response for List files in folder + /// + public class BlobMetadataPage : IPageable + { + /// Blob metadata collection. + [JsonPropertyName("value")] + [JsonInclude] + public List Value { get; internal set; } + + /// A URL which can be used to retrieve the next page. + [JsonPropertyName("nextLink")] + public string NextLink { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of OneDrive models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class OneDriveModelFactory + { + /// + /// Creates a new instance of . + /// + public static BlobMetadata BlobMetadata( + string id = default, + string name = default, + string nameWithoutExtension = default, + string displayName = default, + string path = default, + DateTime? lastModifiedTime = default, + long? size = default, + string mediaType = default, + bool? isFolder = default, + string eTag = default, + string fileLocator = default, + string lastModifiedBy = default) + { + return new BlobMetadata + { + Id = id, + Name = name, + NameWithoutExtension = nameWithoutExtension, + DisplayName = displayName, + Path = path, + LastModifiedTime = lastModifiedTime, + Size = size, + MediaType = mediaType, + IsFolder = isFolder, + ETag = eTag, + FileLocator = fileLocator, + LastModifiedBy = lastModifiedBy, + }; + } + + /// + /// Creates a new instance of . + /// + public static Tags Tags( + List tagsValue = default) + { + return new Tags + { + TagsValue = tagsValue, + }; + } + + /// + /// Creates a new instance of . + /// + public static Thumbnail Thumbnail( + string url = default, + int? width = default, + int? height = default) + { + return new Thumbnail + { + Url = url, + Width = width, + Height = height, + }; + } + + /// + /// Creates a new instance of . + /// + public static SharingLink SharingLink( + string webURL = default) + { + return new SharingLink + { + WebURL = webURL, + }; + } + + /// + /// Creates a new instance of . + /// + public static BlobMetadataPage BlobMetadataPage( + List value = default, + string nextLink = default) + { + return new BlobMetadataPage + { + Value = value, + NextLink = nextLink, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnDeletedFiles trigger (OneDrive "When a file is deleted (properties only)", operationId: OnDeletedFiles). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<OneDriveOnDeletedFilesTriggerPayload>(body). + /// + public class OneDriveOnDeletedFilesTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnNewFiles trigger (OneDrive "When a file is created (properties only)", operationId: OnNewFilesV2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<OneDriveOnNewFilesTriggerPayload>(body). + /// + public class OneDriveOnNewFilesTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnUpdatedFiles trigger (OneDrive "When a file is modified (properties only)", operationId: OnUpdatedFilesV2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<OneDriveOnUpdatedFilesTriggerPayload>(body). + /// + public class OneDriveOnUpdatedFilesTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the OneDrive connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class OneDriveTriggers + { + /// + /// Trigger operations with typed payloads for the OneDrive connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnDeletedFiles"] = typeof(OneDriveOnDeletedFilesTriggerPayload), + ["OnNewFilesV2"] = typeof(OneDriveOnNewFilesTriggerPayload), + ["OnUpdatedFilesV2"] = typeof(OneDriveOnUpdatedFilesTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.OneDrive +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the OneDrive connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class OneDriveTriggerOperations + { + /// + /// When a file is deleted (properties only). + /// Payload type: . + /// + public const string OnDeletedFiles = "OnDeletedFiles"; + + /// + /// When a file is created. + /// + public const string OnNewFile = "OnNewFileV2"; + + /// + /// When a file is created (properties only). + /// Payload type: . + /// + public const string OnNewFiles = "OnNewFilesV2"; + + /// + /// When a file is modified. + /// + public const string OnUpdatedFile = "OnUpdatedFileV2"; + + /// + /// When a file is modified (properties only). + /// Payload type: . + /// + public const string OnUpdatedFiles = "OnUpdatedFilesV2"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the OneDrive connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class OneDriveTriggerParameters + { + /// + /// Input parameters for the OnDeletedFiles trigger operation (operationId: OnDeletedFiles). + /// + public static class OnDeletedFiles + { + /// + /// The unique identifier of the folder. + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// Include items in subfolders + /// Default: false. + /// + public const string IncludeSubfolders = "includeSubfolders"; + + /// + /// Simulate this call. + /// Default: false. + /// + public const string Simulate = "simulate"; + + /// + /// Special header to enable operation simulation + /// + public const string XMsOperationContext = "x-ms-operation-context"; + + } + + /// + /// Input parameters for the OnNewFile trigger operation (operationId: OnNewFileV2). + /// + public static class OnNewFile + { + /// + /// The unique identifier of the folder. + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// Include items in subfolders + /// Default: false. + /// + public const string IncludeSubfolders = "includeSubfolders"; + + /// + /// A boolean value (true, false) to infer content-type based on extension. + /// Default: true. + /// + public const string InferContentType = "inferContentType"; + + /// + /// Simulate this call. + /// Default: false. + /// + public const string Simulate = "simulate"; + + /// + /// Special header to enable operation simulation + /// + public const string XMsOperationContext = "x-ms-operation-context"; + + } + + /// + /// Input parameters for the OnNewFiles trigger operation (operationId: OnNewFilesV2). + /// + public static class OnNewFiles + { + /// + /// The unique identifier of the folder. + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// Include items in subfolders + /// Default: false. + /// + public const string IncludeSubfolders = "includeSubfolders"; + + /// + /// Maximum number of files to return by single trigger run (1-100). Note that 'Split On' setting can force trigger to process each item individually. + /// Default: 10. + /// + public const string MaxFileCount = "maxFileCount"; + + /// + /// Simulate this call. + /// Default: false. + /// + public const string Simulate = "simulate"; + + /// + /// Special header to enable operation simulation + /// + public const string XMsOperationContext = "x-ms-operation-context"; + + } + + /// + /// Input parameters for the OnUpdatedFile trigger operation (operationId: OnUpdatedFileV2). + /// + public static class OnUpdatedFile + { + /// + /// The unique identifier of the folder. + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// Include items in subfolders + /// Default: false. + /// + public const string IncludeSubfolders = "includeSubfolders"; + + /// + /// Include file content. + /// Default: true. + /// + public const string IncludeFileContent = "includeFileContent"; + + /// + /// A boolean value (true, false) to infer content-type based on extension. + /// Default: true. + /// + public const string InferContentType = "inferContentType"; + + /// + /// Simulate this call. + /// Default: false. + /// + public const string Simulate = "simulate"; + + /// + /// Special header to enable operation simulation + /// + public const string XMsOperationContext = "x-ms-operation-context"; + + } + + /// + /// Input parameters for the OnUpdatedFiles trigger operation (operationId: OnUpdatedFilesV2). + /// + public static class OnUpdatedFiles + { + /// + /// The unique identifier of the folder. + /// Required. + /// + public const string FolderId = "folderId"; + + /// + /// Include items in subfolders + /// Default: false. + /// + public const string IncludeSubfolders = "includeSubfolders"; + + /// + /// Maximum number of files to return by single trigger run (1-100). Note that 'Split On' setting can force trigger to process each item individually. + /// Default: 10. + /// + public const string MaxFileCount = "maxFileCount"; + + /// + /// Simulate this call. + /// Default: false. + /// + public const string Simulate = "simulate"; + + /// + /// Special header to enable operation simulation + /// + public const string XMsOperationContext = "x-ms-operation-context"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for onedrive connector. + /// + public class OneDriveClient : ConnectorClientBase + { + /// + /// Creates a new OneDriveClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public OneDriveClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new OneDriveClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public OneDriveClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new OneDriveClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public OneDriveClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new OneDriveClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public OneDriveClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected OneDriveClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "onedrive"; + + /// + /// Get file metadata + /// + /// This operation gets the metadata for a file. + /// File + /// Cancellation token. + /// The Get file metadata response. + public virtual async Task GetFileMetadataAsync(string @file, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update file + /// + /// This operation updates a file. + /// File + /// The request body. + /// Cancellation token. + /// The Update file response. + public virtual async Task UpdateFileAsync(string @file, byte[] input, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete file + /// + /// This operation deletes a file. + /// File + /// Cancellation token. + public virtual async Task DeleteFileAsync(string @file, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file metadata using path + /// + /// This operation gets the metadata of a file using the path. + /// File Path + /// Cancellation token. + /// The Get file metadata using path response. + public virtual async Task GetFileMetadataByPathAsync(string filePath, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + var path = $"/datasets/default/GetFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file content using path + /// + /// This operation gets the content of a file using the path. + /// File Path + /// Infer Content Type + /// Cancellation token. + /// The Get file content using path response. + public virtual async Task GetFileContentByPathAsync(string filePath, bool? inferContentType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); + var path = $"/datasets/default/GetFileContentByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file content + /// + /// This operation gets the content of a file. + /// File + /// Infer Content Type + /// Cancellation token. + /// The Get file content response. + public virtual async Task GetFileContentAsync(string @file, bool? inferContentType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/content" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create file + /// + /// This operation creates a file. + /// The request body. + /// Folder Path + /// File Name + /// Cancellation token. + /// The Create file response. + public virtual async Task CreateFileAsync(byte[] input, string folderPath, string fileName, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"folderPath={Uri.EscapeDataString(folderPath.ToString())}"); + queryParams.Add($"name={Uri.EscapeDataString(fileName.ToString())}"); + var path = $"/datasets/default/files" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Upload file from URL + /// + /// This operation uploads a file from a URL to OneDrive. + /// Source URL + /// Destination File Path + /// Overwrite + /// Cancellation token. + /// The Upload file from URL response. + public virtual async Task CopyFileAsync(string sourceURL, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"source={Uri.EscapeDataString(sourceURL.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/copyFile" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copy file + /// + /// This operation copies a file within OneDrive. + /// File + /// Destination File Path + /// Overwrite + /// Cancellation token. + /// The Copy file response. + public virtual async Task CopyDriveFileAsync(string @file, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/copy" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copy file using path + /// + /// This operation copies a file within OneDrive by path. + /// File Path + /// Destination File Path + /// Overwrite + /// Cancellation token. + /// The Copy file using path response. + public virtual async Task CopyDriveFileByPathAsync(string filePath, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"source={Uri.EscapeDataString(filePath.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/CopyFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Move or rename a file + /// + /// This operation moves or renames a file. + /// File + /// Destination File Path + /// Overwrite + /// Cancellation token. + /// The Move or rename a file response. + public virtual async Task MoveFileAsync(string @file, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/move" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Move or rename a file using path + /// + /// This operation moves or renames a file using the path. + /// File Path + /// Destination File Path + /// Overwrite + /// Cancellation token. + /// The Move or rename a file using path response. + public virtual async Task MoveFileByPathAsync(string filePath, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"source={Uri.EscapeDataString(filePath.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/MoveFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Convert file + /// + /// This operation converts a file to another format. The list of supported conversions can be found at https://aka.ms/onedriveconversions + /// File + /// Target type + /// Cancellation token. + /// The Convert file response. + public virtual async Task ConvertFileAsync(string @file, string targetType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (targetType != default) + queryParams.Add($"type={Uri.EscapeDataString(targetType.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/convert" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Convert file using path + /// + /// This operation converts a file to another format using the path. The list of supported conversions can be found at https://aka.ms/onedriveconversions + /// File Path + /// Target type + /// Cancellation token. + /// The Convert file using path response. + public virtual async Task ConvertFileByPathAsync(string filePath, string targetType = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + if (targetType != default) + queryParams.Add($"type={Uri.EscapeDataString(targetType.ToString())}"); + var path = $"/datasets/default/ConvertFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file tags + /// + /// This operation gets the tags of a file. + /// File + /// Cancellation token. + /// The Get file tags response. + public virtual async Task GetFileTagsAsync(string @file, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/tags"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add file tag + /// + /// This operation adds a tag to a file. + /// File + /// Tag + /// Cancellation token. + /// The Add file tag response. + public virtual async Task AddFileTagAsync(string @file, string tag, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"tag={Uri.EscapeDataString(tag.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/tags" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Remove file tag + /// + /// This operation removes a tag from a file. + /// File + /// Tag + /// Cancellation token. + public virtual async Task RemoveFileTagAsync(string @file, string tag, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"tag={Uri.EscapeDataString(tag.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/tags" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get file thumbnail + /// + /// This operation gets the thumbnail of a file. The thumbnail will only be valid for 6 hours. + /// File + /// Thumbnail Size + /// Cancellation token. + /// The Get file thumbnail response. + public virtual async Task GetFileThumbnailAsync(string @file, string thumbnailSize, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"size={Uri.EscapeDataString(thumbnailSize.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/thumbnail" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List files in root folder + /// + /// This operation gets the list of files and subfolders in the root folder. + /// Cancellation token. + /// The List files in root folder response. + public virtual async Task> ListRootFolderAsync(CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/folders"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Find files in folder + /// + /// This operation finds files within a folder using search or name pattern match. + /// Folder + /// Search Query + /// File Search Mode + /// Number of files to return + /// Cancellation token. + /// The Find files in folder response. + public virtual async Task> FindFilesAsync(string folder, string searchQuery, string fileSearchMode, int? numberOfFilesToReturn = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"query={Uri.EscapeDataString(searchQuery.ToString())}"); + queryParams.Add($"findMode={Uri.EscapeDataString(fileSearchMode.ToString())}"); + if (numberOfFilesToReturn.HasValue) + queryParams.Add($"maxFileCount={Uri.EscapeDataString(numberOfFilesToReturn.Value.ToString())}"); + var path = $"/datasets/default/folders/{Uri.EscapeDataString(folder.ToString())}/search" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Find files in folder by path + /// + /// This operation finds files within a folder by path using search or name pattern match. + /// Search Query + /// Folder Path + /// File Search Mode + /// Number of files to return + /// Cancellation token. + /// The Find files in folder by path response. + public virtual async Task> FindFilesByPathAsync(string searchQuery, string folderPath, string fileSearchMode, int? numberOfFilesToReturn = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"query={Uri.EscapeDataString(searchQuery.ToString())}"); + queryParams.Add($"path={Uri.EscapeDataString(folderPath.ToString())}"); + queryParams.Add($"findMode={Uri.EscapeDataString(fileSearchMode.ToString())}"); + if (numberOfFilesToReturn.HasValue) + queryParams.Add($"maxFileCount={Uri.EscapeDataString(numberOfFilesToReturn.Value.ToString())}"); + var path = $"/datasets/default/findFile" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create share link + /// + /// This operation creates a share link for a file. + /// File + /// Link type + /// Cancellation token. + /// The Create share link response. + public virtual async Task CreateShareLinkAsync(string @file, string linkType, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"type={Uri.EscapeDataString(linkType.ToString())}"); + var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/shareV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create share link by path + /// + /// This operation creates a share link for a file using the path. + /// File Path + /// Link type + /// Cancellation token. + /// The Create share link by path response. + public virtual async Task CreateShareLinkByPathAsync(string filePath, string linkType, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + queryParams.Add($"type={Uri.EscapeDataString(linkType.ToString())}"); + var path = $"/datasets/default/CreateShareLinkByPathV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Extract archive to folder + /// + /// This operation extracts an archive file into a folder (example: .zip). Maximum archive size is 50 MB and 100 files inside. + /// Source Archive File Path + /// Destination Folder Path + /// Overwrite + /// Cancellation token. + /// The Extract archive to folder response. + public virtual async Task> ExtractFolderAsync(string sourceArchiveFilePath, string destinationFolderPath, bool? overwrite = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"source={Uri.EscapeDataString(sourceArchiveFilePath.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFolderPath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); + var path = $"/datasets/default/extractFolderV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List files in folder + /// + /// This operation gets the list of files and subfolders in a folder. + /// Folder + /// Cancellation token. + /// An async enumerable of items across all pages. + public virtual AsyncPageable ListFolderAsync(string folder, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("top=20"); + var path = $"/datasets/default/foldersV2/{Uri.EscapeDataString(folder.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return this.CreatePageable( + ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), + (nextLink, ct) => this.CallConnectorAsync(HttpMethod.Get, nextLink, cancellationToken: ct), + cancellationToken); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/OneDriveForBusinessExtensions.cs b/src/Azure.Connectors.Sdk/Generated/OneDriveForBusinessExtensions.cs index f1c1c99..2658a79 100644 --- a/src/Azure.Connectors.Sdk/Generated/OneDriveForBusinessExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/OneDriveForBusinessExtensions.cs @@ -564,8 +564,7 @@ await this public virtual async Task GetFileMetadataByPathAsync(string filePath, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (filePath != default) - queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); var path = $"/datasets/default/GetFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -580,13 +579,12 @@ public virtual async Task GetFileMetadataByPathAsync(string filePa /// Infer Content Type /// Cancellation token. /// The Get file content using path response. - public virtual async Task GetFileContentByPathAsync(string filePath, bool inferContentType = default, CancellationToken cancellationToken = default) + public virtual async Task GetFileContentByPathAsync(string filePath, bool? inferContentType = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (filePath != default) - queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); - if (inferContentType != default) - queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.ToString())}"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); var path = $"/datasets/default/GetFileContentByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -601,11 +599,11 @@ public virtual async Task GetFileContentByPathAsync(string filePath, boo /// Infer Content Type /// Cancellation token. /// The Get file content response. - public virtual async Task GetFileContentAsync(string @file, bool inferContentType = default, CancellationToken cancellationToken = default) + public virtual async Task GetFileContentAsync(string @file, bool? inferContentType = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (inferContentType != default) - queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.ToString())}"); + if (inferContentType.HasValue) + queryParams.Add($"inferContentType={Uri.EscapeDataString(inferContentType.Value.ToString())}"); var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/content" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -624,10 +622,8 @@ public virtual async Task GetFileContentAsync(string @file, bool inferCo public virtual async Task CreateFileAsync(byte[] input, string folderPath, string fileName, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (folderPath != default) - queryParams.Add($"folderPath={Uri.EscapeDataString(folderPath.ToString())}"); - if (fileName != default) - queryParams.Add($"name={Uri.EscapeDataString(fileName.ToString())}"); + queryParams.Add($"folderPath={Uri.EscapeDataString(folderPath.ToString())}"); + queryParams.Add($"name={Uri.EscapeDataString(fileName.ToString())}"); var path = $"/datasets/default/files" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) @@ -643,15 +639,13 @@ public virtual async Task CreateFileAsync(byte[] input, string fol /// Overwrite /// Cancellation token. /// The Upload file from URL response. - public virtual async Task CopyFileAsync(string sourceURL, string destinationFilePath, bool overwrite = default, CancellationToken cancellationToken = default) + public virtual async Task CopyFileAsync(string sourceURL, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (sourceURL != default) - queryParams.Add($"source={Uri.EscapeDataString(sourceURL.ToString())}"); - if (destinationFilePath != default) - queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); - if (overwrite != default) - queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(sourceURL.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); var path = $"/datasets/default/copyFile" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -667,13 +661,12 @@ public virtual async Task CopyFileAsync(string sourceURL, string d /// Overwrite /// Cancellation token. /// The Copy file response. - public virtual async Task CopyDriveFileAsync(string @file, string destinationFilePath, bool overwrite = default, CancellationToken cancellationToken = default) + public virtual async Task CopyDriveFileAsync(string @file, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (destinationFilePath != default) - queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); - if (overwrite != default) - queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/copy" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -689,15 +682,13 @@ public virtual async Task CopyDriveFileAsync(string @file, string /// Overwrite /// Cancellation token. /// The Copy file using path response. - public virtual async Task CopyDriveFileByPathAsync(string filePath, string destinationFilePath, bool overwrite = default, CancellationToken cancellationToken = default) + public virtual async Task CopyDriveFileByPathAsync(string filePath, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (filePath != default) - queryParams.Add($"source={Uri.EscapeDataString(filePath.ToString())}"); - if (destinationFilePath != default) - queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); - if (overwrite != default) - queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(filePath.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); var path = $"/datasets/default/CopyFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -713,13 +704,12 @@ public virtual async Task CopyDriveFileByPathAsync(string filePath /// Overwrite /// Cancellation token. /// The Move or rename a file response. - public virtual async Task MoveFileAsync(string @file, string destinationFilePath, bool overwrite = default, CancellationToken cancellationToken = default) + public virtual async Task MoveFileAsync(string @file, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (destinationFilePath != default) - queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); - if (overwrite != default) - queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/move" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -735,15 +725,13 @@ public virtual async Task MoveFileAsync(string @file, string desti /// Overwrite /// Cancellation token. /// The Move or rename a file using path response. - public virtual async Task MoveFileByPathAsync(string filePath, string destinationFilePath, bool overwrite = default, CancellationToken cancellationToken = default) + public virtual async Task MoveFileByPathAsync(string filePath, string destinationFilePath, bool? overwrite = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (filePath != default) - queryParams.Add($"source={Uri.EscapeDataString(filePath.ToString())}"); - if (destinationFilePath != default) - queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); - if (overwrite != default) - queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(filePath.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFilePath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); var path = $"/datasets/default/MoveFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -780,8 +768,7 @@ public virtual async Task ConvertFileAsync(string @file, string targetTy public virtual async Task ConvertFileByPathAsync(string filePath, string targetType = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (filePath != default) - queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); if (targetType != default) queryParams.Add($"type={Uri.EscapeDataString(targetType.ToString())}"); var path = $"/datasets/default/ConvertFileByPath" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); @@ -801,8 +788,7 @@ public virtual async Task ConvertFileByPathAsync(string filePath, string public virtual async Task GetFileThumbnailAsync(string @file, string thumbnailSize, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (thumbnailSize != default) - queryParams.Add($"size={Uri.EscapeDataString(thumbnailSize.ToString())}"); + queryParams.Add($"size={Uri.EscapeDataString(thumbnailSize.ToString())}"); var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/thumbnail" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -833,15 +819,13 @@ public virtual async Task> ListRootFolderAsync(CancellationTo /// Number of files to return /// Cancellation token. /// The Find files in folder response. - public virtual async Task> FindFilesAsync(string folder, string searchQuery, string fileSearchMode, int numberOfFilesToReturn = default, CancellationToken cancellationToken = default) + public virtual async Task> FindFilesAsync(string folder, string searchQuery, string fileSearchMode, int? numberOfFilesToReturn = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (searchQuery != default) - queryParams.Add($"query={Uri.EscapeDataString(searchQuery.ToString())}"); - if (fileSearchMode != default) - queryParams.Add($"findMode={Uri.EscapeDataString(fileSearchMode.ToString())}"); - if (numberOfFilesToReturn != default) - queryParams.Add($"maxFileCount={Uri.EscapeDataString(numberOfFilesToReturn.ToString())}"); + queryParams.Add($"query={Uri.EscapeDataString(searchQuery.ToString())}"); + queryParams.Add($"findMode={Uri.EscapeDataString(fileSearchMode.ToString())}"); + if (numberOfFilesToReturn.HasValue) + queryParams.Add($"maxFileCount={Uri.EscapeDataString(numberOfFilesToReturn.Value.ToString())}"); var path = $"/datasets/default/folders/{Uri.EscapeDataString(folder.ToString())}/search" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -858,17 +842,14 @@ public virtual async Task> FindFilesAsync(string folder, stri /// Number of files to return /// Cancellation token. /// The Find files in folder by path response. - public virtual async Task> FindFilesByPathAsync(string searchQuery, string folderPath, string fileSearchMode, int numberOfFilesToReturn = default, CancellationToken cancellationToken = default) + public virtual async Task> FindFilesByPathAsync(string searchQuery, string folderPath, string fileSearchMode, int? numberOfFilesToReturn = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (searchQuery != default) - queryParams.Add($"query={Uri.EscapeDataString(searchQuery.ToString())}"); - if (folderPath != default) - queryParams.Add($"path={Uri.EscapeDataString(folderPath.ToString())}"); - if (fileSearchMode != default) - queryParams.Add($"findMode={Uri.EscapeDataString(fileSearchMode.ToString())}"); - if (numberOfFilesToReturn != default) - queryParams.Add($"maxFileCount={Uri.EscapeDataString(numberOfFilesToReturn.ToString())}"); + queryParams.Add($"query={Uri.EscapeDataString(searchQuery.ToString())}"); + queryParams.Add($"path={Uri.EscapeDataString(folderPath.ToString())}"); + queryParams.Add($"findMode={Uri.EscapeDataString(fileSearchMode.ToString())}"); + if (numberOfFilesToReturn.HasValue) + queryParams.Add($"maxFileCount={Uri.EscapeDataString(numberOfFilesToReturn.Value.ToString())}"); var path = $"/datasets/default/findFile" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -887,8 +868,7 @@ public virtual async Task> FindFilesByPathAsync(string search public virtual async Task CreateShareLinkAsync(string @file, string linkType, string linkScope = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (linkType != default) - queryParams.Add($"type={Uri.EscapeDataString(linkType.ToString())}"); + queryParams.Add($"type={Uri.EscapeDataString(linkType.ToString())}"); if (linkScope != default) queryParams.Add($"scope={Uri.EscapeDataString(linkScope.ToString())}"); var path = $"/datasets/default/files/{Uri.EscapeDataString(@file.ToString())}/shareV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); @@ -909,10 +889,8 @@ public virtual async Task CreateShareLinkAsync(string @file, string public virtual async Task CreateShareLinkByPathAsync(string filePath, string linkType, string linkScope = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (filePath != default) - queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); - if (linkType != default) - queryParams.Add($"type={Uri.EscapeDataString(linkType.ToString())}"); + queryParams.Add($"path={Uri.EscapeDataString(filePath.ToString())}"); + queryParams.Add($"type={Uri.EscapeDataString(linkType.ToString())}"); if (linkScope != default) queryParams.Add($"scope={Uri.EscapeDataString(linkScope.ToString())}"); var path = $"/datasets/default/CreateShareLinkByPathV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); @@ -930,15 +908,13 @@ public virtual async Task CreateShareLinkByPathAsync(string filePat /// Overwrite /// Cancellation token. /// The Extract archive to folder response. - public virtual async Task> ExtractFolderAsync(string sourceArchiveFilePath, string destinationFolderPath, bool overwrite = default, CancellationToken cancellationToken = default) + public virtual async Task> ExtractFolderAsync(string sourceArchiveFilePath, string destinationFolderPath, bool? overwrite = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (sourceArchiveFilePath != default) - queryParams.Add($"source={Uri.EscapeDataString(sourceArchiveFilePath.ToString())}"); - if (destinationFolderPath != default) - queryParams.Add($"destination={Uri.EscapeDataString(destinationFolderPath.ToString())}"); - if (overwrite != default) - queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.ToString())}"); + queryParams.Add($"source={Uri.EscapeDataString(sourceArchiveFilePath.ToString())}"); + queryParams.Add($"destination={Uri.EscapeDataString(destinationFolderPath.ToString())}"); + if (overwrite.HasValue) + queryParams.Add($"overwrite={Uri.EscapeDataString(overwrite.Value.ToString())}"); var path = $"/datasets/default/extractFolderV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync>(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -955,7 +931,6 @@ public virtual async Task> ExtractFolderAsync(string sourceAr public virtual AsyncPageable ListFolderAsync(string folder, CancellationToken cancellationToken = default) { var queryParams = new List(); - queryParams.Add("skipToken="); queryParams.Add("top=20"); var path = $"/datasets/default/foldersV2/{Uri.EscapeDataString(folder.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return this.CreatePageable( diff --git a/src/Azure.Connectors.Sdk/Generated/PipedriveExtensions.cs b/src/Azure.Connectors.Sdk/Generated/PipedriveExtensions.cs index 92ebde2..001cc4e 100644 --- a/src/Azure.Connectors.Sdk/Generated/PipedriveExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/PipedriveExtensions.cs @@ -24,6 +24,107 @@ namespace Azure.Connectors.Sdk.Pipedrive.Models #region Types + /// + /// Response for When a new activity is added + /// + public class ActivityResponse + { + /// Unique id of the activity. + [JsonPropertyName("id")] + public int? ActivityId { get; set; } + + /// Id of the user whom the activity is assigned to. + [JsonPropertyName("user_id")] + public int? UserId { get; set; } + + /// 0 = Not done, 1 = Done + [JsonPropertyName("done")] + public bool? IsDone { get; set; } + + /// Type of the activity. + [JsonPropertyName("type")] + public string Type { get; set; } + + /// YYYY-MM-DD + [JsonPropertyName("due_date")] + public string DueDate { get; set; } + + /// HH:MM + [JsonPropertyName("due_time")] + public string DueTime { get; set; } + + /// HH:MM + [JsonPropertyName("duration")] + public string Duration { get; set; } + + /// Subject of the activity. + [JsonPropertyName("subject")] + public string Subject { get; set; } + + /// Id of deal the activity is associated with. + [JsonPropertyName("deal_id")] + public int? DealId { get; set; } + + /// Title of deal the activity is associated with. + [JsonPropertyName("deal_title")] + public string DealTitle { get; set; } + + /// Id of organization the activity is associated with. + [JsonPropertyName("org_id")] + public int? OrganizationId { get; set; } + + /// Name of organization the activity is associated with. + [JsonPropertyName("org_name")] + public string OrganizationName { get; set; } + + /// Id of person the activity is associated with. + [JsonPropertyName("person_id")] + public int? ContactId { get; set; } + + /// Name of person the activity is associated with. + [JsonPropertyName("person_name")] + public string ContactName { get; set; } + + /// yyyy-MM-ddTHH:mm:ss.fffZ + [JsonPropertyName("add_time")] + [JsonInclude] + public DateTime? CreatedDateTime { get; internal set; } + + /// yyyy-MM-ddTHH:mm:ss.fffZ + [JsonPropertyName("update_time")] + [JsonInclude] + public DateTime? UpdatedDateTime { get; internal set; } + + /// yyyy-MM-ddTHH:mm:ss.fffZ + [JsonPropertyName("marked_as_done_time")] + [JsonInclude] + public DateTime? CompletedDateTime { get; internal set; } + + /// Id of the google calendar event. + [JsonPropertyName("gcal_event_id")] + public string GoogleCalendarEventId { get; set; } + + /// Id of the google calendar. + [JsonPropertyName("google_calendar_id")] + public string GoogleCalendarId { get; set; } + + /// Note of the activity (HTML format). + [JsonPropertyName("note")] + public string Note { get; set; } + + /// User id of user whom the activity is assigned to. + [JsonPropertyName("assigned_to_user_id")] + public int? AssignedTo { get; set; } + + /// User id of user that created the activity. + [JsonPropertyName("created_by_user_id")] + public int? CreatedBy { get; set; } + + /// Name of the activity owner. + [JsonPropertyName("owner_name")] + public string OwnerName { get; set; } + } + /// /// Response for List deals /// @@ -204,107 +305,6 @@ public class DealResponse public string NextActivityNote { get; set; } } - /// - /// Response for Add activity - /// - public class ActivityResponse - { - /// Unique id of the activity. - [JsonPropertyName("id")] - public int? ActivityId { get; set; } - - /// Id of the user whom the activity is assigned to. - [JsonPropertyName("user_id")] - public int? UserId { get; set; } - - /// 0 = Not done, 1 = Done - [JsonPropertyName("done")] - public bool? IsDone { get; set; } - - /// Type of the activity. - [JsonPropertyName("type")] - public string Type { get; set; } - - /// YYYY-MM-DD - [JsonPropertyName("due_date")] - public string DueDate { get; set; } - - /// HH:MM - [JsonPropertyName("due_time")] - public string DueTime { get; set; } - - /// HH:MM - [JsonPropertyName("duration")] - public string Duration { get; set; } - - /// Subject of the activity. - [JsonPropertyName("subject")] - public string Subject { get; set; } - - /// Id of deal the activity is associated with. - [JsonPropertyName("deal_id")] - public int? DealId { get; set; } - - /// Title of deal the activity is associated with. - [JsonPropertyName("deal_title")] - public string DealTitle { get; set; } - - /// Id of organization the activity is associated with. - [JsonPropertyName("org_id")] - public int? OrganizationId { get; set; } - - /// Name of organization the activity is associated with. - [JsonPropertyName("org_name")] - public string OrganizationName { get; set; } - - /// Id of person the activity is associated with. - [JsonPropertyName("person_id")] - public int? ContactId { get; set; } - - /// Name of person the activity is associated with. - [JsonPropertyName("person_name")] - public string ContactName { get; set; } - - /// yyyy-MM-ddTHH:mm:ss.fffZ - [JsonPropertyName("add_time")] - [JsonInclude] - public DateTime? CreatedDateTime { get; internal set; } - - /// yyyy-MM-ddTHH:mm:ss.fffZ - [JsonPropertyName("update_time")] - [JsonInclude] - public DateTime? UpdatedDateTime { get; internal set; } - - /// yyyy-MM-ddTHH:mm:ss.fffZ - [JsonPropertyName("marked_as_done_time")] - [JsonInclude] - public DateTime? CompletedDateTime { get; internal set; } - - /// Id of the google calendar event. - [JsonPropertyName("gcal_event_id")] - public string GoogleCalendarEventId { get; set; } - - /// Id of the google calendar. - [JsonPropertyName("google_calendar_id")] - public string GoogleCalendarId { get; set; } - - /// Note of the activity (HTML format). - [JsonPropertyName("note")] - public string Note { get; set; } - - /// User id of user whom the activity is assigned to. - [JsonPropertyName("assigned_to_user_id")] - public int? AssignedTo { get; set; } - - /// User id of user that created the activity. - [JsonPropertyName("created_by_user_id")] - public int? CreatedBy { get; set; } - - /// Name of the activity owner. - [JsonPropertyName("owner_name")] - public string OwnerName { get; set; } - } - /// /// Response for Get stage by id /// @@ -506,6 +506,62 @@ public VisibleToJsonConverter() { } /// public static class PipedriveModelFactory { + /// + /// Creates a new instance of . + /// + public static ActivityResponse ActivityResponse( + int? activityId = default, + int? userId = default, + bool? isDone = default, + string type = default, + string dueDate = default, + string dueTime = default, + string duration = default, + string subject = default, + int? dealId = default, + string dealTitle = default, + int? organizationId = default, + string organizationName = default, + int? contactId = default, + string contactName = default, + DateTime? createdDateTime = default, + DateTime? updatedDateTime = default, + DateTime? completedDateTime = default, + string googleCalendarEventId = default, + string googleCalendarId = default, + string note = default, + int? assignedTo = default, + int? createdBy = default, + string ownerName = default) + { + return new ActivityResponse + { + ActivityId = activityId, + UserId = userId, + IsDone = isDone, + Type = type, + DueDate = dueDate, + DueTime = dueTime, + Duration = duration, + Subject = subject, + DealId = dealId, + DealTitle = dealTitle, + OrganizationId = organizationId, + OrganizationName = organizationName, + ContactId = contactId, + ContactName = contactName, + CreatedDateTime = createdDateTime, + UpdatedDateTime = updatedDateTime, + CompletedDateTime = completedDateTime, + GoogleCalendarEventId = googleCalendarEventId, + GoogleCalendarId = googleCalendarId, + Note = note, + AssignedTo = assignedTo, + CreatedBy = createdBy, + OwnerName = ownerName, + }; + } + /// /// Creates a new instance of . /// @@ -608,62 +664,6 @@ public static DealResponse DealResponse( }; } - /// - /// Creates a new instance of . - /// - public static ActivityResponse ActivityResponse( - int? activityId = default, - int? userId = default, - bool? isDone = default, - string type = default, - string dueDate = default, - string dueTime = default, - string duration = default, - string subject = default, - int? dealId = default, - string dealTitle = default, - int? organizationId = default, - string organizationName = default, - int? contactId = default, - string contactName = default, - DateTime? createdDateTime = default, - DateTime? updatedDateTime = default, - DateTime? completedDateTime = default, - string googleCalendarEventId = default, - string googleCalendarId = default, - string note = default, - int? assignedTo = default, - int? createdBy = default, - string ownerName = default) - { - return new ActivityResponse - { - ActivityId = activityId, - UserId = userId, - IsDone = isDone, - Type = type, - DueDate = dueDate, - DueTime = dueTime, - Duration = duration, - Subject = subject, - DealId = dealId, - DealTitle = dealTitle, - OrganizationId = organizationId, - OrganizationName = organizationName, - ContactId = contactId, - ContactName = contactName, - CreatedDateTime = createdDateTime, - UpdatedDateTime = updatedDateTime, - CompletedDateTime = completedDateTime, - GoogleCalendarEventId = googleCalendarEventId, - GoogleCalendarId = googleCalendarId, - Note = note, - AssignedTo = assignedTo, - CreatedBy = createdBy, - OwnerName = ownerName, - }; - } - /// /// Creates a new instance of . /// @@ -773,6 +773,43 @@ public static UpdateDealStatusRequest UpdateDealStatusRequest( #region Trigger Payloads + /// + /// Typed trigger payload for the OnTrigNewActivity trigger (Pipedrive "When a new activity is added", operationId: TrigNewActivity). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<PipedriveOnTrigNewActivityTriggerPayload>(body). + /// + public class PipedriveOnTrigNewActivityTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnTrigNewDeal trigger (Pipedrive "When a new deal is added (V2)", operationId: TrigNewDealV2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<PipedriveOnTrigNewDealTriggerPayload>(body). + /// + public class PipedriveOnTrigNewDealTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Pipedrive connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class PipedriveTriggers + { + /// + /// Trigger operations with typed payloads for the Pipedrive connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["TrigNewActivity"] = typeof(PipedriveOnTrigNewActivityTriggerPayload), + ["TrigNewDealV2"] = typeof(PipedriveOnTrigNewDealTriggerPayload), + }); + } + #endregion Trigger Payloads } @@ -791,11 +828,13 @@ public static class PipedriveTriggerOperations { /// /// When a new activity is added. + /// Payload type: . /// public const string OnTrigNewActivity = "TrigNewActivity"; /// /// When a new deal is added (V2). + /// Payload type: . /// public const string OnTrigNewDeal = "TrigNewDealV2"; diff --git a/src/Azure.Connectors.Sdk/Generated/PlannerExtensions.cs b/src/Azure.Connectors.Sdk/Generated/PlannerExtensions.cs index 27f2630..f817d6f 100644 --- a/src/Azure.Connectors.Sdk/Generated/PlannerExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/PlannerExtensions.cs @@ -337,72 +337,6 @@ public class ListTasksResponse : IPageable public string NextLink { get; set; } } - /// - /// Item in value - /// - public class GetTaskResponseV2 - { - /// createdBy - [JsonPropertyName("createdBy")] - public object CreatedBy { get; set; } - - /// The id of the plan this task belongs to. - [JsonPropertyName("planId")] - public string PlanId { get; set; } - - /// The id of the bucket this task belongs to. - [JsonPropertyName("bucketId")] - public string BucketId { get; set; } - - /// The title of the task. - [JsonPropertyName("title")] - public string Title { get; set; } - - /// The completion percentage of the task. - [JsonPropertyName("percentComplete")] - public int? PercentComplete { get; set; } - - /// The start datetime of the task. - [JsonPropertyName("startDateTime")] - [JsonInclude] - public DateTime? StartDateTime { get; internal set; } - - /// The datetime the task was created. - [JsonPropertyName("createdDateTime")] - [JsonInclude] - public DateTime? CreatedDateTime { get; internal set; } - - /// The datetime the task is due. - [JsonPropertyName("dueDateTime")] - [JsonInclude] - public DateTime? DueDateTime { get; internal set; } - - /// Set to true if the task has a description. - [JsonPropertyName("hasDescription")] - public bool? HasDescription { get; set; } - - /// The datetime the task was completed. - [JsonPropertyName("completedDateTime")] - [JsonInclude] - public DateTime? CompletedDateTime { get; internal set; } - - /// The number of external references that exist on the task. - [JsonPropertyName("referenceCount")] - public int? ReferenceCount { get; set; } - - /// The id of the task. - [JsonPropertyName("id")] - public string Id { get; set; } - - /// appliedCategories - [JsonPropertyName("appliedCategories")] - public AppliedCategories AppliedCategories { get; set; } - - /// _assignments - [JsonPropertyName("_assignments")] - public List Assignments { get; set; } - } - /// /// UpdateTaskDetails_Request /// @@ -746,44 +680,6 @@ public static ListTasksResponse ListTasksResponse( }; } - /// - /// Creates a new instance of . - /// - public static GetTaskResponseV2 GetTaskResponseV2( - object createdBy = default, - string planId = default, - string bucketId = default, - string title = default, - int? percentComplete = default, - DateTime? startDateTime = default, - DateTime? createdDateTime = default, - DateTime? dueDateTime = default, - bool? hasDescription = default, - DateTime? completedDateTime = default, - int? referenceCount = default, - string id = default, - AppliedCategories appliedCategories = default, - List assignments = default) - { - return new GetTaskResponseV2 - { - CreatedBy = createdBy, - PlanId = planId, - BucketId = bucketId, - Title = title, - PercentComplete = percentComplete, - StartDateTime = startDateTime, - CreatedDateTime = createdDateTime, - DueDateTime = dueDateTime, - HasDescription = hasDescription, - CompletedDateTime = completedDateTime, - ReferenceCount = referenceCount, - Id = id, - AppliedCategories = appliedCategories, - Assignments = assignments, - }; - } - /// /// Creates a new instance of . /// @@ -1192,8 +1088,7 @@ public virtual async Task GetTaskDetailsAsync([DynamicVa public virtual async Task ListBucketsAsync([DynamicValues("ListGroupPlans")] string planId, [DynamicValues("ListGroups")] string groupId, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (groupId != default) - queryParams.Add($"groupId={Uri.EscapeDataString(groupId.ToString())}"); + queryParams.Add($"groupId={Uri.EscapeDataString(groupId.ToString())}"); var path = $"/v2/v1.0/planner/plans/{Uri.EscapeDataString(planId.ToString())}/buckets" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -1226,8 +1121,7 @@ public virtual AsyncPageable ListMyTasksAsync(CancellationToken public virtual AsyncPageable ListTasksAsync([DynamicValues("ListGroupPlans")] string planId, [DynamicValues("ListGroups")] string groupId, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (groupId != default) - queryParams.Add($"groupId={Uri.EscapeDataString(groupId.ToString())}"); + queryParams.Add($"groupId={Uri.EscapeDataString(groupId.ToString())}"); var path = $"/v2/v1.0/planner/plans/{Uri.EscapeDataString(planId.ToString())}/tasks" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), diff --git a/src/Azure.Connectors.Sdk/Generated/PlumsailExtensions.cs b/src/Azure.Connectors.Sdk/Generated/PlumsailExtensions.cs index c75b409..bbca3ee 100644 --- a/src/Azure.Connectors.Sdk/Generated/PlumsailExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/PlumsailExtensions.cs @@ -887,6 +887,7 @@ public class ProcessJsonData /// [JsonExtensionData] public Dictionary AdditionalProperties { get; set; } = new(); + /// JSON data that should be applied to the template [JsonPropertyName("jsonContent")] public object TemplateData { get; set; } @@ -5974,8 +5975,7 @@ protected PlumsailClient() : this(new Uri("https://localhost")) { } public virtual async Task FlowV1DocumentsFlowSchemaAddWatermarkToPdfAsync(string type, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (type != default) - queryParams.Add($"type={Uri.EscapeDataString(type.ToString())}"); + queryParams.Add($"type={Uri.EscapeDataString(type.ToString())}"); var path = $"/flow/v1/DocumentsFlow/Schema/AddWatermarkToPdf" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -5991,8 +5991,7 @@ await this public virtual async Task FlowV1DocumentsFlowSchemaRegExpMatchAsync(string pattern, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (pattern != default) - queryParams.Add($"pattern={Uri.EscapeDataString(pattern.ToString())}"); + queryParams.Add($"pattern={Uri.EscapeDataString(pattern.ToString())}"); var path = $"/flow/v1/DocumentsFlow/Schema/RegExpMatch" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -6008,8 +6007,7 @@ await this public virtual async Task FlowV1DocumentsFlowSchemaParseCsvAsync(string headers, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (headers != default) - queryParams.Add($"headers={Uri.EscapeDataString(headers.ToString())}"); + queryParams.Add($"headers={Uri.EscapeDataString(headers.ToString())}"); var path = $"/flow/v1/DocumentsFlow/Schema/ParseCsv" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -6025,8 +6023,7 @@ await this public virtual async Task FlowV1DocumentsFlowSchemaSplitPdfAsync(string typeOfSplit, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (typeOfSplit != default) - queryParams.Add($"type={Uri.EscapeDataString(typeOfSplit.ToString())}"); + queryParams.Add($"type={Uri.EscapeDataString(typeOfSplit.ToString())}"); var path = $"/flow/v1/DocumentsFlow/Schema/SplitPdf" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -6055,8 +6052,7 @@ await this public virtual async Task FlowV1ProcessesFlowSchemaGetJsonDataAsync([DynamicValues("FlowV1ProcessesFlowSchemaGetProcessesPost")] string processName, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (processName != default) - queryParams.Add($"processId={Uri.EscapeDataString(processName.ToString())}"); + queryParams.Add($"processId={Uri.EscapeDataString(processName.ToString())}"); var path = $"/flow/v1/ProcessesFlow/Schema/GetJsonData" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -6327,8 +6323,7 @@ public virtual async Task FlowV1DocumentsJobsPpt2PptxAsync(Ppt2PptxReque public virtual async Task FlowV1DocumentsJobsSplitPdfV2Async(FlowV1DocumentsJobsSplitPdfV2Input input, string typeOfSplit, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (typeOfSplit != default) - queryParams.Add($"type={Uri.EscapeDataString(typeOfSplit.ToString())}"); + queryParams.Add($"type={Uri.EscapeDataString(typeOfSplit.ToString())}"); var path = $"/flow/v1/Documents/jobs/SplitPdfV2" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) @@ -6481,8 +6476,7 @@ public virtual async Task FlowV1DocumentsJobsCompressPdfAsync(CompressPd public virtual async Task FlowV1DocumentsJobsAddWatermarkToPdfAsync(FlowV1DocumentsJobsAddWatermarkToPdfInput input, string type, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (type != default) - queryParams.Add($"type={Uri.EscapeDataString(type.ToString())}"); + queryParams.Add($"type={Uri.EscapeDataString(type.ToString())}"); var path = $"/flow/v1/Documents/jobs/AddWatermarkToPdf" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) @@ -6665,8 +6659,7 @@ public virtual async Task FlowV1DocumentsJobsMergeXl public virtual async Task FlowV1ProcessesFlowJobsExecuteProcessAsync(FlowV1ProcessesFlowJobsExecuteProcessInput input, [DynamicValues("FlowV1ProcessesFlowSchemaGetProcessesPost")] string processName, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (processName != default) - queryParams.Add($"processId={Uri.EscapeDataString(processName.ToString())}"); + queryParams.Add($"processId={Uri.EscapeDataString(processName.ToString())}"); var path = $"/flow/v1/ProcessesFlow/jobs/ExecuteProcess" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) @@ -6684,8 +6677,7 @@ public virtual async Task FlowV1ProcessesFlowJobsExecuteProcessAsync(Flo public virtual async Task FlowV1ProcessesFlowJobsExecuteProcessWithGeneratedDataAsync(ProcessJsonData input, [DynamicValues("FlowV1ProcessesFlowSchemaGetProcessesPost")] string processName, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (processName != default) - queryParams.Add($"processId={Uri.EscapeDataString(processName.ToString())}"); + queryParams.Add($"processId={Uri.EscapeDataString(processName.ToString())}"); var path = $"/flow/v1/ProcessesFlow/jobs/ExecuteProcessWithGeneratedData" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) diff --git a/src/Azure.Connectors.Sdk/Generated/RssExtensions.cs b/src/Azure.Connectors.Sdk/Generated/RssExtensions.cs new file mode 100644 index 0000000..9e670d8 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/RssExtensions.cs @@ -0,0 +1,300 @@ +// RssExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Rss.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Rss.Models +{ + + #region Types + + /// + /// Response for When a feed item is published + /// + public class TriggerBatchResponseFeedItem + { + /// A list of the response objects + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in A list of the response objects + /// + public class FeedItem + { + /// Feed ID + [JsonPropertyName("id")] + public string FeedId { get; set; } + + /// Feed title + [JsonPropertyName("title")] + public string FeedTitle { get; set; } + + /// Primary feed link + [JsonPropertyName("primaryLink")] + public string PrimaryFeedLink { get; set; } + + /// Feed links + [JsonPropertyName("links")] + public List FeedLinks { get; set; } + + /// Feed updated on + [JsonPropertyName("updatedOn")] + public string FeedUpdatedOn { get; set; } + + /// Feed published date + [JsonPropertyName("publishDate")] + public string FeedPublishedOn { get; set; } + + /// Feed item summary + [JsonPropertyName("summary")] + public string FeedSummary { get; set; } + + /// Copyright information + [JsonPropertyName("copyright")] + public string FeedCopyrightInformation { get; set; } + + /// Feed item categories + [JsonPropertyName("categories")] + public List FeedCategories { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Rss models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class RssModelFactory + { + /// + /// Creates a new instance of . + /// + public static TriggerBatchResponseFeedItem TriggerBatchResponseFeedItem( + List value = default) + { + return new TriggerBatchResponseFeedItem + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static FeedItem FeedItem( + string feedId = default, + string feedTitle = default, + string primaryFeedLink = default, + List feedLinks = default, + string feedUpdatedOn = default, + string feedPublishedOn = default, + string feedSummary = default, + string feedCopyrightInformation = default, + List feedCategories = default) + { + return new FeedItem + { + FeedId = feedId, + FeedTitle = feedTitle, + PrimaryFeedLink = primaryFeedLink, + FeedLinks = feedLinks, + FeedUpdatedOn = feedUpdatedOn, + FeedPublishedOn = feedPublishedOn, + FeedSummary = feedSummary, + FeedCopyrightInformation = feedCopyrightInformation, + FeedCategories = feedCategories, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnNewFeed trigger (Rss "When a feed item is published", operationId: OnNewFeed). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<RssOnNewFeedTriggerPayload>(body). + /// + public class RssOnNewFeedTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Rss connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class RssTriggers + { + /// + /// Trigger operations with typed payloads for the Rss connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnNewFeed"] = typeof(RssOnNewFeedTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Rss +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Rss connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class RssTriggerOperations + { + /// + /// When a feed item is published. + /// Payload type: . + /// + public const string OnNewFeed = "OnNewFeed"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Rss connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class RssTriggerParameters + { + /// + /// Input parameters for the OnNewFeed trigger operation (operationId: OnNewFeed). + /// + public static class OnNewFeed + { + /// + /// The RSS feed URL (Example: http://rss.cnn.com/rss/cnn_topstories.rss). + /// Required. + /// + public const string FeedUrl = "feedUrl"; + + /// + /// Chosen property will be used for trigger state. + /// Default: PublishDate. + /// Allowed values: PublishDate, UpdatedOn. + /// + public const string SinceProperty = "sinceProperty"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for rss connector. + /// + public class RssClient : ConnectorClientBase + { + /// + /// Creates a new RssClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public RssClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new RssClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public RssClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new RssClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public RssClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new RssClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public RssClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected RssClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "rss"; + + /// + /// List all RSS feed items + /// + /// This operation retrieves all items from an RSS feed. + /// The RSS feed URL + /// since + /// Chosen property will be used to determine which items are new. + /// Cancellation token. + /// The List all RSS feed items response. + public virtual async Task> ListFeedItemsAsync(string theRSSFeedURL, string since = default, string chosenPropertyWillBeUsedToDetermineWhichItemsAreNew = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"feedUrl={Uri.EscapeDataString(theRSSFeedURL.ToString())}"); + if (since != default) + queryParams.Add($"since={Uri.EscapeDataString(since.ToString())}"); + if (chosenPropertyWillBeUsedToDetermineWhichItemsAreNew != default) + queryParams.Add($"sinceProperty={Uri.EscapeDataString(chosenPropertyWillBeUsedToDetermineWhichItemsAreNew.ToString())}"); + var path = $"/ListFeedItems" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/SalesforceExtensions.cs b/src/Azure.Connectors.Sdk/Generated/SalesforceExtensions.cs new file mode 100644 index 0000000..429734d --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/SalesforceExtensions.cs @@ -0,0 +1,2237 @@ +// SalesforceExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Salesforce.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Salesforce.Models +{ + + #region Types + + /// + /// Response for Get object metadata + /// + public class TableMetadata + { + /// Table name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Table title + [JsonPropertyName("title")] + public string Title { get; set; } + + /// Table permission + [JsonPropertyName("x-ms-permission")] + public string XMsPermission { get; set; } + + /// x-ms-capabilities + [JsonPropertyName("x-ms-capabilities")] + public TableCapabilitiesMetadata XMsCapabilities { get; set; } + + /// schema + [JsonPropertyName("schema")] + public ObjectEntity Schema { get; set; } + + /// referencedEntities + [JsonPropertyName("referencedEntities")] + public ObjectEntity ReferencedEntities { get; set; } + + /// URL link + [JsonPropertyName("webUrl")] + public string WebUrl { get; set; } + } + + /// + /// x-ms-capabilities + /// + public class TableCapabilitiesMetadata + { + /// sortRestrictions + [JsonPropertyName("sortRestrictions")] + public TableSortRestrictionsMetadata SortRestrictions { get; set; } + + /// filterRestrictions + [JsonPropertyName("filterRestrictions")] + public TableFilterRestrictionsMetadata FilterRestrictions { get; set; } + + /// selectRestrictions + [JsonPropertyName("selectRestrictions")] + public TableSelectRestrictionsMetadata SelectRestrictions { get; set; } + + /// Server paging restrictions + [JsonPropertyName("isOnlyServerPagable")] + public bool? IsOnlyServerPagable { get; set; } + + /// List of supported filter capabilities + [JsonPropertyName("filterFunctionSupport")] + public List FilterFunctionSupport { get; set; } + + /// List of supported server-driven paging capabilities + [JsonPropertyName("serverPagingOptions")] + public List ServerPagingOptions { get; set; } + } + + /// + /// sortRestrictions + /// + public class TableSortRestrictionsMetadata + { + /// Indicates whether this table has sortable columns + [JsonPropertyName("sortable")] + public bool? Sortable { get; set; } + + /// List of unsortable properties + [JsonPropertyName("unsortableProperties")] + public List UnsortableProperties { get; set; } + + /// List of properties which support ascending order only + [JsonPropertyName("ascendingOnlyProperties")] + public List AscendingOnlyProperties { get; set; } + } + + /// + /// filterRestrictions + /// + public class TableFilterRestrictionsMetadata + { + /// Indicates whether this table has filterable columns + [JsonPropertyName("filterable")] + public bool? Filterable { get; set; } + + /// List of non filterable properties + [JsonPropertyName("nonFilterableProperties")] + public List NonFilterableProperties { get; set; } + + /// List of required properties + [JsonPropertyName("requiredProperties")] + public List RequiredProperties { get; set; } + } + + /// + /// selectRestrictions + /// + public class TableSelectRestrictionsMetadata + { + /// Indicates whether this table has selectable columns + [JsonPropertyName("selectable")] + public bool? Selectable { get; set; } + } + + /// + /// schema + /// + public class ObjectEntity + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get object types + /// + public class TablesList + { + /// List of Tables + [JsonPropertyName("value")] + public List
Value { get; set; } + } + + /// + /// Item in List of Tables + /// + public class Table + { + /// The name of the table. The name is used at runtime. + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// The display name of the table. + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + + /// Additional table properties provided by the connector to the clients. + [JsonPropertyName("DynamicProperties")] + [JsonInclude] + public object DynamicProperties { get; internal set; } + } + + /// + /// Response for Get External ID Fields + /// + public class ExternalIdFieldsList + { + /// List of external ID fields. + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in List of external ID fields. + /// + public class ExternalIdField + { + /// Name of the external ID field, used at runtime. + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// Display name of the external ID field. + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + } + + /// + /// Response for Get a Record by External ID + /// + [DynamicSchema("GetMetadataForGetItem")] + public class GetItemByExternalIdResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get records + /// + public class ItemsList + { + /// List of Items + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in List of Items + /// + [DynamicSchema("GetTable")] + public class Item + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + + /// dynamicProperties + [JsonPropertyName("dynamicProperties")] + public object DynamicProperties { get; set; } + } + + /// + /// Response for Get all jobs + /// + public class GetAllJobsResponse + { + /// Done + [JsonPropertyName("done")] + public bool? Done { get; set; } + + /// records + [JsonPropertyName("records")] + public List Records { get; set; } + + /// Next Record URL + [JsonPropertyName("nextRecordUrl")] + public string NextRecoredURL { get; set; } + } + + /// + /// Item in records + /// + public class JobInfo + { + /// API Version + [JsonPropertyName("apiVersion")] + public float? APIVersion { get; set; } + + /// Column Delimiter + [JsonPropertyName("columnDelimiter")] + public ColumnDelimiter? ColumnDelimiter { get; set; } + + /// Concurrency Mode + [JsonPropertyName("concurrencyMode")] + public ConcurrencyMode? ConcurrencyMode { get; set; } + + /// Content Type + [JsonPropertyName("contentType")] + public string ContentType { get; set; } + + /// Content URL + [JsonPropertyName("contentUrl")] + public string ContentURL { get; set; } + + /// Created By ID + [JsonPropertyName("createdById")] + public string CreatedById { get; set; } + + /// Created Date + [JsonPropertyName("createdDate")] + public DateTime? CreatedDate { get; set; } + + /// External ID Field Name + [JsonPropertyName("externalIdFieldName")] + public string ExternalIdFieldName { get; set; } + + /// ID + [JsonPropertyName("id")] + public string Id { get; set; } + + /// Job Type + [JsonPropertyName("jobType")] + public JobType? JobType { get; set; } + + /// Line Ending + [JsonPropertyName("lineEnding")] + public LineEnding? LineEnding { get; set; } + + /// Object + [JsonPropertyName("object")] + public string ObjectEntity { get; set; } + + /// Operation + [JsonPropertyName("operation")] + public Operation? Operation { get; set; } + + /// State + [JsonPropertyName("state")] + public string State { get; set; } + + /// System Mod Stamp + [JsonPropertyName("systemModstamp")] + public DateTime? SystemModStamp { get; set; } + } + + /// + /// Response for Get job info + /// + public class CheckJobResponse + { + /// APEX Processing Time + [JsonPropertyName("apexProcessingTime")] + public double? APEXProcessingTime { get; set; } + + /// API Active Processing Time + [JsonPropertyName("apiActiveProcessingTime")] + public double? APIActiveProcessingTime { get; set; } + + /// API Version + [JsonPropertyName("apiVersion")] + public float? APIVersion { get; set; } + + /// Column Delimiter + [JsonPropertyName("columnDelimiter")] + public ColumnDelimiter? ColumnDelimiter { get; set; } + + /// Concurrency Mode + [JsonPropertyName("concurrencyMode")] + public ConcurrencyMode? ConcurrencyMode { get; set; } + + /// Content Type + [JsonPropertyName("contentType")] + public string ContentType { get; set; } + + /// Content URL + [JsonPropertyName("contentUrl")] + public string ContentURL { get; set; } + + /// Created By ID + [JsonPropertyName("createdById")] + public string CreatedById { get; set; } + + /// Created Date + [JsonPropertyName("createdDate")] + public DateTime? CreatedDate { get; set; } + + /// External Field Name + [JsonPropertyName("externalFieldName")] + public string ExternalFieldName { get; set; } + + /// ID + [JsonPropertyName("id")] + public string Id { get; set; } + + /// Job Type + [JsonPropertyName("jobType")] + public JobType? JobType { get; set; } + + /// Line Ending + [JsonPropertyName("lineEnding")] + public LineEnding? LineEnding { get; set; } + + /// Object + [JsonPropertyName("object")] + public string ObjectEntity { get; set; } + + /// Operation + [JsonPropertyName("operation")] + public Operation? Operation { get; set; } + + /// Retries + [JsonPropertyName("retries")] + public double? Retries { get; set; } + + /// State + [JsonPropertyName("state")] + public string State { get; set; } + + /// systemModStamp + [JsonPropertyName("systemModStamp")] + public DateTime? SystemModStamp { get; set; } + + /// Total Processing Time + [JsonPropertyName("totalProcessingTime")] + public double? TotalProcessingTime { get; set; } + } + + /// + /// Response for Execute SOSL search query + /// + public class SOSLSearchQueryResponse + { + /// A list of search records returned by an SOSL search query + [JsonPropertyName("searchRecords")] + public List SearchRecords { get; set; } + + /// Metadata of the result returned from the query + [JsonPropertyName("metadata")] + public object Metadata { get; set; } + } + + /// + /// Item in A list of search records returned by an SOSL search query + /// + public class SearchRecordObject + { + /// Attributes of a search record + [JsonPropertyName("attributes")] + public object Attributes { get; set; } + + /// Unique identifier of the record + [JsonPropertyName("Id")] + public string Id { get; set; } + } + + /// + /// Response for Send an HTTP request + /// + public class ObjectWithoutType + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for MCP server for Salesforce + /// + public class MCPQueryResponse + { + /// jsonrpc + [JsonPropertyName("jsonrpc")] + public string Jsonrpc { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// method + [JsonPropertyName("method")] + public string Method { get; set; } + + /// params + [JsonPropertyName("params")] + public object Params { get; set; } + + /// result + [JsonPropertyName("result")] + public object Result { get; set; } + + /// error + [JsonPropertyName("error")] + public object Error { get; set; } + } + + /// + /// Response for Create a job (V2) + /// + public class CreateJobResponse + { + /// The object type for the data being processed. + [JsonPropertyName("object")] + public string ObjectEntity { get; set; } + + /// The processing operation for the job. + [JsonPropertyName("operation")] + public string Operation { get; set; } + + /// The column delimiter used for CSV job data. + [JsonPropertyName("columnDelimiter")] + public string ColumnDelimiter { get; set; } + + /// The external ID field in the object being updated. Only needed for upsert operations. Field values must also exist in CSV job data. + [JsonPropertyName("externalIdFieldName")] + public string ExternalIdFieldName { get; set; } + + /// The line ending used for CSV job data, marking the end of a data row. + [JsonPropertyName("lineEnding")] + public string LineEnding { get; set; } + + /// The content type for the job. + [JsonPropertyName("contentType")] + public string ContentType { get; set; } + + /// The API version that the job was created in. + [JsonPropertyName("apiVersion")] + public float? APIVersion { get; set; } + + /// The concurrency mode for the job. + [JsonPropertyName("concurrencyMode")] + public string ConcurrencyMode { get; set; } + + /// The URL to use for Upload Job Data requests for this job. Only valid if the job is in 'Open' state. + [JsonPropertyName("contentUrl")] + public string ContentUrl { get; set; } + + /// The ID of the user who created the job. + [JsonPropertyName("createdById")] + public string CreatedById { get; set; } + + /// The date and time in the UTC time zone when the job was created. + [JsonPropertyName("createdDate")] + public DateTime? CreatedDate { get; set; } + + /// Unique ID for this job. + [JsonPropertyName("id")] + public string Id { get; set; } + + /// The job's type. + [JsonPropertyName("jobType")] + public string JobType { get; set; } + + /// The current state of processing for the job. + [JsonPropertyName("state")] + public string State { get; set; } + + /// Date and time in the UTC time zone when the job finished. + [JsonPropertyName("systemModstamp")] + public DateTime? SystemModstamp { get; set; } + } + + /// + /// Response for Get record + /// + [DynamicSchema("GetMetadataForGetItem")] + public class GetItemResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Update record (V3) + /// + [DynamicSchema("GetMetadataForPatchItem")] + public class PatchItemInput + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Update record (V3) + /// + [DynamicSchema("GetMetadataForPatchItem")] + public class PatchItemResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Insert or Update (Upsert) a Record by External ID (V2) + /// + [DynamicSchema("GetMetadataForPatchItem")] + public class PatchItemByExternalIdInput + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Insert or Update (Upsert) a Record by External ID (V2) + /// + [DynamicSchema("GetMetadataForGetItem")] + public class PatchItemByExternalIdResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Create record + /// + [DynamicSchema("GetMetadataForPostItem")] + public class PostItemInput + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Create record + /// + [DynamicSchema("GetMetadataForPostItem")] + public class PostItemResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// CreateJobParameters + /// + public class CreateJobParameters + { + /// The object type for the data being processed. + [JsonPropertyName("object")] + public string ObjectEntity { get; set; } + + /// The processing operation for the job. + [JsonPropertyName("operation")] + public Operation? Operation { get; set; } + + /// The column delimiter used for CSV job data. + [JsonPropertyName("columnDelimiter")] + public string ColumnDelimiter { get; set; } + + /// The external ID field in the object being updated. Only needed for upsert operations. Field values must also exist in CSV job data. + [JsonPropertyName("externalIdFieldName")] + public string ExternalIdFieldName { get; set; } + + /// The line ending used for CSV job data, marking the end of a data row. + [JsonPropertyName("lineEnding")] + public string LineEnding { get; set; } + + /// The content type for the job. + [JsonPropertyName("contentType")] + public string ContentType { get; set; } + } + + /// + /// ExecuteSoqlQueryParameters + /// + public class ExecuteSoqlQueryParameters + { + /// SOQL Query text. Dynamic parameters can be specified using '@paramName' syntax. + [JsonPropertyName("query")] + public string SOQLQuery { get; set; } + + /// SOQL Query dynamic parameters. Key is parameter name (without '@' at sign), value is parameter value. + [JsonPropertyName("parameters")] + public object QueryParameters { get; set; } + } + + /// + /// CloseJobRequest + /// + public class CloseJobRequest + { + /// state + [JsonPropertyName("state")] + public string State { get; set; } + } + + /// + /// MCPQueryRequest + /// + public class MCPQueryRequest + { + /// jsonrpc + [JsonPropertyName("jsonrpc")] + public string Jsonrpc { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// method + [JsonPropertyName("method")] + public string Method { get; set; } + + /// params + [JsonPropertyName("params")] + public object Params { get; set; } + + /// result + [JsonPropertyName("result")] + public object Result { get; set; } + + /// error + [JsonPropertyName("error")] + public object Error { get; set; } + + /// callbackEndpoint + [JsonPropertyName("callbackEndpoint")] + public string CallbackEndpoint { get; set; } + } + + /// + /// Extensible enum for known ColumnDelimiter values. + /// + [JsonConverter(typeof(ColumnDelimiter.ColumnDelimiterJsonConverter))] + public readonly struct ColumnDelimiter : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public ColumnDelimiter(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// BACKQUOTE + public static ColumnDelimiter Backquote { get; } = new("BACKQUOTE"); + + /// CARET + public static ColumnDelimiter Caret { get; } = new("CARET"); + + /// COMMA + public static ColumnDelimiter Comma { get; } = new("COMMA"); + + /// PIPE + public static ColumnDelimiter Pipe { get; } = new("PIPE"); + + /// SEMICOLON + public static ColumnDelimiter Semicolon { get; } = new("SEMICOLON"); + + /// TAB + public static ColumnDelimiter Tab { get; } = new("TAB"); + + /// Converts a string to . + public static implicit operator ColumnDelimiter(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(ColumnDelimiter value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(ColumnDelimiter other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is ColumnDelimiter other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(ColumnDelimiter left, ColumnDelimiter right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(ColumnDelimiter left, ColumnDelimiter right) => !left.Equals(right); + + internal sealed class ColumnDelimiterJsonConverter : JsonConverter + { + public ColumnDelimiterJsonConverter() { } + public override ColumnDelimiter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for ColumnDelimiter, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, ColumnDelimiter value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known ConcurrencyMode values. + /// + [JsonConverter(typeof(ConcurrencyMode.ConcurrencyModeJsonConverter))] + public readonly struct ConcurrencyMode : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public ConcurrencyMode(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// Parallel + public static ConcurrencyMode Parallel { get; } = new("Parallel"); + + /// Serial + public static ConcurrencyMode Serial { get; } = new("Serial"); + + /// Converts a string to . + public static implicit operator ConcurrencyMode(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(ConcurrencyMode value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(ConcurrencyMode other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is ConcurrencyMode other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(ConcurrencyMode left, ConcurrencyMode right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(ConcurrencyMode left, ConcurrencyMode right) => !left.Equals(right); + + internal sealed class ConcurrencyModeJsonConverter : JsonConverter + { + public ConcurrencyModeJsonConverter() { } + public override ConcurrencyMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for ConcurrencyMode, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, ConcurrencyMode value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known JobType values. + /// + [JsonConverter(typeof(JobType.JobTypeJsonConverter))] + public readonly struct JobType : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public JobType(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// BigObjectInjest + public static JobType BigObjectInjest { get; } = new("BigObjectInjest"); + + /// Classic + public static JobType Classic { get; } = new("Classic"); + + /// V2Injest + public static JobType V2Injest { get; } = new("V2Injest"); + + /// Converts a string to . + public static implicit operator JobType(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(JobType value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(JobType other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is JobType other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(JobType left, JobType right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(JobType left, JobType right) => !left.Equals(right); + + internal sealed class JobTypeJsonConverter : JsonConverter + { + public JobTypeJsonConverter() { } + public override JobType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for JobType, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, JobType value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known LineEnding values. + /// + [JsonConverter(typeof(LineEnding.LineEndingJsonConverter))] + public readonly struct LineEnding : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public LineEnding(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// LF + public static LineEnding Lf { get; } = new("LF"); + + /// CRLF + public static LineEnding Crlf { get; } = new("CRLF"); + + /// Converts a string to . + public static implicit operator LineEnding(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(LineEnding value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(LineEnding other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is LineEnding other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(LineEnding left, LineEnding right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(LineEnding left, LineEnding right) => !left.Equals(right); + + internal sealed class LineEndingJsonConverter : JsonConverter + { + public LineEndingJsonConverter() { } + public override LineEnding Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for LineEnding, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, LineEnding value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known Operation values. + /// + [JsonConverter(typeof(Operation.OperationJsonConverter))] + public readonly struct Operation : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public Operation(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// insert + public static Operation Insert { get; } = new("insert"); + + /// delete + public static Operation Delete { get; } = new("delete"); + + /// update + public static Operation Update { get; } = new("update"); + + /// upsert + public static Operation Upsert { get; } = new("upsert"); + + /// Converts a string to . + public static implicit operator Operation(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(Operation value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(Operation other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is Operation other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(Operation left, Operation right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(Operation left, Operation right) => !left.Equals(right); + + internal sealed class OperationJsonConverter : JsonConverter + { + public OperationJsonConverter() { } + public override Operation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for Operation, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, Operation value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Salesforce models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class SalesforceModelFactory + { + /// + /// Creates a new instance of . + /// + public static TableMetadata TableMetadata( + string name = default, + string title = default, + string xMsPermission = default, + TableCapabilitiesMetadata xMsCapabilities = default, + ObjectEntity schema = default, + ObjectEntity referencedEntities = default, + string webUrl = default) + { + return new TableMetadata + { + Name = name, + Title = title, + XMsPermission = xMsPermission, + XMsCapabilities = xMsCapabilities, + Schema = schema, + ReferencedEntities = referencedEntities, + WebUrl = webUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableCapabilitiesMetadata TableCapabilitiesMetadata( + TableSortRestrictionsMetadata sortRestrictions = default, + TableFilterRestrictionsMetadata filterRestrictions = default, + TableSelectRestrictionsMetadata selectRestrictions = default, + bool? isOnlyServerPagable = default, + List filterFunctionSupport = default, + List serverPagingOptions = default) + { + return new TableCapabilitiesMetadata + { + SortRestrictions = sortRestrictions, + FilterRestrictions = filterRestrictions, + SelectRestrictions = selectRestrictions, + IsOnlyServerPagable = isOnlyServerPagable, + FilterFunctionSupport = filterFunctionSupport, + ServerPagingOptions = serverPagingOptions, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableSortRestrictionsMetadata TableSortRestrictionsMetadata( + bool? sortable = default, + List unsortableProperties = default, + List ascendingOnlyProperties = default) + { + return new TableSortRestrictionsMetadata + { + Sortable = sortable, + UnsortableProperties = unsortableProperties, + AscendingOnlyProperties = ascendingOnlyProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableFilterRestrictionsMetadata TableFilterRestrictionsMetadata( + bool? filterable = default, + List nonFilterableProperties = default, + List requiredProperties = default) + { + return new TableFilterRestrictionsMetadata + { + Filterable = filterable, + NonFilterableProperties = nonFilterableProperties, + RequiredProperties = requiredProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableSelectRestrictionsMetadata TableSelectRestrictionsMetadata( + bool? selectable = default) + { + return new TableSelectRestrictionsMetadata + { + Selectable = selectable, + }; + } + + /// + /// Creates a new instance of . + /// + public static TablesList TablesList( + List
value = default) + { + return new TablesList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static Table Table( + string name = default, + string displayName = default, + object dynamicProperties = default) + { + return new Table + { + Name = name, + DisplayName = displayName, + DynamicProperties = dynamicProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static ExternalIdFieldsList ExternalIdFieldsList( + List value = default) + { + return new ExternalIdFieldsList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static ExternalIdField ExternalIdField( + string name = default, + string displayName = default) + { + return new ExternalIdField + { + Name = name, + DisplayName = displayName, + }; + } + + /// + /// Creates a new instance of . + /// + public static ItemsList ItemsList( + List value = default) + { + return new ItemsList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static Item Item( + object dynamicProperties = default) + { + return new Item + { + DynamicProperties = dynamicProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetAllJobsResponse GetAllJobsResponse( + bool? done = default, + List records = default, + string nextRecoredURL = default) + { + return new GetAllJobsResponse + { + Done = done, + Records = records, + NextRecoredURL = nextRecoredURL, + }; + } + + /// + /// Creates a new instance of . + /// + public static JobInfo JobInfo( + float? apiVersion = default, + ColumnDelimiter? columnDelimiter = default, + ConcurrencyMode? concurrencyMode = default, + string contentType = default, + string contentURL = default, + string createdById = default, + DateTime? createdDate = default, + string externalIdFieldName = default, + string id = default, + JobType? jobType = default, + LineEnding? lineEnding = default, + string objectEntity = default, + Operation? operation = default, + string state = default, + DateTime? systemModStamp = default) + { + return new JobInfo + { + APIVersion = apiVersion, + ColumnDelimiter = columnDelimiter, + ConcurrencyMode = concurrencyMode, + ContentType = contentType, + ContentURL = contentURL, + CreatedById = createdById, + CreatedDate = createdDate, + ExternalIdFieldName = externalIdFieldName, + Id = id, + JobType = jobType, + LineEnding = lineEnding, + ObjectEntity = objectEntity, + Operation = operation, + State = state, + SystemModStamp = systemModStamp, + }; + } + + /// + /// Creates a new instance of . + /// + public static CheckJobResponse CheckJobResponse( + double? apexProcessingTime = default, + double? apiActiveProcessingTime = default, + float? apiVersion = default, + ColumnDelimiter? columnDelimiter = default, + ConcurrencyMode? concurrencyMode = default, + string contentType = default, + string contentURL = default, + string createdById = default, + DateTime? createdDate = default, + string externalFieldName = default, + string id = default, + JobType? jobType = default, + LineEnding? lineEnding = default, + string objectEntity = default, + Operation? operation = default, + double? retries = default, + string state = default, + DateTime? systemModStamp = default, + double? totalProcessingTime = default) + { + return new CheckJobResponse + { + APEXProcessingTime = apexProcessingTime, + APIActiveProcessingTime = apiActiveProcessingTime, + APIVersion = apiVersion, + ColumnDelimiter = columnDelimiter, + ConcurrencyMode = concurrencyMode, + ContentType = contentType, + ContentURL = contentURL, + CreatedById = createdById, + CreatedDate = createdDate, + ExternalFieldName = externalFieldName, + Id = id, + JobType = jobType, + LineEnding = lineEnding, + ObjectEntity = objectEntity, + Operation = operation, + Retries = retries, + State = state, + SystemModStamp = systemModStamp, + TotalProcessingTime = totalProcessingTime, + }; + } + + /// + /// Creates a new instance of . + /// + public static SOSLSearchQueryResponse SOSLSearchQueryResponse( + List searchRecords = default, + object metadata = default) + { + return new SOSLSearchQueryResponse + { + SearchRecords = searchRecords, + Metadata = metadata, + }; + } + + /// + /// Creates a new instance of . + /// + public static SearchRecordObject SearchRecordObject( + object attributes = default, + string id = default) + { + return new SearchRecordObject + { + Attributes = attributes, + Id = id, + }; + } + + /// + /// Creates a new instance of . + /// + public static MCPQueryResponse MCPQueryResponse( + string jsonrpc = default, + string id = default, + string method = default, + object @params = default, + object result = default, + object error = default) + { + return new MCPQueryResponse + { + Jsonrpc = jsonrpc, + Id = id, + Method = method, + Params = @params, + Result = result, + Error = error, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateJobResponse CreateJobResponse( + string objectEntity = default, + string operation = default, + string columnDelimiter = default, + string externalIdFieldName = default, + string lineEnding = default, + string contentType = default, + float? apiVersion = default, + string concurrencyMode = default, + string contentUrl = default, + string createdById = default, + DateTime? createdDate = default, + string id = default, + string jobType = default, + string state = default, + DateTime? systemModstamp = default) + { + return new CreateJobResponse + { + ObjectEntity = objectEntity, + Operation = operation, + ColumnDelimiter = columnDelimiter, + ExternalIdFieldName = externalIdFieldName, + LineEnding = lineEnding, + ContentType = contentType, + APIVersion = apiVersion, + ConcurrencyMode = concurrencyMode, + ContentUrl = contentUrl, + CreatedById = createdById, + CreatedDate = createdDate, + Id = id, + JobType = jobType, + State = state, + SystemModstamp = systemModstamp, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateJobParameters CreateJobParameters( + string objectEntity = default, + Operation? operation = default, + string columnDelimiter = default, + string externalIdFieldName = default, + string lineEnding = default, + string contentType = default) + { + return new CreateJobParameters + { + ObjectEntity = objectEntity, + Operation = operation, + ColumnDelimiter = columnDelimiter, + ExternalIdFieldName = externalIdFieldName, + LineEnding = lineEnding, + ContentType = contentType, + }; + } + + /// + /// Creates a new instance of . + /// + public static ExecuteSoqlQueryParameters ExecuteSoqlQueryParameters( + string soqlQuery = default, + object queryParameters = default) + { + return new ExecuteSoqlQueryParameters + { + SOQLQuery = soqlQuery, + QueryParameters = queryParameters, + }; + } + + /// + /// Creates a new instance of . + /// + public static CloseJobRequest CloseJobRequest( + string state = default) + { + return new CloseJobRequest + { + State = state, + }; + } + + /// + /// Creates a new instance of . + /// + public static MCPQueryRequest MCPQueryRequest( + string jsonrpc = default, + string id = default, + string method = default, + object @params = default, + object result = default, + object error = default, + string callbackEndpoint = default) + { + return new MCPQueryRequest + { + Jsonrpc = jsonrpc, + Id = id, + Method = method, + Params = @params, + Result = result, + Error = error, + CallbackEndpoint = callbackEndpoint, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnNewItems trigger (Salesforce "When a record is created", operationId: GetOnNewItems). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<SalesforceOnNewItemsTriggerPayload>(body). + /// + public class SalesforceOnNewItemsTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnUpdatedItems trigger (Salesforce "When a record is modified", operationId: GetOnUpdatedItems). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<SalesforceOnUpdatedItemsTriggerPayload>(body). + /// + public class SalesforceOnUpdatedItemsTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Salesforce connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class SalesforceTriggers + { + /// + /// Trigger operations with typed payloads for the Salesforce connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["GetOnNewItems"] = typeof(SalesforceOnNewItemsTriggerPayload), + ["GetOnUpdatedItems"] = typeof(SalesforceOnUpdatedItemsTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Salesforce +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Salesforce connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class SalesforceTriggerOperations + { + /// + /// When a record is created. + /// Payload type: . + /// + public const string OnNewItems = "GetOnNewItems"; + + /// + /// When a record is modified. + /// Payload type: . + /// + public const string OnUpdatedItems = "GetOnUpdatedItems"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Salesforce connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class SalesforceTriggerParameters + { + /// + /// Input parameters for the OnNewItems trigger operation (operationId: GetOnNewItems). + /// + public static class OnNewItems + { + /// + /// An ODATA filter query to restrict the entries returned (e.g. stringColumn eq 'string' OR numberColumn lt 123). + /// + public const string Filter = "$filter"; + + /// + /// An ODATA orderBy query for specifying the order of entries. + /// + public const string Orderby = "$orderby"; + + /// + /// Specific fields to retrieve from entries (default = all). + /// + public const string Select = "$select"; + + } + + /// + /// Input parameters for the OnUpdatedItems trigger operation (operationId: GetOnUpdatedItems). + /// + public static class OnUpdatedItems + { + /// + /// An ODATA filter query to restrict the entries returned (e.g. stringColumn eq 'string' OR numberColumn lt 123). + /// + public const string Filter = "$filter"; + + /// + /// An ODATA orderBy query for specifying the order of entries. + /// + public const string Orderby = "$orderby"; + + /// + /// Specific fields to retrieve from entries (default = all). + /// + public const string Select = "$select"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for salesforce connector. + /// + public class SalesforceClient : ConnectorClientBase + { + /// + /// Creates a new SalesforceClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public SalesforceClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new SalesforceClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public SalesforceClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new SalesforceClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public SalesforceClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new SalesforceClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public SalesforceClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected SalesforceClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "salesforce"; + + /// + /// Get object metadata + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Salesforce Object Type + /// Cancellation token. + /// The Get object metadata response. + public virtual async Task GetTableAsync([DynamicValues("GetTables")] string salesforceObjectType, CancellationToken cancellationToken = default) + { + var path = $"/$metadata.json/datasets/default/tables/{Uri.EscapeDataString(salesforceObjectType.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// GetMetadataForGetItem + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// table + /// Cancellation token. + /// The GetMetadataForGetItem response. + public virtual async Task GetMetadataForGetItemAsync([DynamicValues("GetTables")] string table, CancellationToken cancellationToken = default) + { + var path = $"/$metadata.json/datasets/default/tables/{Uri.EscapeDataString(table.ToString())}/getitem"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// GetMetadataForPatchItem + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// table + /// Cancellation token. + /// The GetMetadataForPatchItem response. + public virtual async Task GetMetadataForPatchItemAsync([DynamicValues("GetTables")] string table, CancellationToken cancellationToken = default) + { + var path = $"/$metadata.json/datasets/default/tables/{Uri.EscapeDataString(table.ToString())}/patchitem"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// GetMetadataForPostItem + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// table + /// Cancellation token. + /// The GetMetadataForPostItem response. + public virtual async Task GetMetadataForPostItemAsync([DynamicValues("GetTables")] string table, CancellationToken cancellationToken = default) + { + var path = $"/$metadata.json/datasets/default/tables/{Uri.EscapeDataString(table.ToString())}/postitem"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get object types + /// + /// This operation lists the available Salesforce object types. + /// Cancellation token. + /// The Get object types response. + public virtual async Task GetTablesAsync(CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/tables"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get External ID Fields + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Salesforce Object Type + /// Cancellation token. + /// The Get External ID Fields response. + public virtual async Task GetExternalIdFieldsAsync([DynamicValues("GetTables")] string salesforceObjectType, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/tables/{Uri.EscapeDataString(salesforceObjectType.ToString())}/externalIdFields"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get a Record by External ID + /// + /// This operation retrieves a record using an external ID. + /// Salesforce Object Type + /// External ID Field + /// External ID + /// Cancellation token. + /// The Get a Record by External ID response. + public virtual async Task GetItemByExternalIdAsync([DynamicValues("GetTables")] string salesforceObjectType, [DynamicValues("GetExternalIdFields")] string externalIdField, string externalId, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/tables/{Uri.EscapeDataString(salesforceObjectType.ToString())}/externalIdFields/{Uri.EscapeDataString(externalIdField.ToString())}/{Uri.EscapeDataString(externalId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get records + /// + /// This operation gets records of a certain Salesforce object type like 'Leads'. + /// Salesforce Object Type + /// Filter Query + /// Order By + /// Top Count + /// Skip Count + /// Select Query + /// Cancellation token. + /// The Get records response. + public virtual async Task GetItemsAsync([DynamicValues("GetTables")] string salesforceObjectType, string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, string selectQuery = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (filterQuery != default) + queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); + if (orderBy != default) + queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); + if (selectQuery != default) + queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); + var path = $"/datasets/default/tables/{Uri.EscapeDataString(salesforceObjectType.ToString())}/items" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Account records from Salesforce + /// + /// This operation gets Account records from Salesforce. + /// Filter Query + /// Order By + /// Top Count + /// Skip Count + /// Select Query + /// Cancellation token. + /// The Get Account records from Salesforce response. + public virtual async Task GetItemsTableAccountAsync(string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, string selectQuery = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (filterQuery != default) + queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); + if (orderBy != default) + queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); + if (selectQuery != default) + queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); + var path = $"/datasets/default/tables/account/items" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get User records from Salesforce + /// + /// This operation gets User records from Salesforce. + /// Filter Query + /// Order By + /// Top Count + /// Skip Count + /// Select Query + /// Cancellation token. + /// The Get User records from Salesforce response. + public virtual async Task GetItemsTableUserAsync(string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, string selectQuery = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (filterQuery != default) + queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); + if (orderBy != default) + queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); + if (selectQuery != default) + queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); + var path = $"/datasets/default/tables/user/items" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Case records from Salesforce + /// + /// This operation gets Case records from Salesforce. + /// Filter Query + /// Order By + /// Top Count + /// Skip Count + /// Select Query + /// Cancellation token. + /// The Get Case records from Salesforce response. + public virtual async Task GetItemsTableCaseAsync(string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, string selectQuery = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (filterQuery != default) + queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); + if (orderBy != default) + queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); + if (selectQuery != default) + queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); + var path = $"/datasets/default/tables/case/items" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Opportunity records from Salesforce + /// + /// This operation gets Opportunity records from Salesforce. + /// Filter Query + /// Order By + /// Top Count + /// Skip Count + /// Select Query + /// Cancellation token. + /// The Get Opportunity records from Salesforce response. + public virtual async Task GetItemsTableOpportunityAsync(string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, string selectQuery = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (filterQuery != default) + queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); + if (orderBy != default) + queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); + if (selectQuery != default) + queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); + var path = $"/datasets/default/tables/opportunity/items" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Product records from Salesforce + /// + /// This operation gets Product records from Salesforce. + /// Filter Query + /// Order By + /// Top Count + /// Skip Count + /// Select Query + /// Cancellation token. + /// The Get Product records from Salesforce response. + public virtual async Task GetItemsTableProduct2Async(string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, string selectQuery = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (filterQuery != default) + queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); + if (orderBy != default) + queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); + if (selectQuery != default) + queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); + var path = $"/datasets/default/tables/product2/items" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Contact records from Salesforce + /// + /// This operation gets Contact records from Salesforce. + /// Filter Query + /// Order By + /// Top Count + /// Skip Count + /// Select Query + /// Cancellation token. + /// The Get Contact records from Salesforce response. + public virtual async Task GetItemsTableContactAsync(string filterQuery = default, string orderBy = default, int? topCount = default, int? skipCount = default, string selectQuery = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (filterQuery != default) + queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); + if (orderBy != default) + queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); + if (selectQuery != default) + queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); + var path = $"/datasets/default/tables/contact/items" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete record + /// + /// This operation deletes a record. + /// Salesforce Object Type + /// Record Id + /// Cancellation token. + public virtual async Task DeleteItemAsync([DynamicValues("GetTables")] string salesforceObjectType, string recordId, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/tables/{Uri.EscapeDataString(salesforceObjectType.ToString())}/items/{Uri.EscapeDataString(recordId.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Execute a SOQL query + /// + /// Execute a SOQL query. + /// The request body. + /// Cancellation token. + /// The Execute a SOQL query response. + public virtual async Task ExecuteSoqlQueryAsync(ExecuteSoqlQueryParameters input, CancellationToken cancellationToken = default) + { + var path = $"/soql/executesoqlquery"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get all jobs + /// + /// Get a list of all jobs + /// Concurrency Mode + /// Is PK Chunking Enabled + /// Job Type + /// Query Locator + /// Cancellation token. + /// The Get all jobs response. + public virtual async Task GetAllJobsAsync(string concurrencyMode = default, bool? isPKChunkingEnabled = default, string jobType = default, string queryLocator = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (concurrencyMode != default) + queryParams.Add($"concurrenyMode={Uri.EscapeDataString(concurrencyMode.ToString())}"); + if (isPKChunkingEnabled.HasValue) + queryParams.Add($"isPkChunkingEnabled={Uri.EscapeDataString(isPKChunkingEnabled.Value.ToString())}"); + if (jobType != default) + queryParams.Add($"jobType={Uri.EscapeDataString(jobType.ToString())}"); + if (queryLocator != default) + queryParams.Add($"queryLocator={Uri.EscapeDataString(queryLocator.ToString())}"); + var path = $"/codeless/jobs/ingest" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Upload job data + /// + /// Uploads data for a job using CSV data. + /// Job ID + /// The request body. + /// Cancellation token. + public virtual async Task UploadJobDataAsync([DynamicValues("GetAllJobs")] string jobId, byte[] input, CancellationToken cancellationToken = default) + { + var path = $"/codeless/jobs/ingest/{Uri.EscapeDataString(jobId.ToString())}/batches"; + await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get job info + /// + /// Retrieves detailed information about a job. + /// Job ID + /// Cancellation token. + /// The Get job info response. + public virtual async Task GetJobInfoAsync([DynamicValues("GetAllJobs")] string jobId, CancellationToken cancellationToken = default) + { + var path = $"/codeless/jobs/ingest/{Uri.EscapeDataString(jobId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Close or abort a job + /// + /// Closes or aborts a job. Use UploadComplete to close a job, or Aborted to abort a job. If you close a job, Salesforce queues the job and uploaded data for processing, and you can't add any additional job data. If you abort a job, the job does not get queued or processed. + /// Job ID + /// The request body. + /// Cancellation token. + /// The Close or abort a job response. + public virtual async Task CloseJobAsync([DynamicValues("GetAllJobs")] string jobId, CloseJobRequest input, CancellationToken cancellationToken = default) + { + var path = $"/codeless/jobs/ingest/{Uri.EscapeDataString(jobId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Patch, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete a job + /// + /// Deletes a job. To be deleted, a job must have a state of UploadComplete, JobComplete, Aborted, or Failed. + /// Job ID + /// Cancellation token. + public virtual async Task DeleteJobAsync([DynamicValues("GetAllJobs")] string jobId, CancellationToken cancellationToken = default) + { + var path = $"/codeless/jobs/ingest/{Uri.EscapeDataString(jobId.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get job results + /// + /// Retrieves a list of records based on the result type for a completed job. + /// Job ID + /// Result Type + /// Cancellation token. + /// The Get job results response. + public virtual async Task GetJobRecordResultsAsync([DynamicValues("GetAllJobs")] string jobId, string resultType, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"resultType={Uri.EscapeDataString(resultType.ToString())}"); + var path = $"/codeless/jobs/ingest/{Uri.EscapeDataString(jobId.ToString())}/results" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Execute SOSL search query + /// + /// Execute the specified SOSL search qyery + /// SOSL search string + /// Cancellation token. + /// The Execute SOSL search query response. + public virtual async Task ExecuteSOSLQueryAsync(string sOSLSearchString, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"q={Uri.EscapeDataString(sOSLSearchString.ToString())}"); + var path = $"/codeless/search" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Send an HTTP request + /// + /// Construct a Salesforce REST API request to invoke + /// The request body. + /// Cancellation token. + /// The Send an HTTP request response. + public virtual async Task HttpRequestAsync(byte[] input, CancellationToken cancellationToken = default) + { + var path = $"/codeless/httprequest"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// MCP server for Salesforce + /// + /// MCP server for Salesforce + /// The request body. + /// sessionId + /// Cancellation token. + /// The MCP server for Salesforce response. + public virtual async Task McpSalesforceManagementAsync(MCPQueryRequest input, string sessionId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (sessionId != default) + queryParams.Add($"sessionId={Uri.EscapeDataString(sessionId.ToString())}"); + var path = $"/mcp/SalesforceManagement" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a job (V2) + /// + /// Creates a job, which represents a bulk operation (and associated data) that is sent to Salesforce for asynchronous processing. Provide job data via an Upload Job Data request. + /// The request body. + /// Cancellation token. + /// The Create a job (V2) response. + public virtual async Task CreateJobAsync(CreateJobParameters input, CancellationToken cancellationToken = default) + { + var path = $"/bulk/createjob"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get record + /// + /// This operation gets a record. + /// Salesforce Object Type + /// Record Id + /// Select Query + /// Cancellation token. + /// The Get record response. + public virtual async Task GetItemAsync([DynamicValues("GetTables")] string salesforceObjectType, string recordId, string selectQuery = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (selectQuery != default) + queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); + var path = $"/v2/datasets/default/tables/{Uri.EscapeDataString(salesforceObjectType.ToString())}/items/{Uri.EscapeDataString(recordId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update record (V3) + /// + /// This operation updates a record and allows null values. + /// Salesforce Object Type + /// Record Id + /// The request body. + /// Select Query + /// Cancellation token. + /// The Update record (V3) response. + public virtual async Task PatchItemAsync([DynamicValues("GetTables")] string salesforceObjectType, string recordId, PatchItemInput input, string selectQuery = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (selectQuery != default) + queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); + var path = $"/v3/datasets/default/tables/{Uri.EscapeDataString(salesforceObjectType.ToString())}/items/{Uri.EscapeDataString(recordId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Patch, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Insert or Update (Upsert) a Record by External ID (V2) + /// + /// This operation inserts or updates (upserts) a record using an external ID. + /// Salesforce Object Type + /// External ID Field + /// External ID + /// The request body. + /// Cancellation token. + /// The Insert or Update (Upsert) a Record by External ID (V2) response. + public virtual async Task PatchItemByExternalIdAsync([DynamicValues("GetTables")] string salesforceObjectType, [DynamicValues("GetExternalIdFields")] string externalIdField, string externalId, PatchItemByExternalIdInput input, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/default/tables/{Uri.EscapeDataString(salesforceObjectType.ToString())}/externalIdFields/{Uri.EscapeDataString(externalIdField.ToString())}/{Uri.EscapeDataString(externalId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Patch, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create record + /// + /// This operation creates a record and allows null values. + /// Salesforce Object Type + /// The request body. + /// Cancellation token. + /// The Create record response. + public virtual async Task PostItemAsync([DynamicValues("GetTables")] string salesforceObjectType, PostItemInput input, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/default/tables/{Uri.EscapeDataString(salesforceObjectType.ToString())}/items"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/SendGridExtensions.cs b/src/Azure.Connectors.Sdk/Generated/SendGridExtensions.cs new file mode 100644 index 0000000..d95ca70 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/SendGridExtensions.cs @@ -0,0 +1,606 @@ +// SendGridExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.SendGrid.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.SendGrid.Models +{ + + #region Types + + /// + /// Response for Add a global suppression + /// + public class AddGlobalSuppressRequestAndResponse + { + /// Recipient email + [JsonPropertyName("recipient_emails")] + public List RecipientEmail { get; set; } + } + + /// + /// Response for Get the global suppression + /// + public class GetGlobalSuppressResponse + { + /// Recipient email + [JsonPropertyName("recipient_email")] + public string RecipientEmail { get; set; } + } + + /// + /// Response for Add recipient to list + /// + public class ObjectEntity + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for List Recipient Lists + /// + public class RecipientLists + { + /// List of recipient lists + [JsonPropertyName("lists")] + public List RecipientListsValue { get; set; } + } + + /// + /// Item in List of recipient lists + /// + public class RecipientList + { + /// Unique list id + [JsonPropertyName("id")] + public int? Id { get; set; } + + /// Name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Recipient count + [JsonPropertyName("recipient_count")] + public int? RecipientCount { get; set; } + } + + /// + /// Response for List Recipients + /// + public class Recipients + { + /// List of recipients + [JsonPropertyName("recipients")] + public List RecipientList { get; set; } + } + + /// + /// Item in List of recipients + /// + public class Recipient + { + /// Email address + [JsonPropertyName("email")] + public string Email { get; set; } + + /// Last name + [JsonPropertyName("last_name")] + public string Last { get; set; } + + /// First name + [JsonPropertyName("first_name")] + public string First { get; set; } + + /// Unique recipient id + [JsonPropertyName("id")] + public string Id { get; set; } + } + + /// + /// Response for Get bounce for an email + /// + public class Bounce + { + /// Created + [JsonPropertyName("created")] + public int? Created { get; set; } + + /// Email + [JsonPropertyName("email")] + public string Email { get; set; } + + /// Reason + [JsonPropertyName("reason")] + public string Reason { get; set; } + + /// Status + [JsonPropertyName("status")] + public string Status { get; set; } + } + + /// + /// Response for Check if email is in unsubscribed email list + /// + public class EmailIsUnsubscribedResponse + { + /// Is Email Unsubscribed + [JsonPropertyName("isUnsubscribed")] + public bool? IsEmailUnsubscribed { get; set; } + } + + /// + /// EmailRequestV5 + /// + public class EmailRequest + { + /// Attachments + [JsonPropertyName("attachments")] + public List Attachment { get; set; } + + /// Origination address of your email. Must be a valid email address from your domain + [JsonPropertyName("from")] + public string From { get; set; } + + /// Origination name of your email + [JsonPropertyName("fromname")] + public string FromName { get; set; } + + /// Valid email addresses separated by a semicolon or comma + [JsonPropertyName("to")] + public string To { get; set; } + + /// A display name for each email address separated by a semicolon or comma + [JsonPropertyName("toname")] + public string ToNames { get; set; } + + /// Subject of your email + [JsonPropertyName("subject")] + public string Subject { get; set; } + + /// Content of your email + [JsonPropertyName("text")] + public string EmailBody { get; set; } + + /// Specify whether the content of the email is HTML or plain text + [JsonPropertyName("ishtml")] + public bool? IsHtml { get; set; } + + /// Valid email addresses separated by a semicolon or comma + [JsonPropertyName("cc")] + public string CC { get; set; } + + /// A display name for each CC email address separated by a semicolon or comma + [JsonPropertyName("ccname")] + public string CCNames { get; set; } + + /// Valid email addresses separated by a semicolon or comma + [JsonPropertyName("bcc")] + public string Bcc { get; set; } + + /// A display name for each BCC email address separated by a semicolon or comma + [JsonPropertyName("bccname")] + public string BCCNames { get; set; } + } + + /// + /// Item in Attachments + /// + public class EmailAttachment + { + /// Attachment file content + [JsonPropertyName("content")] + public string Content { get; set; } + + /// Attachment file name + [JsonPropertyName("filename")] + public string Name { get; set; } + + /// Type of content in the attachment. + [JsonPropertyName("contenttype")] + public string ContentType { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of SendGrid models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class SendGridModelFactory + { + /// + /// Creates a new instance of . + /// + public static AddGlobalSuppressRequestAndResponse AddGlobalSuppressRequestAndResponse( + List recipientEmail = default) + { + return new AddGlobalSuppressRequestAndResponse + { + RecipientEmail = recipientEmail, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetGlobalSuppressResponse GetGlobalSuppressResponse( + string recipientEmail = default) + { + return new GetGlobalSuppressResponse + { + RecipientEmail = recipientEmail, + }; + } + + /// + /// Creates a new instance of . + /// + public static RecipientLists RecipientLists( + List recipientListsValue = default) + { + return new RecipientLists + { + RecipientListsValue = recipientListsValue, + }; + } + + /// + /// Creates a new instance of . + /// + public static RecipientList RecipientList( + int? id = default, + string name = default, + int? recipientCount = default) + { + return new RecipientList + { + Id = id, + Name = name, + RecipientCount = recipientCount, + }; + } + + /// + /// Creates a new instance of . + /// + public static Recipients Recipients( + List recipientList = default) + { + return new Recipients + { + RecipientList = recipientList, + }; + } + + /// + /// Creates a new instance of . + /// + public static Recipient Recipient( + string email = default, + string last = default, + string first = default, + string id = default) + { + return new Recipient + { + Email = email, + Last = last, + First = first, + Id = id, + }; + } + + /// + /// Creates a new instance of . + /// + public static Bounce Bounce( + int? created = default, + string email = default, + string reason = default, + string status = default) + { + return new Bounce + { + Created = created, + Email = email, + Reason = reason, + Status = status, + }; + } + + /// + /// Creates a new instance of . + /// + public static EmailIsUnsubscribedResponse EmailIsUnsubscribedResponse( + bool? isEmailUnsubscribed = default) + { + return new EmailIsUnsubscribedResponse + { + IsEmailUnsubscribed = isEmailUnsubscribed, + }; + } + + /// + /// Creates a new instance of . + /// + public static EmailRequest EmailRequest( + List attachment = default, + string from = default, + string fromName = default, + string to = default, + string toNames = default, + string subject = default, + string emailBody = default, + bool? isHtml = default, + string cc = default, + string ccNames = default, + string bcc = default, + string bccNames = default) + { + return new EmailRequest + { + Attachment = attachment, + From = from, + FromName = fromName, + To = to, + ToNames = toNames, + Subject = subject, + EmailBody = emailBody, + IsHtml = isHtml, + CC = cc, + CCNames = ccNames, + Bcc = bcc, + BCCNames = bccNames, + }; + } + + /// + /// Creates a new instance of . + /// + public static EmailAttachment EmailAttachment( + string content = default, + string name = default, + string contentType = default) + { + return new EmailAttachment + { + Content = content, + Name = name, + ContentType = contentType, + }; + } + } + + #endregion Model Factory + +} + +namespace Azure.Connectors.Sdk.SendGrid +{ + + #region Client + + /// + /// Typed client for sendgrid connector. + /// + public class SendGridClient : ConnectorClientBase + { + /// + /// Creates a new SendGridClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public SendGridClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new SendGridClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public SendGridClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new SendGridClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public SendGridClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new SendGridClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public SendGridClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected SendGridClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "sendgrid"; + + /// + /// Add a global suppression + /// + /// Add a global suppression + /// The request body. + /// Cancellation token. + /// The Add a global suppression response. + public virtual async Task AddGlobalSuppressionAsync(AddGlobalSuppressRequestAndResponse input, CancellationToken cancellationToken = default) + { + var path = $"/suppressions/global"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get the global suppression + /// + /// Get the global suppression + /// Email + /// Cancellation token. + /// The Get the global suppression response. + public virtual async Task GetGlobalSuppressionAsync(string email, CancellationToken cancellationToken = default) + { + var path = $"/suppressions/global/{Uri.EscapeDataString(email.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete the global suppression + /// + /// Delete the global suppression + /// Email + /// Cancellation token. + public virtual async Task DeleteGlobalSuppressionAsync(string email, CancellationToken cancellationToken = default) + { + var path = $"/suppressions/global/{Uri.EscapeDataString(email.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add recipient to list + /// + /// Add an individual recipient to a recipient list. + /// List id + /// Recipient id + /// Cancellation token. + /// The Add recipient to list response. + public virtual async Task AddRecipientToListAsync([DynamicValues("ListRecipientLists")] string listId, [DynamicValues("ListRecipients")] string recipientId, CancellationToken cancellationToken = default) + { + var path = $"/v3/contactdb/lists/{Uri.EscapeDataString(listId.ToString())}/recipients/{Uri.EscapeDataString(recipientId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List Recipient Lists + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The List Recipient Lists response. + public virtual async Task ListRecipientListsAsync(CancellationToken cancellationToken = default) + { + var path = $"/v3/contactdb/lists"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List Recipients + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The List Recipients response. + public virtual async Task ListRecipientsAsync(CancellationToken cancellationToken = default) + { + var path = $"/v3/contactdb/recipients"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get bounce for an email + /// + /// Get a specific bounce for a given email address. + /// Email + /// Cancellation token. + /// The Get bounce for an email response. + public virtual async Task> GetBounceAsync(string email, CancellationToken cancellationToken = default) + { + var path = $"/suppression/bounces/{Uri.EscapeDataString(email.ToString())}"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete an email from bounce list + /// + /// Delete an email address from your bounce list. + /// Email + /// Cancellation token. + public virtual async Task DeleteBounceAsync(string email, CancellationToken cancellationToken = default) + { + var path = $"/suppression/bounces/{Uri.EscapeDataString(email.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Check if email is in unsubscribed email list + /// + /// Check if email is in unsubscribed email list. + /// Email + /// Cancellation token. + /// The Check if email is in unsubscribed email list response. + public virtual async Task CheckEmailIsInUnsubscribesListAsync(string email, CancellationToken cancellationToken = default) + { + var path = $"/unsubscribes/{Uri.EscapeDataString(email.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Send email (V4) + /// + /// Sends an email (V4). Limited to 1000 recipients. + /// The request body. + /// Cancellation token. + /// The Send email (V4) response. + public virtual async Task SendEmailAsync(EmailRequest input, CancellationToken cancellationToken = default) + { + var path = $"/v4/mail/send"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/SlackExtensions.cs b/src/Azure.Connectors.Sdk/Generated/SlackExtensions.cs new file mode 100644 index 0000000..b5e8979 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/SlackExtensions.cs @@ -0,0 +1,575 @@ +// SlackExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Slack.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Slack.Models +{ + + #region Types + + /// + /// Response for Set do not disturb + /// + public class SetDNDResponse + { + /// Whether snooze is enabled. + [JsonPropertyName("snooze_enabled")] + public bool? SnoozeEnabled { get; set; } + } + + /// + /// Response for Create a channel + /// + public class CreateChannelResponse + { + /// channel + [JsonPropertyName("channel")] + public Channel Channel { get; set; } + } + + /// + /// channel + /// + public class Channel + { + /// The id of the channel. + [JsonPropertyName("id")] + public string Id { get; set; } + + /// The name of channel. + [JsonPropertyName("name")] + public string Name { get; set; } + } + + /// + /// Response for Join a public channel + /// + public class JoinChannelResponse + { + /// channel + [JsonPropertyName("channel")] + public Channel Channel { get; set; } + + /// Whether the user is already in the channel or not. + [JsonPropertyName("warning")] + public string Warning { get; set; } + } + + /// + /// Response for List public channels (Pagination support) + /// + public class ListChannelsResponse : IPageable + { + /// value + [JsonPropertyName("value")] + public List Value { get; set; } + + /// Link to get next page of results + [JsonPropertyName("@odata.nextLink")] + public string NextLink { get; set; } + } + + /// + /// Response for Post message (V2) + /// + public class PostMessageResponse + { + /// Indicates if the operation was successful. + [JsonPropertyName("ok")] + public bool? Ok { get; set; } + + /// The channel which the message was posted to. + [JsonPropertyName("channel")] + public string Channel { get; set; } + + /// Unix timestamp for when the message was created. + [JsonPropertyName("ts")] + public string Ts { get; set; } + + /// A channel message. + [JsonPropertyName("message")] + public object Message { get; set; } + + /// Details of the error messages, if any. + [JsonPropertyName("error")] + public string Error { get; set; } + } + + /// + /// PostMessageRequest + /// + public class PostMessageRequest + { + /// Channel, private group, or IM channel to send message to. Can be a name(ex: #general) or an encoded ID. + [JsonPropertyName("channel")] + public string ChannelName { get; set; } + + /// Body of the message to send. Slack API will truncate messages containing more than 40,000 characters. For formatting options, see https://api.slack.com/docs/formatting + [JsonPropertyName("text")] + public string MessageText { get; set; } + + /// Name of the bot. + [JsonPropertyName("username")] + public string BotName { get; set; } + + /// Pass true to post the message as the authenticated user, instead of as a bot. + [JsonPropertyName("as_user")] + public bool? PostAsUser { get; set; } + + /// Change how messages are treated. For details, see https://api.slack.com/docs/formatting + [JsonPropertyName("parse")] + public Parse? ParseMode { get; set; } + + /// Slack markup parsing setting. Enabled by default. + [JsonPropertyName("mrkdwn")] + public bool? SlackMarkupParsing { get; set; } + + /// Find and link channel names and usernames. + [JsonPropertyName("link_names")] + public int? LinkNames { get; set; } + + /// Pass true to enable unfurling of primarily text-based content. + [JsonPropertyName("unfurl_links")] + public bool? UnfurlLinks { get; set; } + + /// Pass false to disable unfurling of media content. + [JsonPropertyName("unfurl_media")] + public bool? UnfurlMedia { get; set; } + + /// URL to an image to use as an icon for this message. + [JsonPropertyName("icon_url")] + public string IconUrl { get; set; } + + /// Emoji to use as an icon for this message. + [JsonPropertyName("icon_emoji")] + public string IconEmoji { get; set; } + } + + /// + /// Extensible enum for known Parse values. + /// + [JsonConverter(typeof(Parse.ParseJsonConverter))] + public readonly struct Parse : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public Parse(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// full + public static Parse Full { get; } = new("full"); + + /// none + public static Parse None { get; } = new("none"); + + /// Converts a string to . + public static implicit operator Parse(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(Parse value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(Parse other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is Parse other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(Parse left, Parse right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(Parse left, Parse right) => !left.Equals(right); + + internal sealed class ParseJsonConverter : JsonConverter + { + public ParseJsonConverter() { } + public override Parse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for Parse, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, Parse value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Slack models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class SlackModelFactory + { + /// + /// Creates a new instance of . + /// + public static SetDNDResponse SetDNDResponse( + bool? snoozeEnabled = default) + { + return new SetDNDResponse + { + SnoozeEnabled = snoozeEnabled, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateChannelResponse CreateChannelResponse( + Channel channel = default) + { + return new CreateChannelResponse + { + Channel = channel, + }; + } + + /// + /// Creates a new instance of . + /// + public static Channel Channel( + string id = default, + string name = default) + { + return new Channel + { + Id = id, + Name = name, + }; + } + + /// + /// Creates a new instance of . + /// + public static JoinChannelResponse JoinChannelResponse( + Channel channel = default, + string warning = default) + { + return new JoinChannelResponse + { + Channel = channel, + Warning = warning, + }; + } + + /// + /// Creates a new instance of . + /// + public static ListChannelsResponse ListChannelsResponse( + List value = default, + string nextLink = default) + { + return new ListChannelsResponse + { + Value = value, + NextLink = nextLink, + }; + } + + /// + /// Creates a new instance of . + /// + public static PostMessageResponse PostMessageResponse( + bool? ok = default, + string channel = default, + string ts = default, + object message = default, + string error = default) + { + return new PostMessageResponse + { + Ok = ok, + Channel = channel, + Ts = ts, + Message = message, + Error = error, + }; + } + + /// + /// Creates a new instance of . + /// + public static PostMessageRequest PostMessageRequest( + string channelName = default, + string messageText = default, + string botName = default, + bool? postAsUser = default, + Parse? parseMode = default, + bool? slackMarkupParsing = default, + int? linkNames = default, + bool? unfurlLinks = default, + bool? unfurlMedia = default, + string iconUrl = default, + string iconEmoji = default) + { + return new PostMessageRequest + { + ChannelName = channelName, + MessageText = messageText, + BotName = botName, + PostAsUser = postAsUser, + ParseMode = parseMode, + SlackMarkupParsing = slackMarkupParsing, + LinkNames = linkNames, + UnfurlLinks = unfurlLinks, + UnfurlMedia = unfurlMedia, + IconUrl = iconUrl, + IconEmoji = iconEmoji, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnNewFile trigger (Slack "When a file is created", operationId: OnNewFile). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<SlackOnNewFileTriggerPayload>(body). + /// + public class SlackOnNewFileTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Slack connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class SlackTriggers + { + /// + /// Trigger operations with typed payloads for the Slack connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnNewFile"] = typeof(SlackOnNewFileTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Slack +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Slack connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class SlackTriggerOperations + { + /// + /// When a file is created. + /// Payload type: . + /// + public const string OnNewFile = "OnNewFile"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Slack connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class SlackTriggerParameters + { + /// + /// Input parameters for the OnNewFile trigger operation (operationId: OnNewFile). + /// + public static class OnNewFile + { + /// + /// The name of the channel. + /// Required. + /// Dynamic values from: ListChannels_V2. + /// + public const string Channel = "channel"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for slack connector. + /// + public class SlackClient : ConnectorClientBase + { + /// + /// Creates a new SlackClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public SlackClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new SlackClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public SlackClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new SlackClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public SlackClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new SlackClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public SlackClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected SlackClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "slack"; + + /// + /// Set do not disturb + /// + /// Set the do not disturb status for the user. + /// Number of minutes + /// Cancellation token. + /// The Set do not disturb response. + public virtual async Task SetDNDAsync(string numberOfMinutes = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (numberOfMinutes != default) + queryParams.Add($"num_minutes={Uri.EscapeDataString(numberOfMinutes.ToString())}"); + var path = $"/dnd.setSnooze" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a channel + /// + /// Create a channel in slack. + /// Name + /// Is Private channel? + /// Cancellation token. + /// The Create a channel response. + public virtual async Task CreateChannelAsync(string name = default, bool? isPrivateChannel = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (name != default) + queryParams.Add($"name={Uri.EscapeDataString(name.ToString())}"); + if (isPrivateChannel.HasValue) + queryParams.Add($"is_private={Uri.EscapeDataString(isPrivateChannel.Value.ToString())}"); + var path = $"/conversations.create" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Join a public channel + /// + /// Join a public channel in slack. + /// Channel Name + /// Cancellation token. + /// The Join a public channel response. + public virtual async Task JoinChannelAsync([DynamicValues("ListChannels_V2")] string channelName = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (channelName != default) + queryParams.Add($"channel={Uri.EscapeDataString(channelName.ToString())}"); + var path = $"/conversations.join" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List public channels (Pagination support) + /// + /// List the public channels in slack. + /// Cancellation token. + /// An async enumerable of items across all pages. + public virtual AsyncPageable ListChannelsAsync(CancellationToken cancellationToken = default) + { + var path = $"/v3/conversations.list"; + return this.CreatePageable( + ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), + (nextLink, ct) => this.CallConnectorAsync(HttpMethod.Get, nextLink, cancellationToken: ct), + cancellationToken); + } + + /// + /// Post message (V2) + /// + /// This operation is used to post a message to the specified channel. + /// The request body. + /// Cancellation token. + /// The Post message (V2) response. + public virtual async Task PostMessageAsync(PostMessageRequest input, CancellationToken cancellationToken = default) + { + var path = $"/v2/chat.postMessage"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/SmtpExtensions.cs b/src/Azure.Connectors.Sdk/Generated/SmtpExtensions.cs index 5a84ab6..932a5cb 100644 --- a/src/Azure.Connectors.Sdk/Generated/SmtpExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/SmtpExtensions.cs @@ -91,28 +91,6 @@ public class Email public List Attachments { get; set; } } - /// - /// Item in Attachments to be sent along with the email - /// - public class AttachmentV2 - { - /// Content data - [JsonPropertyName("ContentData")] - public string ContentData { get; set; } - - /// Content type - [JsonPropertyName("ContentType")] - public string ContentType { get; set; } - - /// File name - [JsonPropertyName("FileName")] - public string FileName { get; set; } - - /// Content id - [JsonPropertyName("ContentId")] - public string ContentId { get; set; } - } - /// /// Extensible enum for known Importance values. /// @@ -226,24 +204,6 @@ public static Email Email( Attachments = attachments, }; } - - /// - /// Creates a new instance of . - /// - public static AttachmentV2 AttachmentV2( - string contentData = default, - string contentType = default, - string fileName = default, - string contentId = default) - { - return new AttachmentV2 - { - ContentData = contentData, - ContentType = contentType, - FileName = fileName, - ContentId = contentId, - }; - } } #endregion Model Factory diff --git a/src/Azure.Connectors.Sdk/Generated/SqlExtensions.cs b/src/Azure.Connectors.Sdk/Generated/SqlExtensions.cs new file mode 100644 index 0000000..a7fefae --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/SqlExtensions.cs @@ -0,0 +1,1533 @@ +// SqlExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Sql.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Sql.Models +{ + + #region Types + + /// + /// Response for List the databases + /// + public class DatabasesList + { + /// List of datasets + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in List of datasets + /// + public class Database + { + /// The name of the database. The name is used at runtime. + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// The display name of the database. + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + + /// Additional database properties provided by the connector to the clients. + [JsonPropertyName("DynamicProperties")] + [JsonInclude] + public object DynamicProperties { get; internal set; } + + /// Database items + [JsonPropertyName("tables")] + [JsonInclude] + public List
Tables { get; internal set; } + } + + /// + /// Item in Database items + /// + public class Table + { + /// The name of the table. The name is used at runtime. + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// The display name of the table. + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + + /// Additional table properties provided by the connector to the clients. + [JsonPropertyName("DynamicProperties")] + [JsonInclude] + public object DynamicProperties { get; internal set; } + } + + /// + /// Response for List the servers + /// + public class ODataServersList + { + /// List of datasets + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in List of datasets + /// + public class Server + { + /// The name of the server. The name is used at runtime. + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// The display name of the server. + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + + /// Additional server properties provided by the connector to the clients. + [JsonPropertyName("DynamicProperties")] + [JsonInclude] + public object DynamicProperties { get; internal set; } + + /// Table items + [JsonPropertyName("databases")] + [JsonInclude] + public List Databases { get; internal set; } + } + + /// + /// Response for Execute a SQL query (V2) + /// + [DynamicSchema("GetPassThroughNativeQueryMetadata_V2")] + public class ExecutePassThroughNativeQueryResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Execute stored procedure (V2) + /// + [DynamicSchema("GetProcedure_V2")] + public class ExecuteProcedureInput + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Execute stored procedure (V2) + /// + [DynamicSchema("GetProcedure_V2")] + public class ExecuteProcedureResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get row (V2) + /// + [DynamicSchema("GetTable_V2")] + public class GetItemResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get rows (V2) + /// + public class GetItemsResponse + { + /// List of Sensitivity Labels + [JsonPropertyName("@metadata")] + public List Metadata { get; set; } + + /// List of Columns + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in List of Sensitivity Labels + /// + public class DataWithSensitivityLabelInfo + { + /// Name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// List of Sensitivity Label Information + [JsonPropertyName("sensitivityLabelInfo")] + public List SensitivityLabelInfo { get; set; } + } + + /// + /// Item in List of Sensitivity Label Information + /// + public class SensitivityLabelMetadata + { + /// SensitivityLabel Id. + [JsonPropertyName("sensitivityLabelId")] + public string SensitivityLabelId { get; set; } + + /// SensitivityLabel name. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// SensitivityLabel displayName info + [JsonPropertyName("displayName")] + public string SensitivityLabelDisplayNameInfo { get; set; } + + /// SensitivityLabel details on tooltip. + [JsonPropertyName("tooltip")] + public string TooltipInfo { get; set; } + + /// SensitivityLabel priority. + [JsonPropertyName("priority")] + public int? PriorityOfSensitivityLabel { get; set; } + + /// SensitivityLabel color. + [JsonPropertyName("color")] + public string ColorToBeDisplayedForSensitivityLabel { get; set; } + + /// is SensitivityLabel Encrypted. + [JsonPropertyName("isEncrypted")] + public bool? IsEncryptedStatusOfSensitivityLabel { get; set; } + + /// Whether SensitivityLabel is Enabled. + [JsonPropertyName("isEnabled")] + public bool? WhetherSensitivityLabelIsEnabled { get; set; } + + /// Whether SensitivityLabel is Parent. + [JsonPropertyName("isParent")] + public bool? WhetherSensitivityLabelIsParent { get; set; } + + /// Parent SensitivityLabel Id. + [JsonPropertyName("parentSensitivityLabelId")] + public string ParentSensitivityLabelId { get; set; } + } + + /// + /// Item in List of Columns + /// + [DynamicSchema("GetTable_V2")] + public class SqlItem + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + + /// dynamicProperties + [JsonPropertyName("dynamicProperties")] + public object DynamicProperties { get; set; } + } + + /// + /// Response for When an item is created (V2) + /// + public class SqlItemsList + { + /// List of Items + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Response for Get pass-through native SQL query metadata + /// + public class PassThroughNativeQueryMetadata + { + /// Query name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Query title + [JsonPropertyName("title")] + public string Title { get; set; } + + /// schema + [JsonPropertyName("schema")] + public ObjectEntity Schema { get; set; } + } + + /// + /// schema + /// + public class ObjectEntity + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Get metadata of a Procedure + /// + public class ProcedureMetadata + { + /// Procedure name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Procedure title + [JsonPropertyName("title")] + public string Title { get; set; } + + /// schema + [JsonPropertyName("schema")] + public ObjectEntity Schema { get; set; } + } + + /// + /// Response for Get stored procedures + /// + public class ProceduresList + { + /// List of Procedures + [JsonPropertyName("value")] + public List Value { get; set; } + } + + /// + /// Item in List of Procedures + /// + public class Procedure + { + /// Procedure name + [JsonPropertyName("Name")] + public string Name { get; set; } + + /// Procedure display name + [JsonPropertyName("DisplayName")] + public string DisplayName { get; set; } + } + + /// + /// Response for Get metadata of a table + /// + public class TableMetadata + { + /// Table name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// Table title + [JsonPropertyName("title")] + public string Title { get; set; } + + /// Table permission + [JsonPropertyName("x-ms-permission")] + public string XMsPermission { get; set; } + + /// x-ms-capabilities + [JsonPropertyName("x-ms-capabilities")] + public TableCapabilitiesMetadata XMsCapabilities { get; set; } + + /// schema + [JsonPropertyName("schema")] + public ObjectEntity Schema { get; set; } + + /// referencedEntities + [JsonPropertyName("referencedEntities")] + public ObjectEntity ReferencedEntities { get; set; } + + /// Url link + [JsonPropertyName("webUrl")] + public string WebUrl { get; set; } + } + + /// + /// x-ms-capabilities + /// + public class TableCapabilitiesMetadata + { + /// sortRestrictions + [JsonPropertyName("sortRestrictions")] + public TableSortRestrictionsMetadata SortRestrictions { get; set; } + + /// filterRestrictions + [JsonPropertyName("filterRestrictions")] + public TableFilterRestrictionsMetadata FilterRestrictions { get; set; } + + /// selectRestrictions + [JsonPropertyName("selectRestrictions")] + public TableSelectRestrictionsMetadata SelectRestrictions { get; set; } + + /// countRestrictions + [JsonPropertyName("countRestrictions")] + public TableCountRestrictionsMetadata CountRestrictions { get; set; } + + /// Server paging restrictions + [JsonPropertyName("isOnlyServerPagable")] + public bool? IsOnlyServerPagable { get; set; } + + /// List of supported filter capabilities + [JsonPropertyName("filterFunctionSupport")] + public List FilterFunctionSupport { get; set; } + + /// List of supported server-driven paging capabilities + [JsonPropertyName("serverPagingOptions")] + public List ServerPagingOptions { get; set; } + } + + /// + /// sortRestrictions + /// + public class TableSortRestrictionsMetadata + { + /// Indicates whether this table has sortable columns + [JsonPropertyName("sortable")] + public bool? Sortable { get; set; } + + /// List of unsortable properties + [JsonPropertyName("unsortableProperties")] + public List UnsortableProperties { get; set; } + + /// List of properties which support ascending order only + [JsonPropertyName("ascendingOnlyProperties")] + public List AscendingOnlyProperties { get; set; } + } + + /// + /// filterRestrictions + /// + public class TableFilterRestrictionsMetadata + { + /// Indicates whether this table has filterable columns + [JsonPropertyName("filterable")] + public bool? Filterable { get; set; } + + /// List of non filterable properties + [JsonPropertyName("nonFilterableProperties")] + public List NonFilterableProperties { get; set; } + + /// List of required properties + [JsonPropertyName("requiredProperties")] + public List RequiredProperties { get; set; } + } + + /// + /// selectRestrictions + /// + public class TableSelectRestrictionsMetadata + { + /// Indicates whether this table has selectable columns + [JsonPropertyName("selectable")] + public bool? Selectable { get; set; } + } + + /// + /// countRestrictions + /// + public class TableCountRestrictionsMetadata + { + /// Indicates whether this table has countable columns + [JsonPropertyName("countable")] + public bool? Countable { get; set; } + } + + /// + /// Response for Get tables (V2) + /// + public class GetTablesResponse + { + /// List of Sensitivity Labels + [JsonPropertyName("@metadata")] + public List Metadata { get; set; } + + /// List of Tables + [JsonPropertyName("value")] + public List
Value { get; set; } + } + + /// + /// Response for GetTablesForDeleteItem + /// + public class TablesList + { + /// List of Tables + [JsonPropertyName("value")] + public List
Value { get; set; } + } + + /// + /// Update row (V2) + /// + [DynamicSchema("GetTableForPatch_V2")] + public class PatchItemInput + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Update row (V2) + /// + [DynamicSchema("GetTable_V2")] + public class PatchItemResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Insert row (V2) + /// + [DynamicSchema("GetTable_V2")] + public class PostItemInput + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Insert row (V2) + /// + [DynamicSchema("GetTable_V2")] + public class PostItemResponse + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// SqlPassThroughNativeQueryBody + /// + public class SqlPassThroughNativeQueryBody + { + /// Actual parameters + [JsonPropertyName("actualParameters")] + public object ActualParameters { get; set; } + + /// Query Text + [JsonPropertyName("query")] + public string Query { get; set; } + + /// Formal Parameters + [JsonPropertyName("formalParameters")] + public object FormalParameters { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Sql models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class SqlModelFactory + { + /// + /// Creates a new instance of . + /// + public static DatabasesList DatabasesList( + List value = default) + { + return new DatabasesList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static Database Database( + string name = default, + string displayName = default, + object dynamicProperties = default, + List
tables = default) + { + return new Database + { + Name = name, + DisplayName = displayName, + DynamicProperties = dynamicProperties, + Tables = tables, + }; + } + + /// + /// Creates a new instance of . + /// + public static Table Table( + string name = default, + string displayName = default, + object dynamicProperties = default) + { + return new Table + { + Name = name, + DisplayName = displayName, + DynamicProperties = dynamicProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static ODataServersList ODataServersList( + List value = default) + { + return new ODataServersList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static Server Server( + string name = default, + string displayName = default, + object dynamicProperties = default, + List databases = default) + { + return new Server + { + Name = name, + DisplayName = displayName, + DynamicProperties = dynamicProperties, + Databases = databases, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetItemsResponse GetItemsResponse( + List metadata = default, + List value = default) + { + return new GetItemsResponse + { + Metadata = metadata, + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static DataWithSensitivityLabelInfo DataWithSensitivityLabelInfo( + string name = default, + List sensitivityLabelInfo = default) + { + return new DataWithSensitivityLabelInfo + { + Name = name, + SensitivityLabelInfo = sensitivityLabelInfo, + }; + } + + /// + /// Creates a new instance of . + /// + public static SensitivityLabelMetadata SensitivityLabelMetadata( + string sensitivityLabelId = default, + string name = default, + string sensitivityLabelDisplayNameInfo = default, + string tooltipInfo = default, + int? priorityOfSensitivityLabel = default, + string colorToBeDisplayedForSensitivityLabel = default, + bool? isEncryptedStatusOfSensitivityLabel = default, + bool? whetherSensitivityLabelIsEnabled = default, + bool? whetherSensitivityLabelIsParent = default, + string parentSensitivityLabelId = default) + { + return new SensitivityLabelMetadata + { + SensitivityLabelId = sensitivityLabelId, + Name = name, + SensitivityLabelDisplayNameInfo = sensitivityLabelDisplayNameInfo, + TooltipInfo = tooltipInfo, + PriorityOfSensitivityLabel = priorityOfSensitivityLabel, + ColorToBeDisplayedForSensitivityLabel = colorToBeDisplayedForSensitivityLabel, + IsEncryptedStatusOfSensitivityLabel = isEncryptedStatusOfSensitivityLabel, + WhetherSensitivityLabelIsEnabled = whetherSensitivityLabelIsEnabled, + WhetherSensitivityLabelIsParent = whetherSensitivityLabelIsParent, + ParentSensitivityLabelId = parentSensitivityLabelId, + }; + } + + /// + /// Creates a new instance of . + /// + public static SqlItem SqlItem( + object dynamicProperties = default) + { + return new SqlItem + { + DynamicProperties = dynamicProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static SqlItemsList SqlItemsList( + List value = default) + { + return new SqlItemsList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static PassThroughNativeQueryMetadata PassThroughNativeQueryMetadata( + string name = default, + string title = default, + ObjectEntity schema = default) + { + return new PassThroughNativeQueryMetadata + { + Name = name, + Title = title, + Schema = schema, + }; + } + + /// + /// Creates a new instance of . + /// + public static ProcedureMetadata ProcedureMetadata( + string name = default, + string title = default, + ObjectEntity schema = default) + { + return new ProcedureMetadata + { + Name = name, + Title = title, + Schema = schema, + }; + } + + /// + /// Creates a new instance of . + /// + public static ProceduresList ProceduresList( + List value = default) + { + return new ProceduresList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static Procedure Procedure( + string name = default, + string displayName = default) + { + return new Procedure + { + Name = name, + DisplayName = displayName, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableMetadata TableMetadata( + string name = default, + string title = default, + string xMsPermission = default, + TableCapabilitiesMetadata xMsCapabilities = default, + ObjectEntity schema = default, + ObjectEntity referencedEntities = default, + string webUrl = default) + { + return new TableMetadata + { + Name = name, + Title = title, + XMsPermission = xMsPermission, + XMsCapabilities = xMsCapabilities, + Schema = schema, + ReferencedEntities = referencedEntities, + WebUrl = webUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableCapabilitiesMetadata TableCapabilitiesMetadata( + TableSortRestrictionsMetadata sortRestrictions = default, + TableFilterRestrictionsMetadata filterRestrictions = default, + TableSelectRestrictionsMetadata selectRestrictions = default, + TableCountRestrictionsMetadata countRestrictions = default, + bool? isOnlyServerPagable = default, + List filterFunctionSupport = default, + List serverPagingOptions = default) + { + return new TableCapabilitiesMetadata + { + SortRestrictions = sortRestrictions, + FilterRestrictions = filterRestrictions, + SelectRestrictions = selectRestrictions, + CountRestrictions = countRestrictions, + IsOnlyServerPagable = isOnlyServerPagable, + FilterFunctionSupport = filterFunctionSupport, + ServerPagingOptions = serverPagingOptions, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableSortRestrictionsMetadata TableSortRestrictionsMetadata( + bool? sortable = default, + List unsortableProperties = default, + List ascendingOnlyProperties = default) + { + return new TableSortRestrictionsMetadata + { + Sortable = sortable, + UnsortableProperties = unsortableProperties, + AscendingOnlyProperties = ascendingOnlyProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableFilterRestrictionsMetadata TableFilterRestrictionsMetadata( + bool? filterable = default, + List nonFilterableProperties = default, + List requiredProperties = default) + { + return new TableFilterRestrictionsMetadata + { + Filterable = filterable, + NonFilterableProperties = nonFilterableProperties, + RequiredProperties = requiredProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableSelectRestrictionsMetadata TableSelectRestrictionsMetadata( + bool? selectable = default) + { + return new TableSelectRestrictionsMetadata + { + Selectable = selectable, + }; + } + + /// + /// Creates a new instance of . + /// + public static TableCountRestrictionsMetadata TableCountRestrictionsMetadata( + bool? countable = default) + { + return new TableCountRestrictionsMetadata + { + Countable = countable, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetTablesResponse GetTablesResponse( + List metadata = default, + List
value = default) + { + return new GetTablesResponse + { + Metadata = metadata, + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static TablesList TablesList( + List
value = default) + { + return new TablesList + { + Value = value, + }; + } + + /// + /// Creates a new instance of . + /// + public static SqlPassThroughNativeQueryBody SqlPassThroughNativeQueryBody( + object actualParameters = default, + string query = default, + object formalParameters = default) + { + return new SqlPassThroughNativeQueryBody + { + ActualParameters = actualParameters, + Query = query, + FormalParameters = formalParameters, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnNewItems trigger (Sql "When an item is created (V2)", operationId: GetOnNewItems_V2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<SqlOnNewItemsTriggerPayload>(body). + /// + public class SqlOnNewItemsTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnUpdatedItems trigger (Sql "When an item is modified (V2)", operationId: GetOnUpdatedItems_V2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<SqlOnUpdatedItemsTriggerPayload>(body). + /// + public class SqlOnUpdatedItemsTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Sql connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class SqlTriggers + { + /// + /// Trigger operations with typed payloads for the Sql connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["GetOnNewItems_V2"] = typeof(SqlOnNewItemsTriggerPayload), + ["GetOnUpdatedItems_V2"] = typeof(SqlOnUpdatedItemsTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Sql +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Sql connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class SqlTriggerOperations + { + /// + /// When an item is created (V2). + /// Payload type: . + /// + public const string OnNewItems = "GetOnNewItems_V2"; + + /// + /// When an item is modified (V2). + /// Payload type: . + /// + public const string OnUpdatedItems = "GetOnUpdatedItems_V2"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Sql connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class SqlTriggerParameters + { + /// + /// Input parameters for the OnNewItems trigger operation (operationId: GetOnNewItems_V2). + /// + public static class OnNewItems + { + /// + /// An ODATA filter query to restrict the entries returned (e.g. stringColumn eq 'string' OR numberColumn lt 123). + /// + public const string Filter = "$filter"; + + /// + /// Total number of entries to retrieve (default = all). + /// + public const string Top = "$top"; + + /// + /// An ODATA orderBy query for specifying the order of entries. + /// + public const string Orderby = "$orderby"; + + /// + /// Specific fields to retrieve from entries (default = all). + /// + public const string Select = "$select"; + + /// + /// Special header to enable operation simulation + /// + public const string XMsOperationContext = "x-ms-operation-context"; + + } + + /// + /// Input parameters for the OnUpdatedItems trigger operation (operationId: GetOnUpdatedItems_V2). + /// + public static class OnUpdatedItems + { + /// + /// An ODATA filter query to restrict the entries returned (e.g. stringColumn eq 'string' OR numberColumn lt 123). + /// + public const string Filter = "$filter"; + + /// + /// Total number of entries to retrieve (default = all). + /// + public const string Top = "$top"; + + /// + /// An ODATA orderBy query for specifying the order of entries. + /// + public const string Orderby = "$orderby"; + + /// + /// Specific fields to retrieve from entries (default = all). + /// + public const string Select = "$select"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for sql connector. + /// + public class SqlClient : ConnectorClientBase + { + /// + /// Creates a new SqlClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public SqlClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new SqlClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public SqlClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new SqlClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public SqlClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new SqlClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public SqlClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected SqlClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "sql"; + + /// + /// List the databases + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Cancellation token. + /// The List the databases response. + public virtual async Task GetDatabasesAsync(string serverName, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"server={Uri.EscapeDataString(serverName.ToString())}"); + var path = $"/databases" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List the servers + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The List the servers response. + public virtual async Task GetServersAsync(CancellationToken cancellationToken = default) + { + var path = $"/servers"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete row (V2) + /// + /// This operation deletes a row from a table. + /// Server name + /// Database name + /// Table name + /// Row id + /// Cancellation token. + public virtual async Task DeleteItemAsync([DynamicValues("GetServers")] string serverName, [DynamicValues("GetDatabases")] string databaseName, [DynamicValues("GetTablesForDeleteItem_V2")] string tableName, string rowId, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tables/{Uri.EscapeDataString(tableName.ToString())}/items/{Uri.EscapeDataString(rowId.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Execute a SQL query (V2) + /// + /// Execute a SQL query (V2) + /// Server name + /// Database name + /// The request body. + /// Cancellation token. + /// The Execute a SQL query (V2) response. + public virtual async Task ExecutePassThroughNativeQueryAsync([DynamicValues("GetServers")] string serverName, [DynamicValues("GetDatabases")] string databaseName, SqlPassThroughNativeQueryBody input, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/query/sql"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Execute stored procedure (V2) + /// + /// This operation runs a stored procedure. + /// Server name + /// Database name + /// Procedure name + /// The request body. + /// Cancellation token. + /// The Execute stored procedure (V2) response. + public virtual async Task ExecuteProcedureAsync([DynamicValues("GetServers")] string serverName, [DynamicValues("GetDatabases")] string databaseName, [DynamicValues("GetProcedures_V2")] string procedureName, ExecuteProcedureInput input, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/procedures/{Uri.EscapeDataString(procedureName.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get row (V2) + /// + /// This operation gets a row from a table. + /// Server name + /// Database name + /// Table name + /// Row id + /// Cancellation token. + /// The Get row (V2) response. + public virtual async Task GetItemAsync([DynamicValues("GetServers")] string serverName, [DynamicValues("GetDatabases")] string databaseName, [DynamicValues("GetTablesForGetItem_V2")] string tableName, string rowId, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tables/{Uri.EscapeDataString(tableName.ToString())}/items/{Uri.EscapeDataString(rowId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get rows (V2) + /// + /// This operation gets rows from a table. + /// Server name + /// Database name + /// Table name + /// Aggregation transformation + /// Filter Query + /// Order By + /// Skip Count + /// Top Count + /// Select Query + /// Count + /// Extract MIP Labels + /// Purview Acccount Name + /// Cancellation token. + /// The Get rows (V2) response. + public virtual async Task GetItemsAsync([DynamicValues("GetServers")] string serverName, [DynamicValues("GetDatabases")] string databaseName, [DynamicValues("GetTables_V2")] string tableName, string aggregationTransformation = default, string filterQuery = default, string orderBy = default, int? skipCount = default, int? topCount = default, string selectQuery = default, bool? count = default, bool? extractMIPLabels = default, string purviewAcccountName = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (aggregationTransformation != default) + queryParams.Add($"$apply={Uri.EscapeDataString(aggregationTransformation.ToString())}"); + if (filterQuery != default) + queryParams.Add($"$filter={Uri.EscapeDataString(filterQuery.ToString())}"); + if (orderBy != default) + queryParams.Add($"$orderby={Uri.EscapeDataString(orderBy.ToString())}"); + if (skipCount.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipCount.Value.ToString())}"); + if (topCount.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(topCount.Value.ToString())}"); + if (selectQuery != default) + queryParams.Add($"$select={Uri.EscapeDataString(selectQuery.ToString())}"); + if (count.HasValue) + queryParams.Add($"$count={Uri.EscapeDataString(count.Value.ToString())}"); + if (extractMIPLabels.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractMIPLabels.Value.ToString())}"); + if (purviewAcccountName != default) + queryParams.Add($"purviewAccountName={Uri.EscapeDataString(purviewAcccountName.ToString())}"); + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tables/{Uri.EscapeDataString(tableName.ToString())}/items" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get pass-through native SQL query metadata + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Database name + /// The request body. + /// Cancellation token. + /// The Get pass-through native SQL query metadata response. + public virtual async Task GetPassThroughNativeQueryMetadataAsync([DynamicValues("GetServers")] string serverName, [DynamicValues("GetDatabases")] string databaseName, SqlPassThroughNativeQueryBody input, CancellationToken cancellationToken = default) + { + var path = $"/v2/$metadata.json/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/query/sql"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get metadata of a Procedure + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Database name + /// Procedure name + /// Cancellation token. + /// The Get metadata of a Procedure response. + public virtual async Task GetProcedureAsync([DynamicValues("GetServers")] string serverName, [DynamicValues("GetDatabases")] string databaseName, [DynamicValues("GetProcedures_V2")] string procedureName, CancellationToken cancellationToken = default) + { + var path = $"/v2/$metadata.json/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/procedures/{Uri.EscapeDataString(procedureName.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get stored procedures + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Database name + /// Cancellation token. + /// The Get stored procedures response. + public virtual async Task GetProceduresAsync([DynamicValues("GetServers")] string serverName, [DynamicValues("GetDatabases")] string databaseName, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/procedures"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get metadata of a table + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Database name + /// Table name + /// Extract MIP Labels + /// Purview Acccount Name + /// Cancellation token. + /// The Get metadata of a table response. + public virtual async Task GetTableAsync(string serverName, string databaseName, [DynamicValues("GetTablesForGetItem_V2")] string tableName, bool? extractMIPLabels = default, string purviewAcccountName = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (extractMIPLabels.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractMIPLabels.Value.ToString())}"); + if (purviewAcccountName != default) + queryParams.Add($"purviewAccountName={Uri.EscapeDataString(purviewAcccountName.ToString())}"); + var path = $"/v2/$metadata.json/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tables/{Uri.EscapeDataString(tableName.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get metadata of a table for Patch operation + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Database name + /// Table name + /// Cancellation token. + /// The Get metadata of a table for Patch operation response. + public virtual async Task GetTableForPatchAsync(string serverName, string databaseName, [DynamicValues("GetTablesForGetItem_V2")] string tableName, CancellationToken cancellationToken = default) + { + var path = $"/v2/$metadata.json/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tables/{Uri.EscapeDataString(tableName.ToString())}/forPatchItem"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get tables (V2) + /// + /// This operation gets tables from a database. + /// Server name + /// Database name + /// Extract MIP Labels + /// Purview Acccount Name + /// Cancellation token. + /// The Get tables (V2) response. + public virtual async Task GetTablesAsync([DynamicValues("GetServers")] string serverName, [DynamicValues("GetDatabases")] string databaseName, bool? extractMIPLabels = default, string purviewAcccountName = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (extractMIPLabels.HasValue) + queryParams.Add($"extractSensitivityLabel={Uri.EscapeDataString(extractMIPLabels.Value.ToString())}"); + if (purviewAcccountName != default) + queryParams.Add($"purviewAccountName={Uri.EscapeDataString(purviewAcccountName.ToString())}"); + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tables" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// GetTablesForDeleteItem + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Database name + /// Cancellation token. + /// The GetTablesForDeleteItem response. + public virtual async Task GetTablesForDeleteItemAsync(string serverName, string databaseName, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tablesfor/deleteitem"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// GetTablesForGetItem + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Database name + /// Cancellation token. + /// The GetTablesForGetItem response. + public virtual async Task GetTablesForGetItemAsync(string serverName, string databaseName, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tablesfor/getitem"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// GetTablesForOnItemCreated + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Database name + /// Cancellation token. + /// The GetTablesForOnItemCreated response. + public virtual async Task GetTablesForGetOnNewItemsAsync(string serverName, string databaseName, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tablesfor/getonnewitems"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// GetTablesForOnItemUpdated + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Database name + /// Cancellation token. + /// The GetTablesForOnItemUpdated response. + public virtual async Task GetTablesForGetOnUpdatedItemsAsync(string serverName, string databaseName, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tablesfor/getonupdateditems"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// GetTablesForPatchItem + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Database name + /// Cancellation token. + /// The GetTablesForPatchItem response. + public virtual async Task GetTablesForPatchItemAsync(string serverName, string databaseName, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tablesfor/patchitem"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// GetTablesForPostItem + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Server name + /// Database name + /// Cancellation token. + /// The GetTablesForPostItem response. + public virtual async Task GetTablesForPostItemAsync(string serverName, string databaseName, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tablesfor/postitem"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update row (V2) + /// + /// This operation updates an existing row in a table. + /// Server name + /// Database name + /// Table name + /// Row id + /// The request body. + /// Cancellation token. + /// The Update row (V2) response. + public virtual async Task PatchItemAsync([DynamicValues("GetServers")] string serverName, [DynamicValues("GetDatabases")] string databaseName, [DynamicValues("GetTablesForPatchItem_V2")] string tableName, string rowId, PatchItemInput input, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tables/{Uri.EscapeDataString(tableName.ToString())}/items/{Uri.EscapeDataString(rowId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Patch, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Insert row (V2) + /// + /// This operation inserts a new row into a table. + /// Server name + /// Database name + /// Table name + /// The request body. + /// Cancellation token. + /// The Insert row (V2) response. + public virtual async Task PostItemAsync([DynamicValues("GetServers")] string serverName, [DynamicValues("GetDatabases")] string databaseName, [DynamicValues("GetTablesForPostItem_V2")] string tableName, PostItemInput input, CancellationToken cancellationToken = default) + { + var path = $"/v2/datasets/{Uri.EscapeDataString(serverName.ToString())},{Uri.EscapeDataString(databaseName.ToString())}/tables/{Uri.EscapeDataString(tableName.ToString())}/items"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/TrelloExtensions.cs b/src/Azure.Connectors.Sdk/Generated/TrelloExtensions.cs new file mode 100644 index 0000000..cf992fb --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/TrelloExtensions.cs @@ -0,0 +1,3258 @@ +// TrelloExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Trello.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Trello.Models +{ + + #region Types + + /// + /// Response for List the cards in a board + /// + public class Card + { + /// The unique id of the card. + [JsonPropertyName("id")] + public string CardId { get; set; } + + /// The check item states in the card. + [JsonPropertyName("checkItemStates")] + public List CheckItemStates { get; set; } + + /// A boolean value (true, false) determining whether or not the card is closed. + [JsonPropertyName("closed")] + public bool? CardClosed { get; set; } + + /// The datetime of last activity on the card. + [JsonPropertyName("dateLastActivity")] + public DateTime? LastActivityDate { get; set; } + + /// The description of the card. + [JsonPropertyName("desc")] + public string CardDescription { get; set; } + + /// The unique Id of the board which the card belongs to. + [JsonPropertyName("idBoard")] + public string BoardId { get; set; } + + /// The unique Id of the list which the card belongs to. + [JsonPropertyName("idList")] + public string ListId { get; set; } + + /// The unique Ids of the voting members. + [JsonPropertyName("idMembersVoted")] + public List VotedMemberIds { get; set; } + + /// The short Id of the card. + [JsonPropertyName("idShort")] + public int? CardShortId { get; set; } + + /// The unique Id of the attachment cover. + [JsonPropertyName("idAttachmentCover")] + public string AttachmentCoverId { get; set; } + + /// A boolean value (true, false) determining whether or not the card has a manual cover attachment. + [JsonPropertyName("manualCoverAttachment")] + public bool? IsManualCoverAttachment { get; set; } + + /// A list of label Ids on the card. + [JsonPropertyName("idLabels")] + public List LabelIds { get; set; } + + /// The name of the card. + [JsonPropertyName("name")] + public string CardName { get; set; } + + /// The position of the card. + [JsonPropertyName("pos")] + public double? CardPosition { get; set; } + + /// A short link to the card. + [JsonPropertyName("shortLink")] + public string CardShortLink { get; set; } + + /// badges + [JsonPropertyName("badges")] + public Badges Badges { get; set; } + + /// The due date of the card. + [JsonPropertyName("due")] + public DateTime? CardDueDate { get; set; } + + /// The short url link to the card. + [JsonPropertyName("shortUrl")] + public string CardShortUrl { get; set; } + + /// A boolean value (true, false) determining whether or not the card is subscribed to. + [JsonPropertyName("subscribed")] + public bool? IsSubscribed { get; set; } + + /// The full url to the card. + [JsonPropertyName("url")] + public string CardFullUrl { get; set; } + + /// The set of board checklists. + [JsonPropertyName("checklists")] + public List Checklists { get; set; } + } + + /// + /// Item in The check item states in the card. + /// + public class CheckItemState + { + /// ID of the check item. + [JsonPropertyName("idCheckItem")] + public string CheckItemId { get; set; } + + /// State of the check item. + [JsonPropertyName("state")] + public string CheckItemStateValue { get; set; } + } + + /// + /// badges + /// + public class Badges + { + /// The number of votes on the card badges. + [JsonPropertyName("Votes")] + public int? Votes { get; set; } + + /// A boolean value (true, false) determining whether or not viewing members voted on the badge. + [JsonPropertyName("ViewingMemberVoted")] + public bool? ViewingMemberVoted { get; set; } + + /// A boolean value (true, false) determining whether or not the account is subscribed to the card badges. + [JsonPropertyName("Subscribed")] + public bool? SubscribedToBadge { get; set; } + + /// The fogbugz of the badges. + [JsonPropertyName("Fogbugz")] + public string Fogbugz { get; set; } + + /// The number of check items in the badge. + [JsonPropertyName("CheckItems")] + public int? CheckItems { get; set; } + + /// The number of checked check items in the badge. + [JsonPropertyName("CheckItemsChecked")] + public int? CheckedCheckItems { get; set; } + + /// The comments on the badge. + [JsonPropertyName("Comments")] + public int? Comments { get; set; } + + /// The attachments on the badge. + [JsonPropertyName("Attachments")] + public int? Attachments { get; set; } + + /// The description of the badge. + [JsonPropertyName("Description")] + public bool? Description { get; set; } + + /// The due date of the badge. + [JsonPropertyName("Due")] + public DateTime? DueDate { get; set; } + } + + /// + /// Item in The set of board checklists. + /// + public class Checklist + { + /// The unique Id of the checklist. + [JsonPropertyName("id")] + public string ChecklistId { get; set; } + + /// The name of the checklist. + [JsonPropertyName("name")] + public string ChecklistName { get; set; } + + /// The position of the checklist. + [JsonPropertyName("pos")] + public int? ChecklistPosition { get; set; } + + /// The unique Id of the board. + [JsonPropertyName("idBoard")] + public string BoardId { get; set; } + + /// The unique Id of the card. + [JsonPropertyName("idCard")] + public string CardId { get; set; } + + /// The list of the checklist items + [JsonPropertyName("checkItems")] + public List Checkitems { get; set; } + } + + /// + /// Item in The list of the checklist items + /// + public class Checkitem + { + /// The unique Id of the checkitem. + [JsonPropertyName("id")] + public string CheckitemId { get; set; } + + /// The name of them checkitem. + [JsonPropertyName("name")] + public string CheckitemName { get; set; } + + /// The nameData of them checkitem. + [JsonPropertyName("nameData")] + public object CheckitemNameData { get; set; } + + /// The position of the checkitem. + [JsonPropertyName("pos")] + public double? CheckitemPosition { get; set; } + + /// The state of the checkitem. + [JsonPropertyName("state")] + public string CheckitemState { get; set; } + + /// The due date of the checkitem. + [JsonPropertyName("due")] + public string CheckitemDueDate { get; set; } + + /// The unique Id of the member. + [JsonPropertyName("idMember")] + public string MemberId { get; set; } + + /// The unique Id of the checklist. + [JsonPropertyName("idChecklist")] + public string ChecklistId { get; set; } + } + + /// + /// Response for Get a card by id + /// + public class CardWithChecklists + { + /// The unique id of the card. + [JsonPropertyName("id")] + public string CardId { get; set; } + + /// The check item states in the card. + [JsonPropertyName("checkItemStates")] + public List CheckItemStates { get; set; } + + /// A boolean value (true, false) determining whether or not the card is closed. + [JsonPropertyName("closed")] + public bool? CardClosed { get; set; } + + /// The datetime of last activity on the card. + [JsonPropertyName("dateLastActivity")] + public DateTime? LastActivityDate { get; set; } + + /// The description of the card. + [JsonPropertyName("desc")] + public string CardDescription { get; set; } + + /// The unique Id of the board which the card belongs to. + [JsonPropertyName("idBoard")] + public string BoardId { get; set; } + + /// The unique Id of the list which the card belongs to. + [JsonPropertyName("idList")] + public string ListId { get; set; } + + /// The unique Ids of the voting members. + [JsonPropertyName("idMembersVoted")] + public List VotedMemberIds { get; set; } + + /// The short Id of the card. + [JsonPropertyName("idShort")] + public int? CardShortId { get; set; } + + /// The unique Id of the attachment cover. + [JsonPropertyName("idAttachmentCover")] + public string AttachmentCoverId { get; set; } + + /// A boolean value (true, false) determining whether or not the card has a manual cover attachment. + [JsonPropertyName("manualCoverAttachment")] + public bool? IsManualCoverAttachment { get; set; } + + /// A list of label Ids on the card. + [JsonPropertyName("idLabels")] + public List LabelIds { get; set; } + + /// The name of the card. + [JsonPropertyName("name")] + public string CardName { get; set; } + + /// The position of the card. + [JsonPropertyName("pos")] + public double? CardPosition { get; set; } + + /// A short link to the card. + [JsonPropertyName("shortLink")] + public string CardShortLink { get; set; } + + /// badges + [JsonPropertyName("badges")] + public Badges Badges { get; set; } + + /// The due date of the card. + [JsonPropertyName("due")] + public DateTime? CardDueDate { get; set; } + + /// The short url link to the card. + [JsonPropertyName("shortUrl")] + public string CardShortUrl { get; set; } + + /// A boolean value (true, false) determining whether or not the card is subscribed to. + [JsonPropertyName("subscribed")] + public bool? IsSubscribed { get; set; } + + /// The full url to the card. + [JsonPropertyName("url")] + public string CardFullUrl { get; set; } + + /// The set of card checklists. + [JsonPropertyName("checklists")] + public List Checklists { get; set; } + } + + /// + /// Response for Delete a card + /// + public class ObjectEntity + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for List boards + /// + public class Board + { + /// The unique Id of the board. + [JsonPropertyName("id")] + public string BoardId { get; set; } + + /// A boolean value (true, false) determining whether or not the board is closed. + [JsonPropertyName("closed")] + public bool? IsClosed { get; set; } + + /// Date of the last activity on the board. + [JsonPropertyName("dateLastActivity")] + public DateTime? LastActivityDate { get; set; } + + /// Date of the last time the board is viewed. + [JsonPropertyName("dateLastView")] + public DateTime? LastViewedDate { get; set; } + + /// The description of the board. + [JsonPropertyName("desc")] + public string BoardDescription { get; set; } + + /// The id of the organization. + [JsonPropertyName("idOrganization")] + public string OrganizationId { get; set; } + + /// The list of invitations on the board. + [JsonPropertyName("invitations")] + public List Invitations { get; set; } + + /// A boolean value (true, false) determining whether or not the account is invited to the board. + [JsonPropertyName("invited")] + public bool? Invited { get; set; } + + /// labelNames + [JsonPropertyName("labelNames")] + public Label LabelNames { get; set; } + + /// The set of board memberships. + [JsonPropertyName("memberships")] + public List BoardMemberships { get; set; } + + /// The name of the board. + [JsonPropertyName("name")] + public string BoardName { get; set; } + + /// A boolean value (true, false) determining whether or not the board is pinned. + [JsonPropertyName("pinned")] + public bool? IsBoardPinned { get; set; } + + /// The set of power ups on the board. + [JsonPropertyName("powerUps")] + public List Powerups { get; set; } + + /// perfs + [JsonPropertyName("perfs")] + public Perfs Perfs { get; set; } + + /// The short link of the board. + [JsonPropertyName("shortLink")] + public string BoardShortLink { get; set; } + + /// The short url to the board. + [JsonPropertyName("shortUrl")] + public string BoardShortUrl { get; set; } + + /// A value determining whether or not the board is starred. + [JsonPropertyName("starred")] + public bool? IsStarred { get; set; } + + /// A value determining whether or not the account is subscribed to the board. + [JsonPropertyName("subscribed")] + public bool? SubscribedToBoard { get; set; } + + /// The full url of the board. + [JsonPropertyName("url")] + public string BoardUrl { get; set; } + } + + /// + /// labelNames + /// + public class Label + { + /// The value of the green label. + [JsonPropertyName("green")] + public string GreenLabel { get; set; } + + /// The value of the yellow label. + [JsonPropertyName("yellow")] + public string YellowLabel { get; set; } + + /// The value of the orange label. + [JsonPropertyName("orange")] + public string OrangeLabel { get; set; } + + /// The value of the red label. + [JsonPropertyName("red")] + public string RedLabel { get; set; } + + /// The value of the purple label. + [JsonPropertyName("purple")] + public string PurpleLabel { get; set; } + + /// The value of the blue label. + [JsonPropertyName("blue")] + public string BlueLabel { get; set; } + + /// The value of the sky blue label. + [JsonPropertyName("sky")] + public string SkyBlueLabel { get; set; } + + /// The value of the lime green label. + [JsonPropertyName("lime")] + public string LimeGreenLabel { get; set; } + + /// The value of the pink label. + [JsonPropertyName("pink")] + public string PinkLabel { get; set; } + + /// The value of the black label. + [JsonPropertyName("black")] + public string BlackLabel { get; set; } + } + + /// + /// Item in The set of board memberships. + /// + public class Membership + { + /// The unique Id of the membership. + [JsonPropertyName("id")] + public string MembershipId { get; set; } + + /// The unique Id of the member. + [JsonPropertyName("idMember")] + public string MemberId { get; set; } + + /// The type of member. + [JsonPropertyName("memberType")] + public string MemberType { get; set; } + + /// A boolean value (true, false) determining whether or not the membership is unconfirmed. + [JsonPropertyName("unconfirmed")] + public bool? UnconfirmedMembership { get; set; } + } + + /// + /// perfs + /// + public class Perfs + { + /// The permission level of the object. + [JsonPropertyName("permissionLevel")] + public string PermissionLevel { get; set; } + + /// Who can vote on the object. + [JsonPropertyName("voting")] + public string VotingPermission { get; set; } + + /// Who can comment on the object. + [JsonPropertyName("comments")] + public string CommentingPermission { get; set; } + + /// Who can invite people to the object. + [JsonPropertyName("invitations")] + public string InvitationPermission { get; set; } + + /// A boolean value (true, false) determining whether or not the object can self join. + [JsonPropertyName("selfJoin")] + public bool? SelfJoinPermission { get; set; } + + /// A boolean value (true, false) determining whether or not the object has access to card covers. + [JsonPropertyName("cardCovers")] + public bool? CanAccessCardCovers { get; set; } + + /// A boolean value (true, false) determining whether or not the calendar feed enabled. + [JsonPropertyName("calendarFeedEnabled")] + public bool? IsCalendarFeedEnabled { get; set; } + + /// The background of the object. + [JsonPropertyName("background")] + public string ObjectBackground { get; set; } + + /// The background color of the object, in hex notation. + [JsonPropertyName("backgroundColor")] + public string ObjectBackgroundColor { get; set; } + + /// The background image of the object. + [JsonPropertyName("backgroundImage")] + public string ObjectBackgroundImage { get; set; } + + /// The scaled version of the background image. + [JsonPropertyName("backgroundImageScaled")] + public string ScaledBackgroundImage { get; set; } + + /// The background tile of the object. + [JsonPropertyName("backgroundTile")] + public bool? ObjectBackgroundTile { get; set; } + + /// The brightness of the object background. + [JsonPropertyName("backgroundBrightness")] + public string BackgroundBrightness { get; set; } + + /// A boolean value (true, false) determining whether or not the object can be public. + [JsonPropertyName("canBePublic")] + public bool? CanObjectBePublic { get; set; } + + /// A boolean value (true, false) determining whether or not the object can be part of the organization + [JsonPropertyName("canBeOrg")] + public bool? CanBePartOfOrganization { get; set; } + + /// A boolean value (true, false) determining whether or not the object can be private. + [JsonPropertyName("canBePrivate")] + public bool? CanObjectBePrivate { get; set; } + + /// A boolean value (true, false) determining whether or not the object can have invititations. + [JsonPropertyName("canInvite")] + public bool? CanInvite { get; set; } + } + + /// + /// Response for Get a board by Id + /// + public class BoardWithChecklists + { + /// The unique Id of the board. + [JsonPropertyName("id")] + public string BoardId { get; set; } + + /// A boolean value (true, false) determining whether or not the board is closed. + [JsonPropertyName("closed")] + public bool? IsClosed { get; set; } + + /// Date of the last activity on the board. + [JsonPropertyName("dateLastActivity")] + public DateTime? LastActivityDate { get; set; } + + /// Date of the last time the board is viewed. + [JsonPropertyName("dateLastView")] + public DateTime? LastViewedDate { get; set; } + + /// The description of the board. + [JsonPropertyName("desc")] + public string BoardDescription { get; set; } + + /// The id of the organization. + [JsonPropertyName("idOrganization")] + public string OrganizationId { get; set; } + + /// The list of invitations on the board. + [JsonPropertyName("invitations")] + public List Invitations { get; set; } + + /// A boolean value (true, false) determining whether or not the account is invited to the board. + [JsonPropertyName("invited")] + public bool? Invited { get; set; } + + /// labelNames + [JsonPropertyName("labelNames")] + public Label LabelNames { get; set; } + + /// The set of board memberships. + [JsonPropertyName("memberships")] + public List BoardMemberships { get; set; } + + /// The name of the board. + [JsonPropertyName("name")] + public string BoardName { get; set; } + + /// A boolean value (true, false) determining whether or not the board is pinned. + [JsonPropertyName("pinned")] + public bool? IsBoardPinned { get; set; } + + /// The set of power ups on the board. + [JsonPropertyName("powerUps")] + public List Powerups { get; set; } + + /// perfs + [JsonPropertyName("perfs")] + public Perfs Perfs { get; set; } + + /// The short link of the board. + [JsonPropertyName("shortLink")] + public string BoardShortLink { get; set; } + + /// The short url to the board. + [JsonPropertyName("shortUrl")] + public string BoardShortUrl { get; set; } + + /// A value determining whether or not the board is starred. + [JsonPropertyName("starred")] + public bool? IsStarred { get; set; } + + /// A value determining whether or not the account is subscribed to the board. + [JsonPropertyName("subscribed")] + public bool? SubscribedToBoard { get; set; } + + /// The full url of the board. + [JsonPropertyName("url")] + public string BoardUrl { get; set; } + + /// The set of board checklists. + [JsonPropertyName("checklists")] + public List Checklists { get; set; } + } + + /// + /// Response for List the card lists in a board + /// + public class List + { + /// The unique Id of the list. + [JsonPropertyName("id")] + public string ListId { get; set; } + + /// The name of the list. + [JsonPropertyName("name")] + public string ListName { get; set; } + + /// A boolean value (true, false) determining whether or not the list is closed. + [JsonPropertyName("closed")] + public bool? IsClosed { get; set; } + + /// The unique Id of the board which the list belongs to. + [JsonPropertyName("idBoard")] + public string BoardId { get; set; } + + /// The position of the list. + [JsonPropertyName("pos")] + public double? ListPosition { get; set; } + + /// A boolean value (true, false) determining whether or not to the account is subscribed to the list. + [JsonPropertyName("subscribed")] + public bool? IsListSubscribedTo { get; set; } + + /// The cards inside the list. + [JsonPropertyName("cards")] + public List CardsInList { get; set; } + + /// board + [JsonPropertyName("board")] + public Board Board { get; set; } + } + + /// + /// Response for Update a list + /// + public class CreateListResponse + { + /// The unique Id of the list. + [JsonPropertyName("id")] + public string ListId { get; set; } + + /// The name of the list. + [JsonPropertyName("name")] + public string ListName { get; set; } + + /// The unique Id of the board the list belongs to. + [JsonPropertyName("idBoard")] + public string BoardId { get; set; } + + /// The position of the list. + [JsonPropertyName("pos")] + public double? ListPosition { get; set; } + } + + /// + /// Response for List teams you are a member of + /// + public class Team + { + /// The unique ID of the team. + [JsonPropertyName("id")] + public string TeamId { get; set; } + + /// The description of the team. + [JsonPropertyName("desc")] + public string TeamDescription { get; set; } + + /// The display name of the team. + [JsonPropertyName("displayName")] + public string TeamDisplayName { get; set; } + + /// The boards assigned to this team. + [JsonPropertyName("idBoards")] + public List BoardIds { get; set; } + + /// The number of members in this team. + [JsonPropertyName("billableMemberCount")] + public int? MemberCount { get; set; } + + /// The memberships for this team. + [JsonPropertyName("memberships")] + public List Memberships { get; set; } + + /// The team website. + [JsonPropertyName("WebSite")] + public string Website { get; set; } + + /// prefs + [JsonPropertyName("prefs")] + public TeamPreferences Prefs { get; set; } + } + + /// + /// prefs + /// + public class TeamPreferences + { + /// The permission level of the team. + [JsonPropertyName("permissionLevel")] + public string PermissionLevel { get; set; } + } + + /// + /// Response for List members of a team + /// + public class Member + { + /// The unique Id of the member. + [JsonPropertyName("id")] + public string MemberId { get; set; } + + /// The full name of the member. + [JsonPropertyName("fullName")] + public string FullName { get; set; } + + /// The username of the member. + [JsonPropertyName("username")] + public string Username { get; set; } + + /// The initials of the member. + [JsonPropertyName("initials")] + public string Initials { get; set; } + } + + /// + /// Response for List labels of a board + /// + public class BoardLabel + { + /// The Label Id + [JsonPropertyName("id")] + public string LabelId { get; set; } + + /// The Label name. + [JsonPropertyName("name")] + public string LabelName { get; set; } + + /// The Label color. + [JsonPropertyName("color")] + public string LabelColor { get; set; } + } + + /// + /// Response for List comments for a card + /// + public class Comment + { + /// memberCreator + [JsonPropertyName("memberCreator")] + public Member MemberCreator { get; set; } + + /// The text of the comment. + [JsonPropertyName("text")] + public string CommentText { get; set; } + + /// The datetime the comment was left. + [JsonPropertyName("date")] + public DateTime? DatetimeCreated { get; set; } + } + + /// + /// Response for When a new card is added to a board (V3) + /// + public class CardInAction + { + /// The unique id of the card. + [JsonPropertyName("id")] + public string CardId { get; set; } + + /// The short Id of the card. + [JsonPropertyName("idShort")] + public int? CardShortId { get; set; } + + /// The name of the card. + [JsonPropertyName("name")] + public string CardName { get; set; } + + /// A short link to the card. + [JsonPropertyName("shortLink")] + public string CardShortLink { get; set; } + + /// The due date of the card. + [JsonPropertyName("due")] + public DateTime? CardDueDate { get; set; } + } + + /// + /// UpdateCard_V2 + /// + public class UpdateCard + { + /// The updated name of the new card. + [JsonPropertyName("name")] + public string Name { get; set; } + + /// The updated description of the new card. + [JsonPropertyName("desc")] + public string Description { get; set; } + + /// A boolean value (true, false) determining whether or not the card is closed. + [JsonPropertyName("closed")] + public bool? IsClosed { get; set; } + + /// An array of member Ids to attach to the card. + [JsonPropertyName("idMembersArray")] + public List MemberIds { get; set; } + + /// The id of the attachment to attach to the card. + [JsonPropertyName("idAttachmentCover")] + public string CoverAttachmentIds { get; set; } + + /// The id of the board to attach the card to. + [JsonPropertyName("idBoard")] + public string BoardId { get; set; } + + /// The id of the list to attach the card to. + [JsonPropertyName("idList")] + public string ListId { get; set; } + + /// The position of the card on the page. Specify top, bottom, or a positive number. Note this is used in relation to existing card locations so the resulting location may not match the exact value provided. + [JsonPropertyName("pos")] + public string Position { get; set; } + + /// The due date of the card. + [JsonPropertyName("due")] + public string DueDate { get; set; } + + /// A boolean value (true, false) determining whether or not to subscribe to the card. + [JsonPropertyName("subscribed")] + public bool? SubscribedToCard { get; set; } + } + + /// + /// CreateCard_V2 + /// + public class CreateCard + { + /// The id of the list that the card should be added to. + [JsonPropertyName("idList")] + public string ParentListId { get; set; } + + /// The name of the new card. + [JsonPropertyName("name")] + public string CardName { get; set; } + + /// The description of the new card. + [JsonPropertyName("desc")] + public string CardDescription { get; set; } + + /// The position of the card. Specify top, bottom, or a positive number. Note this is used in relation to existing card locations so the resulting location may not match the exact value provided. + [JsonPropertyName("pos")] + public Pos? CardPosition { get; set; } + + /// An array of member Ids to attach to the card. + [JsonPropertyName("idMembersArray")] + public List MemberIds { get; set; } + + /// An array of label Ids to attach to the card. + [JsonPropertyName("idLabelsArray")] + public List LabelIds { get; set; } + + /// Source url of the card. Has to be a URL starting with http:// or https:// or null. + [JsonPropertyName("urlSource")] + public string SourceUrl { get; set; } + + /// Source file of the card. + [JsonPropertyName("fileSource")] + public string SourceFile { get; set; } + + /// The Id of the card to copy into a new card. + [JsonPropertyName("idCardSource")] + public string SourceCardId { get; set; } + + /// Properties of the card to copy over from the source. + [JsonPropertyName("keepFromSource")] + public string PropertiesFromSourceCard { get; set; } + + /// The due date of the card. + [JsonPropertyName("due")] + public string DueDate { get; set; } + } + + /// + /// UpdateBoard + /// + public class UpdateBoard + { + /// The name of the board. + [JsonPropertyName("name")] + public string BoardName { get; set; } + + /// A string (true, false) determining whether or not to create default lists. + [JsonPropertyName("defaultLists")] + public DefaultLists? CreateDefaultLists { get; set; } + + /// The description of the board. + [JsonPropertyName("desc")] + public string BoardDescription { get; set; } + + /// The id of the team. + [JsonPropertyName("idOrganization")] + public string TeamId { get; set; } + + /// The permission level of the board. + [JsonPropertyName("prefs_permissionLevel")] + public PrefsPermissionLevel? PermissionLevel { get; set; } + + /// The comment preferences on the board. Valid options are 'disabled', 'members', 'observers', 'org' or 'public'. + [JsonPropertyName("prefs_comments")] + public PrefsComments? CommentPreferences { get; set; } + + /// The invitation preferences of the board. Valid options are 'admins' or 'members'. + [JsonPropertyName("prefs_invitations")] + public PrefsInvitations? InvitationPreferences { get; set; } + + /// A string (true, false) determining whether or not to use card covers. + [JsonPropertyName("prefs_cardCovers")] + public PrefsCardCovers? UseCardCovers { get; set; } + + /// The background color of the board. + [JsonPropertyName("prefs_background")] + public PrefsBackground? BackgroundColor { get; set; } + + /// The voting power-up preferences of the board. + [JsonPropertyName("prefs_voting")] + public PrefsVoting? VotingPowerUpPreferences { get; set; } + + /// The card aging power-up preferences of the board. + [JsonPropertyName("prefs_cardAging")] + public PrefsCardAging? CardAgingPowerUpPreferences { get; set; } + + /// A string (true, false) determining whether or not to enable calendar power-up + [JsonPropertyName("enable_calendar")] + public EnableCalendar? EnableCalendarPowerUp { get; set; } + } + + /// + /// CommentPost + /// + public class CommentPost + { + /// The text of the comment. + [JsonPropertyName("text")] + public string CommentText { get; set; } + } + + /// + /// CreateBoard + /// + public class CreateBoard + { + /// The name of the board. + [JsonPropertyName("name")] + public string BoardName { get; set; } + + /// A string (true, false) determining whether or not to create default lists. + [JsonPropertyName("defaultLists")] + public DefaultLists? CreateDefaultLists { get; set; } + + /// The description of the board. + [JsonPropertyName("desc")] + public string BoardDescription { get; set; } + + /// The id of the team. + [JsonPropertyName("idOrganization")] + public string TeamId { get; set; } + + /// The permission level of the board. Valid options are 'org', 'private', or 'public'. + [JsonPropertyName("prefs_permissionLevel")] + public PrefsPermissionLevel? PermissionLevel { get; set; } + + /// The comment preferences of the board. + [JsonPropertyName("prefs_comments")] + public PrefsComments? CommentPreferences { get; set; } + + /// The invitation preferences of the board. + [JsonPropertyName("prefs_invitations")] + public PrefsInvitations? InvitationPreferences { get; set; } + + /// A string (true, false) determining whether or not to use card covers. + [JsonPropertyName("prefs_cardCovers")] + public PrefsCardCovers? UseCardCovers { get; set; } + + /// The background color of the board. + [JsonPropertyName("prefs_background")] + public PrefsBackground? BackgroundColor { get; set; } + + /// The voting power-up preferences of the board. + [JsonPropertyName("prefs_voting")] + public PrefsVoting? VotingPowerUpPreferences { get; set; } + + /// The card aging power-up preferences of the board. + [JsonPropertyName("prefs_cardAging")] + public PrefsCardAging? CardAgingPowerUpPreferences { get; set; } + + /// A string (true, false) determining whether or not to enable calendar power-up. + [JsonPropertyName("enable_calendar")] + public EnableCalendar? EnableCalendarPowerUp { get; set; } + } + + /// + /// CreateList + /// + public class CreateList + { + /// The name of the list. + [JsonPropertyName("name")] + public string ListName { get; set; } + + /// The unique Id of the board to create the list in. + [JsonPropertyName("idBoard")] + public string BoardId { get; set; } + + /// The position of the list. Specify top, bottom, or a positive number. + [JsonPropertyName("pos")] + public Pos? ListPosition { get; set; } + + /// The id of the list to copy into the new list. + [JsonPropertyName("idListSource")] + public string ListSource { get; set; } + } + + /// + /// Extensible enum for known DefaultLists values. + /// + [JsonConverter(typeof(DefaultLists.DefaultListsJsonConverter))] + public readonly struct DefaultLists : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public DefaultLists(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// true + public static DefaultLists True { get; } = new("true"); + + /// false + public static DefaultLists False { get; } = new("false"); + + /// Converts a string to . + public static implicit operator DefaultLists(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(DefaultLists value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(DefaultLists other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is DefaultLists other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(DefaultLists left, DefaultLists right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(DefaultLists left, DefaultLists right) => !left.Equals(right); + + internal sealed class DefaultListsJsonConverter : JsonConverter + { + public DefaultListsJsonConverter() { } + public override DefaultLists Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for DefaultLists, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, DefaultLists value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known EnableCalendar values. + /// + [JsonConverter(typeof(EnableCalendar.EnableCalendarJsonConverter))] + public readonly struct EnableCalendar : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public EnableCalendar(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// true + public static EnableCalendar True { get; } = new("true"); + + /// false + public static EnableCalendar False { get; } = new("false"); + + /// Converts a string to . + public static implicit operator EnableCalendar(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(EnableCalendar value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(EnableCalendar other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is EnableCalendar other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(EnableCalendar left, EnableCalendar right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(EnableCalendar left, EnableCalendar right) => !left.Equals(right); + + internal sealed class EnableCalendarJsonConverter : JsonConverter + { + public EnableCalendarJsonConverter() { } + public override EnableCalendar Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for EnableCalendar, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, EnableCalendar value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known Pos values. + /// + [JsonConverter(typeof(Pos.PosJsonConverter))] + public readonly struct Pos : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public Pos(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// top + public static Pos Top { get; } = new("top"); + + /// bottom + public static Pos Bottom { get; } = new("bottom"); + + /// Converts a string to . + public static implicit operator Pos(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(Pos value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(Pos other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is Pos other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(Pos left, Pos right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(Pos left, Pos right) => !left.Equals(right); + + internal sealed class PosJsonConverter : JsonConverter + { + public PosJsonConverter() { } + public override Pos Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for Pos, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, Pos value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known PrefsBackground values. + /// + [JsonConverter(typeof(PrefsBackground.PrefsBackgroundJsonConverter))] + public readonly struct PrefsBackground : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public PrefsBackground(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// blue + public static PrefsBackground Blue { get; } = new("blue"); + + /// orange + public static PrefsBackground Orange { get; } = new("orange"); + + /// green + public static PrefsBackground Green { get; } = new("green"); + + /// red + public static PrefsBackground Red { get; } = new("red"); + + /// purple + public static PrefsBackground Purple { get; } = new("purple"); + + /// pink + public static PrefsBackground Pink { get; } = new("pink"); + + /// lime + public static PrefsBackground Lime { get; } = new("lime"); + + /// sky + public static PrefsBackground Sky { get; } = new("sky"); + + /// grey + public static PrefsBackground Grey { get; } = new("grey"); + + /// Converts a string to . + public static implicit operator PrefsBackground(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(PrefsBackground value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(PrefsBackground other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is PrefsBackground other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(PrefsBackground left, PrefsBackground right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(PrefsBackground left, PrefsBackground right) => !left.Equals(right); + + internal sealed class PrefsBackgroundJsonConverter : JsonConverter + { + public PrefsBackgroundJsonConverter() { } + public override PrefsBackground Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for PrefsBackground, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, PrefsBackground value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known PrefsCardAging values. + /// + [JsonConverter(typeof(PrefsCardAging.PrefsCardAgingJsonConverter))] + public readonly struct PrefsCardAging : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public PrefsCardAging(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// disabled + public static PrefsCardAging Disabled { get; } = new("disabled"); + + /// pirate + public static PrefsCardAging Pirate { get; } = new("pirate"); + + /// regular + public static PrefsCardAging Regular { get; } = new("regular"); + + /// Converts a string to . + public static implicit operator PrefsCardAging(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(PrefsCardAging value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(PrefsCardAging other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is PrefsCardAging other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(PrefsCardAging left, PrefsCardAging right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(PrefsCardAging left, PrefsCardAging right) => !left.Equals(right); + + internal sealed class PrefsCardAgingJsonConverter : JsonConverter + { + public PrefsCardAgingJsonConverter() { } + public override PrefsCardAging Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for PrefsCardAging, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, PrefsCardAging value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known PrefsCardCovers values. + /// + [JsonConverter(typeof(PrefsCardCovers.PrefsCardCoversJsonConverter))] + public readonly struct PrefsCardCovers : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public PrefsCardCovers(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// true + public static PrefsCardCovers True { get; } = new("true"); + + /// false + public static PrefsCardCovers False { get; } = new("false"); + + /// Converts a string to . + public static implicit operator PrefsCardCovers(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(PrefsCardCovers value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(PrefsCardCovers other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is PrefsCardCovers other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(PrefsCardCovers left, PrefsCardCovers right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(PrefsCardCovers left, PrefsCardCovers right) => !left.Equals(right); + + internal sealed class PrefsCardCoversJsonConverter : JsonConverter + { + public PrefsCardCoversJsonConverter() { } + public override PrefsCardCovers Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for PrefsCardCovers, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, PrefsCardCovers value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known PrefsComments values. + /// + [JsonConverter(typeof(PrefsComments.PrefsCommentsJsonConverter))] + public readonly struct PrefsComments : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public PrefsComments(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// disabled + public static PrefsComments Disabled { get; } = new("disabled"); + + /// members + public static PrefsComments Members { get; } = new("members"); + + /// observers + public static PrefsComments Observers { get; } = new("observers"); + + /// org + public static PrefsComments Org { get; } = new("org"); + + /// public + public static PrefsComments Public { get; } = new("public"); + + /// Converts a string to . + public static implicit operator PrefsComments(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(PrefsComments value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(PrefsComments other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is PrefsComments other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(PrefsComments left, PrefsComments right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(PrefsComments left, PrefsComments right) => !left.Equals(right); + + internal sealed class PrefsCommentsJsonConverter : JsonConverter + { + public PrefsCommentsJsonConverter() { } + public override PrefsComments Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for PrefsComments, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, PrefsComments value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known PrefsInvitations values. + /// + [JsonConverter(typeof(PrefsInvitations.PrefsInvitationsJsonConverter))] + public readonly struct PrefsInvitations : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public PrefsInvitations(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// admins + public static PrefsInvitations Admins { get; } = new("admins"); + + /// members + public static PrefsInvitations Members { get; } = new("members"); + + /// Converts a string to . + public static implicit operator PrefsInvitations(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(PrefsInvitations value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(PrefsInvitations other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is PrefsInvitations other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(PrefsInvitations left, PrefsInvitations right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(PrefsInvitations left, PrefsInvitations right) => !left.Equals(right); + + internal sealed class PrefsInvitationsJsonConverter : JsonConverter + { + public PrefsInvitationsJsonConverter() { } + public override PrefsInvitations Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for PrefsInvitations, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, PrefsInvitations value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known PrefsPermissionLevel values. + /// + [JsonConverter(typeof(PrefsPermissionLevel.PrefsPermissionLevelJsonConverter))] + public readonly struct PrefsPermissionLevel : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public PrefsPermissionLevel(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// org + public static PrefsPermissionLevel Org { get; } = new("org"); + + /// private + public static PrefsPermissionLevel Private { get; } = new("private"); + + /// public + public static PrefsPermissionLevel Public { get; } = new("public"); + + /// Converts a string to . + public static implicit operator PrefsPermissionLevel(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(PrefsPermissionLevel value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(PrefsPermissionLevel other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is PrefsPermissionLevel other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(PrefsPermissionLevel left, PrefsPermissionLevel right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(PrefsPermissionLevel left, PrefsPermissionLevel right) => !left.Equals(right); + + internal sealed class PrefsPermissionLevelJsonConverter : JsonConverter + { + public PrefsPermissionLevelJsonConverter() { } + public override PrefsPermissionLevel Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for PrefsPermissionLevel, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, PrefsPermissionLevel value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + /// + /// Extensible enum for known PrefsVoting values. + /// + [JsonConverter(typeof(PrefsVoting.PrefsVotingJsonConverter))] + public readonly struct PrefsVoting : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public PrefsVoting(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// disabled + public static PrefsVoting Disabled { get; } = new("disabled"); + + /// members + public static PrefsVoting Members { get; } = new("members"); + + /// observers + public static PrefsVoting Observers { get; } = new("observers"); + + /// org + public static PrefsVoting Org { get; } = new("org"); + + /// public + public static PrefsVoting Public { get; } = new("public"); + + /// Converts a string to . + public static implicit operator PrefsVoting(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(PrefsVoting value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(PrefsVoting other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is PrefsVoting other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(PrefsVoting left, PrefsVoting right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(PrefsVoting left, PrefsVoting right) => !left.Equals(right); + + internal sealed class PrefsVotingJsonConverter : JsonConverter + { + public PrefsVotingJsonConverter() { } + public override PrefsVoting Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for PrefsVoting, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, PrefsVoting value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Trello models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class TrelloModelFactory + { + /// + /// Creates a new instance of . + /// + public static Card Card( + string cardId = default, + List checkItemStates = default, + bool? cardClosed = default, + DateTime? lastActivityDate = default, + string cardDescription = default, + string boardId = default, + string listId = default, + List votedMemberIds = default, + int? cardShortId = default, + string attachmentCoverId = default, + bool? isManualCoverAttachment = default, + List labelIds = default, + string cardName = default, + double? cardPosition = default, + string cardShortLink = default, + Badges badges = default, + DateTime? cardDueDate = default, + string cardShortUrl = default, + bool? isSubscribed = default, + string cardFullUrl = default, + List checklists = default) + { + return new Card + { + CardId = cardId, + CheckItemStates = checkItemStates, + CardClosed = cardClosed, + LastActivityDate = lastActivityDate, + CardDescription = cardDescription, + BoardId = boardId, + ListId = listId, + VotedMemberIds = votedMemberIds, + CardShortId = cardShortId, + AttachmentCoverId = attachmentCoverId, + IsManualCoverAttachment = isManualCoverAttachment, + LabelIds = labelIds, + CardName = cardName, + CardPosition = cardPosition, + CardShortLink = cardShortLink, + Badges = badges, + CardDueDate = cardDueDate, + CardShortUrl = cardShortUrl, + IsSubscribed = isSubscribed, + CardFullUrl = cardFullUrl, + Checklists = checklists, + }; + } + + /// + /// Creates a new instance of . + /// + public static CheckItemState CheckItemState( + string checkItemId = default, + string checkItemStateValue = default) + { + return new CheckItemState + { + CheckItemId = checkItemId, + CheckItemStateValue = checkItemStateValue, + }; + } + + /// + /// Creates a new instance of . + /// + public static Badges Badges( + int? votes = default, + bool? viewingMemberVoted = default, + bool? subscribedToBadge = default, + string fogbugz = default, + int? checkItems = default, + int? checkedCheckItems = default, + int? comments = default, + int? attachments = default, + bool? description = default, + DateTime? dueDate = default) + { + return new Badges + { + Votes = votes, + ViewingMemberVoted = viewingMemberVoted, + SubscribedToBadge = subscribedToBadge, + Fogbugz = fogbugz, + CheckItems = checkItems, + CheckedCheckItems = checkedCheckItems, + Comments = comments, + Attachments = attachments, + Description = description, + DueDate = dueDate, + }; + } + + /// + /// Creates a new instance of . + /// + public static Checklist Checklist( + string checklistId = default, + string checklistName = default, + int? checklistPosition = default, + string boardId = default, + string cardId = default, + List checkitems = default) + { + return new Checklist + { + ChecklistId = checklistId, + ChecklistName = checklistName, + ChecklistPosition = checklistPosition, + BoardId = boardId, + CardId = cardId, + Checkitems = checkitems, + }; + } + + /// + /// Creates a new instance of . + /// + public static Checkitem Checkitem( + string checkitemId = default, + string checkitemName = default, + object checkitemNameData = default, + double? checkitemPosition = default, + string checkitemState = default, + string checkitemDueDate = default, + string memberId = default, + string checklistId = default) + { + return new Checkitem + { + CheckitemId = checkitemId, + CheckitemName = checkitemName, + CheckitemNameData = checkitemNameData, + CheckitemPosition = checkitemPosition, + CheckitemState = checkitemState, + CheckitemDueDate = checkitemDueDate, + MemberId = memberId, + ChecklistId = checklistId, + }; + } + + /// + /// Creates a new instance of . + /// + public static CardWithChecklists CardWithChecklists( + string cardId = default, + List checkItemStates = default, + bool? cardClosed = default, + DateTime? lastActivityDate = default, + string cardDescription = default, + string boardId = default, + string listId = default, + List votedMemberIds = default, + int? cardShortId = default, + string attachmentCoverId = default, + bool? isManualCoverAttachment = default, + List labelIds = default, + string cardName = default, + double? cardPosition = default, + string cardShortLink = default, + Badges badges = default, + DateTime? cardDueDate = default, + string cardShortUrl = default, + bool? isSubscribed = default, + string cardFullUrl = default, + List checklists = default) + { + return new CardWithChecklists + { + CardId = cardId, + CheckItemStates = checkItemStates, + CardClosed = cardClosed, + LastActivityDate = lastActivityDate, + CardDescription = cardDescription, + BoardId = boardId, + ListId = listId, + VotedMemberIds = votedMemberIds, + CardShortId = cardShortId, + AttachmentCoverId = attachmentCoverId, + IsManualCoverAttachment = isManualCoverAttachment, + LabelIds = labelIds, + CardName = cardName, + CardPosition = cardPosition, + CardShortLink = cardShortLink, + Badges = badges, + CardDueDate = cardDueDate, + CardShortUrl = cardShortUrl, + IsSubscribed = isSubscribed, + CardFullUrl = cardFullUrl, + Checklists = checklists, + }; + } + + /// + /// Creates a new instance of . + /// + public static Board Board( + string boardId = default, + bool? isClosed = default, + DateTime? lastActivityDate = default, + DateTime? lastViewedDate = default, + string boardDescription = default, + string organizationId = default, + List invitations = default, + bool? invited = default, + Label labelNames = default, + List boardMemberships = default, + string boardName = default, + bool? isBoardPinned = default, + List powerups = default, + Perfs perfs = default, + string boardShortLink = default, + string boardShortUrl = default, + bool? isStarred = default, + bool? subscribedToBoard = default, + string boardUrl = default) + { + return new Board + { + BoardId = boardId, + IsClosed = isClosed, + LastActivityDate = lastActivityDate, + LastViewedDate = lastViewedDate, + BoardDescription = boardDescription, + OrganizationId = organizationId, + Invitations = invitations, + Invited = invited, + LabelNames = labelNames, + BoardMemberships = boardMemberships, + BoardName = boardName, + IsBoardPinned = isBoardPinned, + Powerups = powerups, + Perfs = perfs, + BoardShortLink = boardShortLink, + BoardShortUrl = boardShortUrl, + IsStarred = isStarred, + SubscribedToBoard = subscribedToBoard, + BoardUrl = boardUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static Label Label( + string greenLabel = default, + string yellowLabel = default, + string orangeLabel = default, + string redLabel = default, + string purpleLabel = default, + string blueLabel = default, + string skyBlueLabel = default, + string limeGreenLabel = default, + string pinkLabel = default, + string blackLabel = default) + { + return new Label + { + GreenLabel = greenLabel, + YellowLabel = yellowLabel, + OrangeLabel = orangeLabel, + RedLabel = redLabel, + PurpleLabel = purpleLabel, + BlueLabel = blueLabel, + SkyBlueLabel = skyBlueLabel, + LimeGreenLabel = limeGreenLabel, + PinkLabel = pinkLabel, + BlackLabel = blackLabel, + }; + } + + /// + /// Creates a new instance of . + /// + public static Membership Membership( + string membershipId = default, + string memberId = default, + string memberType = default, + bool? unconfirmedMembership = default) + { + return new Membership + { + MembershipId = membershipId, + MemberId = memberId, + MemberType = memberType, + UnconfirmedMembership = unconfirmedMembership, + }; + } + + /// + /// Creates a new instance of . + /// + public static Perfs Perfs( + string permissionLevel = default, + string votingPermission = default, + string commentingPermission = default, + string invitationPermission = default, + bool? selfJoinPermission = default, + bool? canAccessCardCovers = default, + bool? isCalendarFeedEnabled = default, + string objectBackground = default, + string objectBackgroundColor = default, + string objectBackgroundImage = default, + string scaledBackgroundImage = default, + bool? objectBackgroundTile = default, + string backgroundBrightness = default, + bool? canObjectBePublic = default, + bool? canBePartOfOrganization = default, + bool? canObjectBePrivate = default, + bool? canInvite = default) + { + return new Perfs + { + PermissionLevel = permissionLevel, + VotingPermission = votingPermission, + CommentingPermission = commentingPermission, + InvitationPermission = invitationPermission, + SelfJoinPermission = selfJoinPermission, + CanAccessCardCovers = canAccessCardCovers, + IsCalendarFeedEnabled = isCalendarFeedEnabled, + ObjectBackground = objectBackground, + ObjectBackgroundColor = objectBackgroundColor, + ObjectBackgroundImage = objectBackgroundImage, + ScaledBackgroundImage = scaledBackgroundImage, + ObjectBackgroundTile = objectBackgroundTile, + BackgroundBrightness = backgroundBrightness, + CanObjectBePublic = canObjectBePublic, + CanBePartOfOrganization = canBePartOfOrganization, + CanObjectBePrivate = canObjectBePrivate, + CanInvite = canInvite, + }; + } + + /// + /// Creates a new instance of . + /// + public static BoardWithChecklists BoardWithChecklists( + string boardId = default, + bool? isClosed = default, + DateTime? lastActivityDate = default, + DateTime? lastViewedDate = default, + string boardDescription = default, + string organizationId = default, + List invitations = default, + bool? invited = default, + Label labelNames = default, + List boardMemberships = default, + string boardName = default, + bool? isBoardPinned = default, + List powerups = default, + Perfs perfs = default, + string boardShortLink = default, + string boardShortUrl = default, + bool? isStarred = default, + bool? subscribedToBoard = default, + string boardUrl = default, + List checklists = default) + { + return new BoardWithChecklists + { + BoardId = boardId, + IsClosed = isClosed, + LastActivityDate = lastActivityDate, + LastViewedDate = lastViewedDate, + BoardDescription = boardDescription, + OrganizationId = organizationId, + Invitations = invitations, + Invited = invited, + LabelNames = labelNames, + BoardMemberships = boardMemberships, + BoardName = boardName, + IsBoardPinned = isBoardPinned, + Powerups = powerups, + Perfs = perfs, + BoardShortLink = boardShortLink, + BoardShortUrl = boardShortUrl, + IsStarred = isStarred, + SubscribedToBoard = subscribedToBoard, + BoardUrl = boardUrl, + Checklists = checklists, + }; + } + + /// + /// Creates a new instance of . + /// + public static List List( + string listId = default, + string listName = default, + bool? isClosed = default, + string boardId = default, + double? listPosition = default, + bool? isListSubscribedTo = default, + List cardsInList = default, + Board board = default) + { + return new List + { + ListId = listId, + ListName = listName, + IsClosed = isClosed, + BoardId = boardId, + ListPosition = listPosition, + IsListSubscribedTo = isListSubscribedTo, + CardsInList = cardsInList, + Board = board, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateListResponse CreateListResponse( + string listId = default, + string listName = default, + string boardId = default, + double? listPosition = default) + { + return new CreateListResponse + { + ListId = listId, + ListName = listName, + BoardId = boardId, + ListPosition = listPosition, + }; + } + + /// + /// Creates a new instance of . + /// + public static Team Team( + string teamId = default, + string teamDescription = default, + string teamDisplayName = default, + List boardIds = default, + int? memberCount = default, + List memberships = default, + string website = default, + TeamPreferences prefs = default) + { + return new Team + { + TeamId = teamId, + TeamDescription = teamDescription, + TeamDisplayName = teamDisplayName, + BoardIds = boardIds, + MemberCount = memberCount, + Memberships = memberships, + Website = website, + Prefs = prefs, + }; + } + + /// + /// Creates a new instance of . + /// + public static TeamPreferences TeamPreferences( + string permissionLevel = default) + { + return new TeamPreferences + { + PermissionLevel = permissionLevel, + }; + } + + /// + /// Creates a new instance of . + /// + public static Member Member( + string memberId = default, + string fullName = default, + string username = default, + string initials = default) + { + return new Member + { + MemberId = memberId, + FullName = fullName, + Username = username, + Initials = initials, + }; + } + + /// + /// Creates a new instance of . + /// + public static BoardLabel BoardLabel( + string labelId = default, + string labelName = default, + string labelColor = default) + { + return new BoardLabel + { + LabelId = labelId, + LabelName = labelName, + LabelColor = labelColor, + }; + } + + /// + /// Creates a new instance of . + /// + public static Comment Comment( + Member memberCreator = default, + string commentText = default, + DateTime? datetimeCreated = default) + { + return new Comment + { + MemberCreator = memberCreator, + CommentText = commentText, + DatetimeCreated = datetimeCreated, + }; + } + + /// + /// Creates a new instance of . + /// + public static CardInAction CardInAction( + string cardId = default, + int? cardShortId = default, + string cardName = default, + string cardShortLink = default, + DateTime? cardDueDate = default) + { + return new CardInAction + { + CardId = cardId, + CardShortId = cardShortId, + CardName = cardName, + CardShortLink = cardShortLink, + CardDueDate = cardDueDate, + }; + } + + /// + /// Creates a new instance of . + /// + public static UpdateCard UpdateCard( + string name = default, + string description = default, + bool? isClosed = default, + List memberIds = default, + string coverAttachmentIds = default, + string boardId = default, + string listId = default, + string position = default, + string dueDate = default, + bool? subscribedToCard = default) + { + return new UpdateCard + { + Name = name, + Description = description, + IsClosed = isClosed, + MemberIds = memberIds, + CoverAttachmentIds = coverAttachmentIds, + BoardId = boardId, + ListId = listId, + Position = position, + DueDate = dueDate, + SubscribedToCard = subscribedToCard, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateCard CreateCard( + string parentListId = default, + string cardName = default, + string cardDescription = default, + Pos? cardPosition = default, + List memberIds = default, + List labelIds = default, + string sourceUrl = default, + string sourceFile = default, + string sourceCardId = default, + string propertiesFromSourceCard = default, + string dueDate = default) + { + return new CreateCard + { + ParentListId = parentListId, + CardName = cardName, + CardDescription = cardDescription, + CardPosition = cardPosition, + MemberIds = memberIds, + LabelIds = labelIds, + SourceUrl = sourceUrl, + SourceFile = sourceFile, + SourceCardId = sourceCardId, + PropertiesFromSourceCard = propertiesFromSourceCard, + DueDate = dueDate, + }; + } + + /// + /// Creates a new instance of . + /// + public static UpdateBoard UpdateBoard( + string boardName = default, + DefaultLists? createDefaultLists = default, + string boardDescription = default, + string teamId = default, + PrefsPermissionLevel? permissionLevel = default, + PrefsComments? commentPreferences = default, + PrefsInvitations? invitationPreferences = default, + PrefsCardCovers? useCardCovers = default, + PrefsBackground? backgroundColor = default, + PrefsVoting? votingPowerUpPreferences = default, + PrefsCardAging? cardAgingPowerUpPreferences = default, + EnableCalendar? enableCalendarPowerUp = default) + { + return new UpdateBoard + { + BoardName = boardName, + CreateDefaultLists = createDefaultLists, + BoardDescription = boardDescription, + TeamId = teamId, + PermissionLevel = permissionLevel, + CommentPreferences = commentPreferences, + InvitationPreferences = invitationPreferences, + UseCardCovers = useCardCovers, + BackgroundColor = backgroundColor, + VotingPowerUpPreferences = votingPowerUpPreferences, + CardAgingPowerUpPreferences = cardAgingPowerUpPreferences, + EnableCalendarPowerUp = enableCalendarPowerUp, + }; + } + + /// + /// Creates a new instance of . + /// + public static CommentPost CommentPost( + string commentText = default) + { + return new CommentPost + { + CommentText = commentText, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateBoard CreateBoard( + string boardName = default, + DefaultLists? createDefaultLists = default, + string boardDescription = default, + string teamId = default, + PrefsPermissionLevel? permissionLevel = default, + PrefsComments? commentPreferences = default, + PrefsInvitations? invitationPreferences = default, + PrefsCardCovers? useCardCovers = default, + PrefsBackground? backgroundColor = default, + PrefsVoting? votingPowerUpPreferences = default, + PrefsCardAging? cardAgingPowerUpPreferences = default, + EnableCalendar? enableCalendarPowerUp = default) + { + return new CreateBoard + { + BoardName = boardName, + CreateDefaultLists = createDefaultLists, + BoardDescription = boardDescription, + TeamId = teamId, + PermissionLevel = permissionLevel, + CommentPreferences = commentPreferences, + InvitationPreferences = invitationPreferences, + UseCardCovers = useCardCovers, + BackgroundColor = backgroundColor, + VotingPowerUpPreferences = votingPowerUpPreferences, + CardAgingPowerUpPreferences = cardAgingPowerUpPreferences, + EnableCalendarPowerUp = enableCalendarPowerUp, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateList CreateList( + string listName = default, + string boardId = default, + Pos? listPosition = default, + string listSource = default) + { + return new CreateList + { + ListName = listName, + BoardId = boardId, + ListPosition = listPosition, + ListSource = listSource, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnNewCardInBoard trigger (Trello "When a new card is added to a board (V3)", operationId: OnNewCardInBoardV3). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<TrelloOnNewCardInBoardTriggerPayload>(body). + /// + public class TrelloOnNewCardInBoardTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Typed trigger payload for the OnNewCardInList trigger (Trello "When a new card is added to a list (V3)", operationId: OnNewCardInListV3). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<TrelloOnNewCardInListTriggerPayload>(body). + /// + public class TrelloOnNewCardInListTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Trello connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class TrelloTriggers + { + /// + /// Trigger operations with typed payloads for the Trello connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnNewCardInBoardV3"] = typeof(TrelloOnNewCardInBoardTriggerPayload), + ["OnNewCardInListV3"] = typeof(TrelloOnNewCardInListTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Trello +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Trello connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class TrelloTriggerOperations + { + /// + /// When a new card is added to a board (V3). + /// Payload type: . + /// + public const string OnNewCardInBoard = "OnNewCardInBoardV3"; + + /// + /// When a new card is added to a list (V3). + /// Payload type: . + /// + public const string OnNewCardInList = "OnNewCardInListV3"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Trello connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class TrelloTriggerParameters + { + /// + /// Input parameters for the OnNewCardInList trigger operation (operationId: OnNewCardInListV3). + /// + public static class OnNewCardInList + { + /// + /// The unique id of the board. + /// Required. + /// Dynamic values from: ListBoardsSimple. + /// + public const string BoardId = "board_id"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for trello connector. + /// + public class TrelloClient : ConnectorClientBase + { + /// + /// Creates a new TrelloClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public TrelloClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new TrelloClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public TrelloClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new TrelloClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public TrelloClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new TrelloClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public TrelloClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected TrelloClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "trello"; + + /// + /// List the cards in a board + /// + /// List the cards matching the query parameters in a specific board. + /// Board Id + /// Actions + /// Attachments + /// Attachment Fields + /// Stickers + /// Members + /// Member Fields + /// Check Card States + /// Checklists + /// Limit + /// Since + /// Before + /// Filter + /// Fields + /// Cancellation token. + /// The List the cards in a board response. + public virtual async Task> ListCardsAsync([DynamicValues("ListBoardsSimple")] string boardId, string actions = default, bool? attachments = default, string attachmentFields = default, bool? stickers = default, bool? members = default, string memberFields = default, bool? checkCardStates = default, string checklists = default, int? limit = default, string since = default, string before = default, string filter = default, string fields = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (actions != default) + queryParams.Add($"actions={Uri.EscapeDataString(actions.ToString())}"); + if (attachments.HasValue) + queryParams.Add($"attachments={Uri.EscapeDataString(attachments.Value.ToString())}"); + if (attachmentFields != default) + queryParams.Add($"attachment_fields={Uri.EscapeDataString(attachmentFields.ToString())}"); + if (stickers.HasValue) + queryParams.Add($"stickers={Uri.EscapeDataString(stickers.Value.ToString())}"); + if (members.HasValue) + queryParams.Add($"members={Uri.EscapeDataString(members.Value.ToString())}"); + if (memberFields != default) + queryParams.Add($"memeber_fields={Uri.EscapeDataString(memberFields.ToString())}"); + if (checkCardStates.HasValue) + queryParams.Add($"checkItemStates={Uri.EscapeDataString(checkCardStates.Value.ToString())}"); + if (checklists != default) + queryParams.Add($"checklists={Uri.EscapeDataString(checklists.ToString())}"); + if (limit.HasValue) + queryParams.Add($"limit={Uri.EscapeDataString(limit.Value.ToString())}"); + if (since != default) + queryParams.Add($"since={Uri.EscapeDataString(since.ToString())}"); + if (before != default) + queryParams.Add($"before={Uri.EscapeDataString(before.ToString())}"); + if (filter != default) + queryParams.Add($"filter={Uri.EscapeDataString(filter.ToString())}"); + if (fields != default) + queryParams.Add($"fields={Uri.EscapeDataString(fields.ToString())}"); + var path = $"/boards/{Uri.EscapeDataString(boardId.ToString())}/cards" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// A simple version of the list cards + /// + /// A simple version of the list cards API method used by dynamic values. + /// Board Id + /// Cancellation token. + /// The A simple version of the list cards response. + public virtual async Task> ListCardsSimpleAsync([DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var path = $"/simple/boards/{Uri.EscapeDataString(boardId.ToString())}/cards"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get a card by id + /// + /// Get a specific card by its unique id. + /// Card Id + /// Board Id + /// Actions + /// Actions Entities + /// Actions Display + /// Actions Limit + /// Action Fields + /// Member Creator Action Fields + /// Attachments + /// Attachments Fields + /// Members + /// Member Fields + /// Voted Members + /// Voted Member Fields + /// Check Item States + /// Item State Fields + /// Checklists + /// Checklist Fields + /// Board + /// Board Fields + /// List + /// List Fields + /// Stickers + /// Sticker Fields + /// Fields + /// Cancellation token. + /// The Get a card by id response. + public virtual async Task GetCardAsync([DynamicValues("ListCardsSimple")] string cardId, [DynamicValues("ListBoardsSimple")] string boardId, string actions = default, bool? actionsEntities = default, bool? actionsDisplay = default, int? actionsLimit = default, string actionFields = default, string memberCreatorActionFields = default, bool? attachments = default, string attachmentsFields = default, bool? members = default, string memberFields = default, bool? votedMembers = default, string votedMemberFields = default, bool? checkItemStates = default, string itemStateFields = default, string checklists = default, string checklistFields = default, bool? board = default, string boardFields = default, bool? list = default, string listFields = default, bool? stickers = default, string stickerFields = default, string fields = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"board_id={Uri.EscapeDataString(boardId.ToString())}"); + if (actions != default) + queryParams.Add($"actions={Uri.EscapeDataString(actions.ToString())}"); + if (actionsEntities.HasValue) + queryParams.Add($"actions_entities={Uri.EscapeDataString(actionsEntities.Value.ToString())}"); + if (actionsDisplay.HasValue) + queryParams.Add($"actions_display={Uri.EscapeDataString(actionsDisplay.Value.ToString())}"); + if (actionsLimit.HasValue) + queryParams.Add($"actions_limit={Uri.EscapeDataString(actionsLimit.Value.ToString())}"); + if (actionFields != default) + queryParams.Add($"action_fields={Uri.EscapeDataString(actionFields.ToString())}"); + if (memberCreatorActionFields != default) + queryParams.Add($"action_memberCreator_fields={Uri.EscapeDataString(memberCreatorActionFields.ToString())}"); + if (attachments.HasValue) + queryParams.Add($"attachments={Uri.EscapeDataString(attachments.Value.ToString())}"); + if (attachmentsFields != default) + queryParams.Add($"attachment_fields={Uri.EscapeDataString(attachmentsFields.ToString())}"); + if (members.HasValue) + queryParams.Add($"members={Uri.EscapeDataString(members.Value.ToString())}"); + if (memberFields != default) + queryParams.Add($"member_fields={Uri.EscapeDataString(memberFields.ToString())}"); + if (votedMembers.HasValue) + queryParams.Add($"membersVoted={Uri.EscapeDataString(votedMembers.Value.ToString())}"); + if (votedMemberFields != default) + queryParams.Add($"memberVoted_fields={Uri.EscapeDataString(votedMemberFields.ToString())}"); + if (checkItemStates.HasValue) + queryParams.Add($"checkItemStates={Uri.EscapeDataString(checkItemStates.Value.ToString())}"); + if (itemStateFields != default) + queryParams.Add($"checkItemState_fields={Uri.EscapeDataString(itemStateFields.ToString())}"); + if (checklists != default) + queryParams.Add($"checklists={Uri.EscapeDataString(checklists.ToString())}"); + if (checklistFields != default) + queryParams.Add($"checklist_fields={Uri.EscapeDataString(checklistFields.ToString())}"); + if (board.HasValue) + queryParams.Add($"board={Uri.EscapeDataString(board.Value.ToString())}"); + if (boardFields != default) + queryParams.Add($"board_fields={Uri.EscapeDataString(boardFields.ToString())}"); + if (list.HasValue) + queryParams.Add($"list={Uri.EscapeDataString(list.Value.ToString())}"); + if (listFields != default) + queryParams.Add($"list_fields={Uri.EscapeDataString(listFields.ToString())}"); + if (stickers.HasValue) + queryParams.Add($"stickers={Uri.EscapeDataString(stickers.Value.ToString())}"); + if (stickerFields != default) + queryParams.Add($"sticker_fields={Uri.EscapeDataString(stickerFields.ToString())}"); + if (fields != default) + queryParams.Add($"fields={Uri.EscapeDataString(fields.ToString())}"); + var path = $"/cards/{Uri.EscapeDataString(cardId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete a card + /// + /// Delete an existing card from the account. + /// Card Id + /// Board Id + /// Cancellation token. + /// The Delete a card response. + public virtual async Task DeleteCardAsync([DynamicValues("ListCardsSimple")] string cardId, [DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"board_id={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/cards/{Uri.EscapeDataString(cardId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List boards + /// + /// List the boards matching the specified query parameters. + /// Filter + /// Fields + /// Actions + /// Action Entities + /// Action Limit + /// Actions Format + /// Actions Since + /// Action Fields + /// Memberships + /// Organization + /// Organization Fields + /// Lists + /// Cancellation token. + /// The List boards response. + public virtual async Task> ListBoardsAsync(string filter = default, string fields = default, string actions = default, bool? actionEntities = default, int? actionLimit = default, string actionsFormat = default, string actionsSince = default, string actionFields = default, string memberships = default, bool? organization = default, string organizationFields = default, string lists = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (filter != default) + queryParams.Add($"filter={Uri.EscapeDataString(filter.ToString())}"); + if (fields != default) + queryParams.Add($"fields={Uri.EscapeDataString(fields.ToString())}"); + if (actions != default) + queryParams.Add($"actions={Uri.EscapeDataString(actions.ToString())}"); + if (actionEntities.HasValue) + queryParams.Add($"actions_entities={Uri.EscapeDataString(actionEntities.Value.ToString())}"); + if (actionLimit.HasValue) + queryParams.Add($"actions_limit={Uri.EscapeDataString(actionLimit.Value.ToString())}"); + if (actionsFormat != default) + queryParams.Add($"actions_format={Uri.EscapeDataString(actionsFormat.ToString())}"); + if (actionsSince != default) + queryParams.Add($"actions_since={Uri.EscapeDataString(actionsSince.ToString())}"); + if (actionFields != default) + queryParams.Add($"action_fields={Uri.EscapeDataString(actionFields.ToString())}"); + if (memberships != default) + queryParams.Add($"memberships={Uri.EscapeDataString(memberships.ToString())}"); + if (organization.HasValue) + queryParams.Add($"organization={Uri.EscapeDataString(organization.Value.ToString())}"); + if (organizationFields != default) + queryParams.Add($"organization_fields={Uri.EscapeDataString(organizationFields.ToString())}"); + if (lists != default) + queryParams.Add($"lists={Uri.EscapeDataString(lists.ToString())}"); + var path = $"/member/me/boards" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// A simple version of the list boards + /// + /// A simple version of the list boards API call with no parameters to be used by dynamic values. + /// Cancellation token. + /// The A simple version of the list boards response. + public virtual async Task> ListBoardsSimpleAsync(CancellationToken cancellationToken = default) + { + var path = $"/simple/member/me/boards"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get a board by Id + /// + /// Get a specific board by its unique identifier. + /// Board Id + /// Actions + /// Action Entities + /// Actions Display + /// Actions Format + /// Actions Since + /// Actions Limit + /// Action Field + /// Action Member + /// Action Member Fields + /// Action Member Creator + /// Action Member Creator Fields + /// Cards + /// Card Fields + /// Card Attachments + /// Card Attachment Fields + /// Card Checklists + /// Card Stickers + /// Board Stars + /// Labels + /// Label Fields + /// Label Limits + /// Lists + /// List Fields + /// Memberships + /// Memberships Member + /// Memberships Member Fields + /// Members + /// Member Fields + /// Invited Members + /// Invited Member Fields + /// Checklists + /// Checklist Fields + /// Organization + /// Organization Fields + /// Organization Memberships + /// My perfs + /// Fields + /// Cancellation token. + /// The Get a board by Id response. + public virtual async Task GetBoardAsync([DynamicValues("ListBoardsSimple")] string boardId, string actions = default, bool? actionEntities = default, bool? actionsDisplay = default, string actionsFormat = default, string actionsSince = default, int? actionsLimit = default, string actionField = default, bool? actionMember = default, string actionMemberFields = default, bool? actionMemberCreator = default, string actionMemberCreatorFields = default, string cards = default, string cardFields = default, bool? cardAttachments = default, string cardAttachmentFields = default, string cardChecklists = default, bool? cardStickers = default, string boardStars = default, string labels = default, string labelFields = default, int? labelLimits = default, string lists = default, string listFields = default, string memberships = default, bool? membershipsMember = default, string membershipsMemberFields = default, string members = default, string memberFields = default, string invitedMembers = default, string invitedMemberFields = default, string checklists = default, string checklistFields = default, bool? organization = default, string organizationFields = default, string organizationMemberships = default, bool? myPerfs = default, string fields = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (actions != default) + queryParams.Add($"actions={Uri.EscapeDataString(actions.ToString())}"); + if (actionEntities.HasValue) + queryParams.Add($"action_entities={Uri.EscapeDataString(actionEntities.Value.ToString())}"); + if (actionsDisplay.HasValue) + queryParams.Add($"actions_display={Uri.EscapeDataString(actionsDisplay.Value.ToString())}"); + if (actionsFormat != default) + queryParams.Add($"actions_format={Uri.EscapeDataString(actionsFormat.ToString())}"); + if (actionsSince != default) + queryParams.Add($"actions_since={Uri.EscapeDataString(actionsSince.ToString())}"); + if (actionsLimit.HasValue) + queryParams.Add($"actions_limit={Uri.EscapeDataString(actionsLimit.Value.ToString())}"); + if (actionField != default) + queryParams.Add($"action_fields={Uri.EscapeDataString(actionField.ToString())}"); + if (actionMember.HasValue) + queryParams.Add($"action_member={Uri.EscapeDataString(actionMember.Value.ToString())}"); + if (actionMemberFields != default) + queryParams.Add($"action_member_fields={Uri.EscapeDataString(actionMemberFields.ToString())}"); + if (actionMemberCreator.HasValue) + queryParams.Add($"action_memberCreator={Uri.EscapeDataString(actionMemberCreator.Value.ToString())}"); + if (actionMemberCreatorFields != default) + queryParams.Add($"action_memberCreator_fields={Uri.EscapeDataString(actionMemberCreatorFields.ToString())}"); + if (cards != default) + queryParams.Add($"cards={Uri.EscapeDataString(cards.ToString())}"); + if (cardFields != default) + queryParams.Add($"card_fields={Uri.EscapeDataString(cardFields.ToString())}"); + if (cardAttachments.HasValue) + queryParams.Add($"card_attachments={Uri.EscapeDataString(cardAttachments.Value.ToString())}"); + if (cardAttachmentFields != default) + queryParams.Add($"card_attachment_fields={Uri.EscapeDataString(cardAttachmentFields.ToString())}"); + if (cardChecklists != default) + queryParams.Add($"card_checklists={Uri.EscapeDataString(cardChecklists.ToString())}"); + if (cardStickers.HasValue) + queryParams.Add($"card_stickers={Uri.EscapeDataString(cardStickers.Value.ToString())}"); + if (boardStars != default) + queryParams.Add($"boardStars={Uri.EscapeDataString(boardStars.ToString())}"); + if (labels != default) + queryParams.Add($"labels={Uri.EscapeDataString(labels.ToString())}"); + if (labelFields != default) + queryParams.Add($"label_fields={Uri.EscapeDataString(labelFields.ToString())}"); + if (labelLimits.HasValue) + queryParams.Add($"labels_limit={Uri.EscapeDataString(labelLimits.Value.ToString())}"); + if (lists != default) + queryParams.Add($"lists={Uri.EscapeDataString(lists.ToString())}"); + if (listFields != default) + queryParams.Add($"list_fields={Uri.EscapeDataString(listFields.ToString())}"); + if (memberships != default) + queryParams.Add($"memberships={Uri.EscapeDataString(memberships.ToString())}"); + if (membershipsMember.HasValue) + queryParams.Add($"memberships_member={Uri.EscapeDataString(membershipsMember.Value.ToString())}"); + if (membershipsMemberFields != default) + queryParams.Add($"memberships_member_fields={Uri.EscapeDataString(membershipsMemberFields.ToString())}"); + if (members != default) + queryParams.Add($"members={Uri.EscapeDataString(members.ToString())}"); + if (memberFields != default) + queryParams.Add($"member_fields={Uri.EscapeDataString(memberFields.ToString())}"); + if (invitedMembers != default) + queryParams.Add($"membersInvited={Uri.EscapeDataString(invitedMembers.ToString())}"); + if (invitedMemberFields != default) + queryParams.Add($"membersInvited_fields={Uri.EscapeDataString(invitedMemberFields.ToString())}"); + if (checklists != default) + queryParams.Add($"checklists={Uri.EscapeDataString(checklists.ToString())}"); + if (checklistFields != default) + queryParams.Add($"checklist_fields={Uri.EscapeDataString(checklistFields.ToString())}"); + if (organization.HasValue) + queryParams.Add($"organization={Uri.EscapeDataString(organization.Value.ToString())}"); + if (organizationFields != default) + queryParams.Add($"organization_fields={Uri.EscapeDataString(organizationFields.ToString())}"); + if (organizationMemberships != default) + queryParams.Add($"organization_memberships={Uri.EscapeDataString(organizationMemberships.ToString())}"); + if (myPerfs.HasValue) + queryParams.Add($"myPerfs={Uri.EscapeDataString(myPerfs.Value.ToString())}"); + if (fields != default) + queryParams.Add($"fields={Uri.EscapeDataString(fields.ToString())}"); + var path = $"/boards/{Uri.EscapeDataString(boardId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update a board + /// + /// Update an existing board. + /// Board Id + /// The request body. + /// Cancellation token. + /// The Update a board response. + public virtual async Task UpdateBoardAsync([DynamicValues("ListBoardsSimple")] string boardId, UpdateBoard input, CancellationToken cancellationToken = default) + { + var path = $"/boards/{Uri.EscapeDataString(boardId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List the card lists in a board + /// + /// List the card lists and the cards within the list in a specific board. + /// Board Id + /// Cards + /// Card Fields + /// Filter + /// Fields + /// Cancellation token. + /// The List the card lists in a board response. + public virtual async Task> ListListsAsync([DynamicValues("ListBoardsSimple")] string boardId, string cards = default, string cardFields = default, string filter = default, string fields = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (cards != default) + queryParams.Add($"cards={Uri.EscapeDataString(cards.ToString())}"); + if (cardFields != default) + queryParams.Add($"card_fields={Uri.EscapeDataString(cardFields.ToString())}"); + if (filter != default) + queryParams.Add($"filter={Uri.EscapeDataString(filter.ToString())}"); + if (fields != default) + queryParams.Add($"fields={Uri.EscapeDataString(fields.ToString())}"); + var path = $"/boards/{Uri.EscapeDataString(boardId.ToString())}/lists" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// A simple version of list lists + /// + /// A simple version of list lists to be used by dynamic values. + /// Board Id + /// Cancellation token. + /// The A simple version of list lists response. + public virtual async Task> ListListsSimpleAsync([DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var path = $"/simple/boards/{Uri.EscapeDataString(boardId.ToString())}/lists"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get list by Id + /// + /// Get an existing list and the cards in the list by the unique identifier of the list. + /// List Id + /// Board Id + /// Cards + /// Card Fields + /// Board + /// Board Fields + /// List Fields + /// Cancellation token. + /// The Get list by Id response. + public virtual async Task GetListAsync([DynamicValues("ListListsSimple")] string listId, [DynamicValues("ListBoardsSimple")] string boardId, string cards = default, string cardFields = default, bool? board = default, string boardFields = default, string listFields = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"board_id={Uri.EscapeDataString(boardId.ToString())}"); + if (cards != default) + queryParams.Add($"cards={Uri.EscapeDataString(cards.ToString())}"); + if (cardFields != default) + queryParams.Add($"card_fields={Uri.EscapeDataString(cardFields.ToString())}"); + if (board.HasValue) + queryParams.Add($"board={Uri.EscapeDataString(board.Value.ToString())}"); + if (boardFields != default) + queryParams.Add($"board_fields={Uri.EscapeDataString(boardFields.ToString())}"); + if (listFields != default) + queryParams.Add($"fields={Uri.EscapeDataString(listFields.ToString())}"); + var path = $"/lists/{Uri.EscapeDataString(listId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update a list + /// + /// Update an existing list. + /// List Id + /// Board Id + /// List Name + /// Closed + /// Board to move to + /// List Position + /// Subscribed + /// Cancellation token. + /// The Update a list response. + public virtual async Task UpdateListAsync([DynamicValues("ListListsSimple")] string listId, [DynamicValues("ListBoardsSimple")] string boardId, string listName = default, string closed = default, [DynamicValues("ListBoardsSimple")] string boardToMoveTo = default, string listPosition = default, string subscribed = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"board_id={Uri.EscapeDataString(boardId.ToString())}"); + if (listName != default) + queryParams.Add($"name={Uri.EscapeDataString(listName.ToString())}"); + if (closed != default) + queryParams.Add($"closed={Uri.EscapeDataString(closed.ToString())}"); + if (boardToMoveTo != default) + queryParams.Add($"idBoard={Uri.EscapeDataString(boardToMoveTo.ToString())}"); + if (listPosition != default) + queryParams.Add($"pos={Uri.EscapeDataString(listPosition.ToString())}"); + if (subscribed != default) + queryParams.Add($"subscribed={Uri.EscapeDataString(subscribed.ToString())}"); + var path = $"/lists/{Uri.EscapeDataString(listId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Put, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get your User Profile info + /// + /// Get information about your User Profile + /// Fields + /// Cancellation token. + /// The Get your User Profile info response. + public virtual async Task GetUserProfileAsync(string fields = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (fields != default) + queryParams.Add($"fields={Uri.EscapeDataString(fields.ToString())}"); + var path = $"/members/me" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List teams you are a member of + /// + /// The list of teams or organizations the account is a member of. + /// Cancellation token. + /// The List teams you are a member of response. + public virtual async Task> ListTeamsAsync(CancellationToken cancellationToken = default) + { + var path = $"/members/me/organizations"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List members of a team + /// + /// List the members in a specific team. + /// Team Id + /// Cancellation token. + /// The List members of a team response. + public virtual async Task> ListTeamMembersAsync([DynamicValues("ListTeams")] string teamId, CancellationToken cancellationToken = default) + { + var path = $"/organizations/{Uri.EscapeDataString(teamId.ToString())}/members"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List members of a board + /// + /// List the members of a specific board. + /// Board Id + /// Cancellation token. + /// The List members of a board response. + public virtual async Task> ListBoardMembersAsync([DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var path = $"/boards/{Uri.EscapeDataString(boardId.ToString())}/members"; + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List labels of a board + /// + /// List the labels of a specific board. + /// Board Id + /// Cancellation token. + /// The List labels of a board response. + public virtual async Task> ListBoardLabelsAsync([DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("limit=1000"); + var path = $"/boards/{Uri.EscapeDataString(boardId.ToString())}/labels" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get the team for a board + /// + /// Get the team details for a specific board. + /// Board Id + /// Cancellation token. + /// The Get the team for a board response. + public virtual async Task GetTeamForBoardAsync([DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var path = $"/boards/{Uri.EscapeDataString(boardId.ToString())}/organization"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List members for a card + /// + /// List the members for a specific card. + /// Card Id + /// Board Id + /// Cancellation token. + /// The List members for a card response. + public virtual async Task> ListCardMembersAsync([DynamicValues("ListCardsSimple")] string cardId, [DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"board_id={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/cards/{Uri.EscapeDataString(cardId.ToString())}/members" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List comments for a card + /// + /// List the comments for a specific card. + /// Card Id + /// Board Id + /// Cancellation token. + /// The List comments for a card response. + public virtual async Task> ListCardCommentsAsync([DynamicValues("ListCardsSimple")] string cardId, [DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"board_id={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/cards/{Uri.EscapeDataString(cardId.ToString())}/actions" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add a comment to a card + /// + /// Add a comment to a specific card. + /// Card Id + /// The request body. + /// Board Id + /// Cancellation token. + /// The Add a comment to a card response. + public virtual async Task AddCommentToCardAsync([DynamicValues("ListCardsSimple")] string cardId, CommentPost input, [DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"board_id={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/cards/{Uri.EscapeDataString(cardId.ToString())}/actions/comments" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add member to a card + /// + /// Add a member to a specific card. + /// Card Id + /// Board Id + /// Member Id or Username + /// Cancellation token. + /// The Add member to a card response. + public virtual async Task> AddMemberToCardAsync([DynamicValues("ListCardsSimple")] string cardId, [DynamicValues("ListBoardsSimple")] string boardId, [DynamicValues("ListBoardMembers")] string memberIdOrUsername, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"board_id={Uri.EscapeDataString(boardId.ToString())}"); + queryParams.Add($"memberId={Uri.EscapeDataString(memberIdOrUsername.ToString())}"); + var path = $"/cards/{Uri.EscapeDataString(cardId.ToString())}/idMembers" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a board + /// + /// Create a new board with the specified fields. + /// The request body. + /// Cancellation token. + /// The Create a board response. + public virtual async Task CreateBoardAsync(CreateBoard input, CancellationToken cancellationToken = default) + { + var path = $"/boards"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a list + /// + /// Create a new list. + /// The request body. + /// Cancellation token. + /// The Create a list response. + public virtual async Task CreateListAsync(CreateList input, CancellationToken cancellationToken = default) + { + var path = $"/lists"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Close a board + /// + /// Set a specific board to closed. + /// Board Id + /// Cancellation token. + /// The Close a board response. + public virtual async Task CloseBoardAsync([DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var path = $"/boards/{Uri.EscapeDataString(boardId.ToString())}/closed"; + return await this + .CallConnectorAsync(HttpMethod.Put, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create a card + /// + /// Creates a new card with the parameters provided. + /// The request body. + /// Board Id + /// Cancellation token. + /// The Create a card response. + public virtual async Task CreateCardAsync(CreateCard input, [DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"board_id={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/v2/cards" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update a card + /// + /// Update an existing card with new parameters. + /// Card id + /// The request body. + /// Board id + /// Cancellation token. + /// The Update a card response. + public virtual async Task UpdateCardAsync([DynamicValues("ListCardsSimple")] string cardId, UpdateCard input, [DynamicValues("ListBoardsSimple")] string boardId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"board_id={Uri.EscapeDataString(boardId.ToString())}"); + var path = $"/v2/cards/{Uri.EscapeDataString(cardId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/TwitterExtensions.cs b/src/Azure.Connectors.Sdk/Generated/TwitterExtensions.cs new file mode 100644 index 0000000..e0ebde2 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/TwitterExtensions.cs @@ -0,0 +1,805 @@ +// TwitterExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Twitter.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Twitter.Models +{ + + #region Types + + /// + /// Response for Get user timeline + /// + public class TweetModel + { + /// Text content of the tweet + [JsonPropertyName("TweetText")] + public string TweetText { get; set; } + + /// Id of the tweet + [JsonPropertyName("TweetId")] + public string TweetId { get; set; } + + /// Time at which the tweet was posted + [JsonPropertyName("CreatedAt")] + public string CreatedAt { get; set; } + + /// Total number of re-tweets for the tweet + [JsonPropertyName("RetweetCount")] + public int? RetweetCount { get; set; } + + /// Name of the user who has posted the tweet + [JsonPropertyName("TweetedBy")] + public string TweetedBy { get; set; } + + /// Url of the media posted along with the tweet + [JsonPropertyName("MediaUrls")] + public List MediaUrls { get; set; } + + /// Language code of the tweet + [JsonPropertyName("TweetLanguageCode")] + public string TweetLanguage { get; set; } + + /// User Id of the author of the tweet that the current tweet is a reply to + [JsonPropertyName("TweetInReplyToUserId")] + public string InReplyToUserId { get; set; } + + /// Indicates whether the tweet is marked as favorited or not + [JsonPropertyName("Favorited")] + public bool? Favorited { get; set; } + + /// List of users mentioned in the tweet + [JsonPropertyName("UserMentions")] + public List UserMentions { get; set; } + + /// OriginalTweet + [JsonPropertyName("OriginalTweet")] + public OriginalTweetModel OriginalTweet { get; set; } + + /// UserDetails + [JsonPropertyName("UserDetails")] + public UserDetailsModel UserDetails { get; set; } + } + + /// + /// Item in List of users mentioned in the tweet + /// + public class UserMentionsModel + { + /// X id (handle) of the user + [JsonPropertyName("Id")] + public long? MentionedUserId { get; set; } + + /// Full name of the user + [JsonPropertyName("FullName")] + public string MentionedUserFullName { get; set; } + + /// Screen name of the user + [JsonPropertyName("UserName")] + public string MentionedUserName { get; set; } + } + + /// + /// OriginalTweet + /// + public class OriginalTweetModel + { + /// Text content of the original retrieved tweet + [JsonPropertyName("TweetText")] + public string OriginalTweetText { get; set; } + + /// Id of the original tweet + [JsonPropertyName("TweetId")] + public string OriginalTweetId { get; set; } + + /// Time at which original tweet was posted + [JsonPropertyName("CreatedAt")] + public string OriginalTweetCreatedAt { get; set; } + + /// Total number of re-tweets for this original tweet + [JsonPropertyName("RetweetCount")] + public int? OriginalTweetRetweetCount { get; set; } + + /// User name of the person who posted the original tweet + [JsonPropertyName("TweetedBy")] + public string OriginalTweetTweetedBy { get; set; } + + /// Url of the media posted along with the original tweet + [JsonPropertyName("MediaUrls")] + public List OriginalTweetMediaUrls { get; set; } + + /// Language code for the original tweet + [JsonPropertyName("TweetLanguageCode")] + public string OriginalTweetLanguage { get; set; } + + /// User Id of the author of the tweet that the current original tweet is a reply to + [JsonPropertyName("TweetInReplyToUserId")] + public string OriginalTweetInReplyToUserId { get; set; } + + /// Indicates whether the original tweet is marked as favorited + [JsonPropertyName("Favorited")] + public bool? OriginalTweetFavorited { get; set; } + + /// The list of user mentioned in the tweet + [JsonPropertyName("UserMentions")] + public List OriginalTweetUserMentions { get; set; } + + /// UserDetails + [JsonPropertyName("UserDetails")] + public OriginalTweetUserDetailsModel UserDetails { get; set; } + } + + /// + /// Item in The list of user mentioned in the tweet + /// + public class OriginalTweetUserMentionsModel + { + /// X id (handle) of the user + [JsonPropertyName("Id")] + public long? OriginalTweetMentionedUserId { get; set; } + + /// Full name of the user + [JsonPropertyName("FullName")] + public string OriginalTweetMentionedUserFullName { get; set; } + + /// Screen name of the user + [JsonPropertyName("UserName")] + public string OriginalTweetMentionedUserName { get; set; } + } + + /// + /// UserDetails + /// + public class OriginalTweetUserDetailsModel + { + /// Name of the user + [JsonPropertyName("FullName")] + public string OriginalTweetUserFullName { get; set; } + + /// Location of the user + [JsonPropertyName("Location")] + public string OriginalTweetUserLocation { get; set; } + + /// X id (handle) of the user + [JsonPropertyName("Id")] + public long? OriginalTweetUserId { get; set; } + + /// Screen name of the user + [JsonPropertyName("UserName")] + public string OriginalTweetUserName { get; set; } + + /// Number of followers + [JsonPropertyName("FollowersCount")] + public long? OriginalTweetUserFollowersCount { get; set; } + + /// User description + [JsonPropertyName("Description")] + public string OriginalTweetUserDescription { get; set; } + + /// User status count + [JsonPropertyName("StatusesCount")] + public long? OriginalTweetUserStatusesCount { get; set; } + + /// Number of friends + [JsonPropertyName("FriendsCount")] + public long? OriginalTweetUserFriendsCount { get; set; } + + /// Number of tweets that the user has favorited + [JsonPropertyName("FavouritesCount")] + public long? OriginalTweetUserFavouritesCount { get; set; } + + /// Url of the profile image + [JsonPropertyName("ProfileImageUrl")] + public string OriginalTweetUserProfileImageUrl { get; set; } + } + + /// + /// UserDetails + /// + public class UserDetailsModel + { + /// Name of the user + [JsonPropertyName("FullName")] + public string Name { get; set; } + + /// Location of the user + [JsonPropertyName("Location")] + public string Location { get; set; } + + /// X id (handle) of the user + [JsonPropertyName("Id")] + public long? UserId { get; set; } + + /// Screen name of the user + [JsonPropertyName("UserName")] + public string UserName { get; set; } + + /// Number of followers + [JsonPropertyName("FollowersCount")] + public long? FollowersCount { get; set; } + + /// User description + [JsonPropertyName("Description")] + public string Description { get; set; } + + /// User status count + [JsonPropertyName("StatusesCount")] + public long? StatusesCount { get; set; } + + /// Number of friends + [JsonPropertyName("FriendsCount")] + public long? FriendsCount { get; set; } + + /// Number of tweets that the user has favorited + [JsonPropertyName("FavouritesCount")] + public long? FavouritesCount { get; set; } + + /// Url of the profile image + [JsonPropertyName("ProfileImageUrl")] + public string ProfileImageUrl { get; set; } + } + + /// + /// Response for Post a tweet + /// + public class TweetResponseModel + { + /// ID of the tweet posted + [JsonPropertyName("TweetId")] + public string TweetId { get; set; } + } + + /// + /// Response for When a new tweet is posted + /// + public class TriggerBatchResponseTweetModel + { + /// A list of the response objects + [JsonPropertyName("value")] + public List Value { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Twitter models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class TwitterModelFactory + { + /// + /// Creates a new instance of . + /// + public static TweetModel TweetModel( + string tweetText = default, + string tweetId = default, + string createdAt = default, + int? retweetCount = default, + string tweetedBy = default, + List mediaUrls = default, + string tweetLanguage = default, + string inReplyToUserId = default, + bool? favorited = default, + List userMentions = default, + OriginalTweetModel originalTweet = default, + UserDetailsModel userDetails = default) + { + return new TweetModel + { + TweetText = tweetText, + TweetId = tweetId, + CreatedAt = createdAt, + RetweetCount = retweetCount, + TweetedBy = tweetedBy, + MediaUrls = mediaUrls, + TweetLanguage = tweetLanguage, + InReplyToUserId = inReplyToUserId, + Favorited = favorited, + UserMentions = userMentions, + OriginalTweet = originalTweet, + UserDetails = userDetails, + }; + } + + /// + /// Creates a new instance of . + /// + public static UserMentionsModel UserMentionsModel( + long? mentionedUserId = default, + string mentionedUserFullName = default, + string mentionedUserName = default) + { + return new UserMentionsModel + { + MentionedUserId = mentionedUserId, + MentionedUserFullName = mentionedUserFullName, + MentionedUserName = mentionedUserName, + }; + } + + /// + /// Creates a new instance of . + /// + public static OriginalTweetModel OriginalTweetModel( + string originalTweetText = default, + string originalTweetId = default, + string originalTweetCreatedAt = default, + int? originalTweetRetweetCount = default, + string originalTweetTweetedBy = default, + List originalTweetMediaUrls = default, + string originalTweetLanguage = default, + string originalTweetInReplyToUserId = default, + bool? originalTweetFavorited = default, + List originalTweetUserMentions = default, + OriginalTweetUserDetailsModel userDetails = default) + { + return new OriginalTweetModel + { + OriginalTweetText = originalTweetText, + OriginalTweetId = originalTweetId, + OriginalTweetCreatedAt = originalTweetCreatedAt, + OriginalTweetRetweetCount = originalTweetRetweetCount, + OriginalTweetTweetedBy = originalTweetTweetedBy, + OriginalTweetMediaUrls = originalTweetMediaUrls, + OriginalTweetLanguage = originalTweetLanguage, + OriginalTweetInReplyToUserId = originalTweetInReplyToUserId, + OriginalTweetFavorited = originalTweetFavorited, + OriginalTweetUserMentions = originalTweetUserMentions, + UserDetails = userDetails, + }; + } + + /// + /// Creates a new instance of . + /// + public static OriginalTweetUserMentionsModel OriginalTweetUserMentionsModel( + long? originalTweetMentionedUserId = default, + string originalTweetMentionedUserFullName = default, + string originalTweetMentionedUserName = default) + { + return new OriginalTweetUserMentionsModel + { + OriginalTweetMentionedUserId = originalTweetMentionedUserId, + OriginalTweetMentionedUserFullName = originalTweetMentionedUserFullName, + OriginalTweetMentionedUserName = originalTweetMentionedUserName, + }; + } + + /// + /// Creates a new instance of . + /// + public static OriginalTweetUserDetailsModel OriginalTweetUserDetailsModel( + string originalTweetUserFullName = default, + string originalTweetUserLocation = default, + long? originalTweetUserId = default, + string originalTweetUserName = default, + long? originalTweetUserFollowersCount = default, + string originalTweetUserDescription = default, + long? originalTweetUserStatusesCount = default, + long? originalTweetUserFriendsCount = default, + long? originalTweetUserFavouritesCount = default, + string originalTweetUserProfileImageUrl = default) + { + return new OriginalTweetUserDetailsModel + { + OriginalTweetUserFullName = originalTweetUserFullName, + OriginalTweetUserLocation = originalTweetUserLocation, + OriginalTweetUserId = originalTweetUserId, + OriginalTweetUserName = originalTweetUserName, + OriginalTweetUserFollowersCount = originalTweetUserFollowersCount, + OriginalTweetUserDescription = originalTweetUserDescription, + OriginalTweetUserStatusesCount = originalTweetUserStatusesCount, + OriginalTweetUserFriendsCount = originalTweetUserFriendsCount, + OriginalTweetUserFavouritesCount = originalTweetUserFavouritesCount, + OriginalTweetUserProfileImageUrl = originalTweetUserProfileImageUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static UserDetailsModel UserDetailsModel( + string name = default, + string location = default, + long? userId = default, + string userName = default, + long? followersCount = default, + string description = default, + long? statusesCount = default, + long? friendsCount = default, + long? favouritesCount = default, + string profileImageUrl = default) + { + return new UserDetailsModel + { + Name = name, + Location = location, + UserId = userId, + UserName = userName, + FollowersCount = followersCount, + Description = description, + StatusesCount = statusesCount, + FriendsCount = friendsCount, + FavouritesCount = favouritesCount, + ProfileImageUrl = profileImageUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static TweetResponseModel TweetResponseModel( + string tweetId = default) + { + return new TweetResponseModel + { + TweetId = tweetId, + }; + } + + /// + /// Creates a new instance of . + /// + public static TriggerBatchResponseTweetModel TriggerBatchResponseTweetModel( + List value = default) + { + return new TriggerBatchResponseTweetModel + { + Value = value, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnNewTweet trigger (Twitter "When a new tweet is posted", operationId: OnNewTweet). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<TwitterOnNewTweetTriggerPayload>(body). + /// + public class TwitterOnNewTweetTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Twitter connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class TwitterTriggers + { + /// + /// Trigger operations with typed payloads for the Twitter connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["OnNewTweet"] = typeof(TwitterOnNewTweetTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Twitter +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Twitter connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class TwitterTriggerOperations + { + /// + /// When a new tweet is posted. + /// Payload type: . + /// + public const string OnNewTweet = "OnNewTweet"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Twitter connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class TwitterTriggerParameters + { + /// + /// Input parameters for the OnNewTweet trigger operation (operationId: OnNewTweet). + /// + public static class OnNewTweet + { + /// + /// Search term like "happy hour", #haiku, from:@username, love OR hate. + /// Required. + /// + public const string SearchQuery = "searchQuery"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for twitter connector. + /// + public class TwitterClient : ConnectorClientBase + { + /// + /// Creates a new TwitterClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public TwitterClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new TwitterClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public TwitterClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new TwitterClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public TwitterClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new TwitterClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public TwitterClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected TwitterClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "twitter"; + + /// + /// Get user timeline + /// + /// This operation gets a list of the most recent tweets posted by a given user. + /// User name + /// Maximum results + /// Cancellation token. + /// The Get user timeline response. + public virtual async Task> UserTimelineAsync(string userName, int? maximumResults = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"userName={Uri.EscapeDataString(userName.ToString())}"); + if (maximumResults.HasValue) + queryParams.Add($"maxResults={Uri.EscapeDataString(maximumResults.Value.ToString())}"); + var path = $"/usertimeline" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get home timeline + /// + /// This operation gets the most recent tweets and re-tweets posted by me and my followers. + /// Maximum results + /// Cancellation token. + /// The Get home timeline response. + public virtual async Task> HomeTimelineAsync(int? maximumResults = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (maximumResults.HasValue) + queryParams.Add($"maxResults={Uri.EscapeDataString(maximumResults.Value.ToString())}"); + var path = $"/hometimeline" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Search tweets + /// + /// This operation gets a list of relevant tweets matching the search query. + /// Search text + /// Maximum results + /// sinceId + /// Cancellation token. + /// The Search tweets response. + public virtual async Task> SearchTweetAsync(string searchText, int? maximumResults = default, string sinceId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"searchQuery={Uri.EscapeDataString(searchText.ToString())}"); + if (maximumResults.HasValue) + queryParams.Add($"maxResults={Uri.EscapeDataString(maximumResults.Value.ToString())}"); + if (sinceId != default) + queryParams.Add($"sinceId={Uri.EscapeDataString(sinceId.ToString())}"); + var path = $"/searchtweets" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get followers + /// + /// This operation gets the list of users that follow a given user. + /// User name + /// Maximum results + /// Cancellation token. + /// The Get followers response. + public virtual async Task> FollowersAsync(string userName, int? maximumResults = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"userName={Uri.EscapeDataString(userName.ToString())}"); + if (maximumResults.HasValue) + queryParams.Add($"maxResults={Uri.EscapeDataString(maximumResults.Value.ToString())}"); + var path = $"/followers" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get my followers + /// + /// This operation gets the list of users who are following me. + /// Maximum results + /// Cancellation token. + /// The Get my followers response. + public virtual async Task> MyFollowersAsync(int? maximumResults = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (maximumResults.HasValue) + queryParams.Add($"maxResults={Uri.EscapeDataString(maximumResults.Value.ToString())}"); + var path = $"/myfollowers" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get following + /// + /// The operation gets the list of people the given user follows. + /// User name + /// Maximum results + /// Cancellation token. + /// The Get following response. + public virtual async Task> FollowingAsync(string userName, int? maximumResults = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"userName={Uri.EscapeDataString(userName.ToString())}"); + if (maximumResults.HasValue) + queryParams.Add($"maxResults={Uri.EscapeDataString(maximumResults.Value.ToString())}"); + var path = $"/friends" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get my following + /// + /// This operation gets the list of users that I am following. + /// Maximum results + /// Cancellation token. + /// The Get my following response. + public virtual async Task> MyFollowingAsync(int? maximumResults = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (maximumResults.HasValue) + queryParams.Add($"maxResults={Uri.EscapeDataString(maximumResults.Value.ToString())}"); + var path = $"/myfriends" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get user + /// + /// This operation gets the profile details for a given user, such as user name, description, followers count, and more. + /// User name + /// Cancellation token. + /// The Get user response. + public virtual async Task UserAsync(string userName, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"userName={Uri.EscapeDataString(userName.ToString())}"); + var path = $"/user" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Post a tweet + /// + /// This operation posts a new tweet. + /// The request body. + /// Tweet text + /// Cancellation token. + /// The Post a tweet response. + public virtual async Task TweetAsync(byte[] input, string tweetText = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (tweetText != default) + queryParams.Add($"tweetText={Uri.EscapeDataString(tweetText.ToString())}"); + var path = $"/posttweet" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Retweet + /// + /// This operation retweets a tweet. + /// Tweet id + /// Trim user + /// Cancellation token. + /// The Retweet response. + public virtual async Task RetweetAsync(string tweetId, bool? trimUser = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"tweetId={Uri.EscapeDataString(tweetId.ToString())}"); + if (trimUser.HasValue) + queryParams.Add($"trimUser={Uri.EscapeDataString(trimUser.Value.ToString())}"); + var path = $"/retweet" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/TypeformExtensions.cs b/src/Azure.Connectors.Sdk/Generated/TypeformExtensions.cs new file mode 100644 index 0000000..6c21595 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/TypeformExtensions.cs @@ -0,0 +1,266 @@ +// TypeformExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Typeform.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Typeform.Models +{ + + #region Types + + /// + /// Response for List forms + /// + public class ListFormsResponse + { + /// Total number of forms. + [JsonPropertyName("total_items")] + public int? TotalItems { get; set; } + + /// Number of pages of results. + [JsonPropertyName("page_count")] + public int? PageCount { get; set; } + + /// Forms in response. + [JsonPropertyName("items")] + public List Items { get; set; } + } + + /// + /// When a response is submitted + /// + public class NewResponseWebhookInput + { + /// Webhook URL. + [JsonPropertyName("url")] + public string Url { get; set; } + + /// Yes if you want to send responses to the webhook immediately. Otherwise, no. + [JsonPropertyName("enabled")] + public bool? Enabled { get; set; } + } + + /// + /// Response for When a response is submitted + /// + public class WebhookCreationResponse + { + /// Unique ID of the webhook + [JsonPropertyName("id")] + public string Id { get; set; } + + /// Unique ID of the typeform + [JsonPropertyName("form_id")] + public string FormId { get; set; } + + /// Unique name you want to use for the webhook + [JsonPropertyName("tag")] + public string Tag { get; set; } + + /// Webhook URL + [JsonPropertyName("url")] + public string Url { get; set; } + + /// True if you want to send responses to the webhook immediately. Otherwise, false. + [JsonPropertyName("enabled")] + public bool? Enabled { get; set; } + + /// Date and time when webhook was created. In ISO 8601 format, UTC time, to the second, with T as a delimiter between the date and time. + [JsonPropertyName("created_at")] + public DateTime? CreatedAt { get; set; } + + /// Date of last update to webhook. In ISO 8601 format, UTC time, to the second, with T as a delimeter between the date and time. + [JsonPropertyName("updated_at")] + public DateTime? UpdatedAt { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Typeform models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class TypeformModelFactory + { + /// + /// Creates a new instance of . + /// + public static ListFormsResponse ListFormsResponse( + int? totalItems = default, + int? pageCount = default, + List items = default) + { + return new ListFormsResponse + { + TotalItems = totalItems, + PageCount = pageCount, + Items = items, + }; + } + + /// + /// Creates a new instance of . + /// + public static NewResponseWebhookInput NewResponseWebhookInput( + string url = default, + bool? enabled = default) + { + return new NewResponseWebhookInput + { + Url = url, + Enabled = enabled, + }; + } + + /// + /// Creates a new instance of . + /// + public static WebhookCreationResponse WebhookCreationResponse( + string id = default, + string formId = default, + string tag = default, + string url = default, + bool? enabled = default, + DateTime? createdAt = default, + DateTime? updatedAt = default) + { + return new WebhookCreationResponse + { + Id = id, + FormId = formId, + Tag = tag, + Url = url, + Enabled = enabled, + CreatedAt = createdAt, + UpdatedAt = updatedAt, + }; + } + } + + #endregion Model Factory + +} + +namespace Azure.Connectors.Sdk.Typeform +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Typeform connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class TypeformTriggerOperations + { + /// + /// When a response is submitted. + /// + public const string OnNewResponseWebhook = "NewResponseWebhook_V2"; + + } + + #endregion Trigger Operation Constants + + #region Client + + /// + /// Typed client for typeform connector. + /// + public class TypeformClient : ConnectorClientBase + { + /// + /// Creates a new TypeformClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public TypeformClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new TypeformClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public TypeformClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new TypeformClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public TypeformClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new TypeformClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public TypeformClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected TypeformClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "typeform"; + + /// + /// List forms + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// search + /// page + /// page_size + /// workspace_id + /// Cancellation token. + /// The List forms response. + public virtual async Task ListFormsAsync(string search = default, int? page = default, int? pageSize = default, string workspaceId = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (search != default) + queryParams.Add($"search={Uri.EscapeDataString(search.ToString())}"); + if (page.HasValue) + queryParams.Add($"page={Uri.EscapeDataString(page.Value.ToString())}"); + if (pageSize.HasValue) + queryParams.Add($"page_size={Uri.EscapeDataString(pageSize.Value.ToString())}"); + if (workspaceId != default) + queryParams.Add($"workspace_id={Uri.EscapeDataString(workspaceId.ToString())}"); + var path = $"/forms" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/WdatpExtensions.cs b/src/Azure.Connectors.Sdk/Generated/WdatpExtensions.cs index f7bedae..1a0fe84 100644 --- a/src/Azure.Connectors.Sdk/Generated/WdatpExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/WdatpExtensions.cs @@ -2553,7 +2553,7 @@ public virtual async Task CreateAlertByReferenceAsync(CreateAlertByRefere /// Includes count /// Cancellation token. /// An async enumerable of items across all pages. - public virtual AsyncPageable GetAlertsAsync(string expandsEntities = default, string filtersResults = default, string selectsProperties = default, string sortsResults = default, int returnsFirstResults = default, int skipsFirstResults = default, bool includesCount = default, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetAlertsAsync(string expandsEntities = default, string filtersResults = default, string selectsProperties = default, string sortsResults = default, int? returnsFirstResults = default, int? skipsFirstResults = default, bool? includesCount = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (expandsEntities != default) @@ -2564,12 +2564,12 @@ public virtual AsyncPageable GetAlertsAsync(string expandsEntities = defa queryParams.Add($"$select={Uri.EscapeDataString(selectsProperties.ToString())}"); if (sortsResults != default) queryParams.Add($"$orderby={Uri.EscapeDataString(sortsResults.ToString())}"); - if (returnsFirstResults != default) - queryParams.Add($"$top={Uri.EscapeDataString(returnsFirstResults.ToString())}"); - if (skipsFirstResults != default) - queryParams.Add($"$skip={Uri.EscapeDataString(skipsFirstResults.ToString())}"); - if (includesCount != default) - queryParams.Add($"$count={Uri.EscapeDataString(includesCount.ToString())}"); + if (returnsFirstResults.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(returnsFirstResults.Value.ToString())}"); + if (skipsFirstResults.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipsFirstResults.Value.ToString())}"); + if (includesCount.HasValue) + queryParams.Add($"$count={Uri.EscapeDataString(includesCount.Value.ToString())}"); var path = $"/api/alerts" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), @@ -2699,7 +2699,7 @@ public virtual async Task GetLiveResponseDo /// Includes count /// Cancellation token. /// An async enumerable of items across all pages. - public virtual AsyncPageable GetMachineActionsAsync(string filtersResults = default, string selectsProperties = default, string sortsResults = default, int returnsFirstResults = default, int skipsFirstResults = default, bool includesCount = default, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetMachineActionsAsync(string filtersResults = default, string selectsProperties = default, string sortsResults = default, int? returnsFirstResults = default, int? skipsFirstResults = default, bool? includesCount = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (filtersResults != default) @@ -2708,12 +2708,12 @@ public virtual AsyncPageable GetMachineActionsAsync(string filter queryParams.Add($"$select={Uri.EscapeDataString(selectsProperties.ToString())}"); if (sortsResults != default) queryParams.Add($"$orderby={Uri.EscapeDataString(sortsResults.ToString())}"); - if (returnsFirstResults != default) - queryParams.Add($"$top={Uri.EscapeDataString(returnsFirstResults.ToString())}"); - if (skipsFirstResults != default) - queryParams.Add($"$skip={Uri.EscapeDataString(skipsFirstResults.ToString())}"); - if (includesCount != default) - queryParams.Add($"$count={Uri.EscapeDataString(includesCount.ToString())}"); + if (returnsFirstResults.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(returnsFirstResults.Value.ToString())}"); + if (skipsFirstResults.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipsFirstResults.Value.ToString())}"); + if (includesCount.HasValue) + queryParams.Add($"$count={Uri.EscapeDataString(includesCount.Value.ToString())}"); var path = $"/api/machineactions" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), @@ -2729,11 +2729,11 @@ public virtual AsyncPageable GetMachineActionsAsync(string filter /// The look back period in hours to look by, the default is 24 hours. /// Cancellation token. /// The Files - Get the statistics for the given file response. - public virtual async Task GetFileStatsAsync(string theFileIdentifierSha1OrSha256, int theLookBackPeriodInHoursToLookByTheDefaultIs24Hours = default, CancellationToken cancellationToken = default) + public virtual async Task GetFileStatsAsync(string theFileIdentifierSha1OrSha256, int? theLookBackPeriodInHoursToLookByTheDefaultIs24Hours = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (theLookBackPeriodInHoursToLookByTheDefaultIs24Hours != default) - queryParams.Add($"lookBackHours={Uri.EscapeDataString(theLookBackPeriodInHoursToLookByTheDefaultIs24Hours.ToString())}"); + if (theLookBackPeriodInHoursToLookByTheDefaultIs24Hours.HasValue) + queryParams.Add($"lookBackHours={Uri.EscapeDataString(theLookBackPeriodInHoursToLookByTheDefaultIs24Hours.Value.ToString())}"); var path = $"/api/files/{Uri.EscapeDataString(theFileIdentifierSha1OrSha256.ToString())}/stats" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -2748,11 +2748,11 @@ public virtual async Task GetFileStatsAsync(string theFileIdentifierS /// The look back period in hours to look by, the default is 24 hours. /// Cancellation token. /// The Domains - Get the statistics for the given domain name response. - public virtual async Task GetDomainStatsAsync(string theDomainName, int theLookBackPeriodInHoursToLookByTheDefaultIs24Hours = default, CancellationToken cancellationToken = default) + public virtual async Task GetDomainStatsAsync(string theDomainName, int? theLookBackPeriodInHoursToLookByTheDefaultIs24Hours = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (theLookBackPeriodInHoursToLookByTheDefaultIs24Hours != default) - queryParams.Add($"lookBackHours={Uri.EscapeDataString(theLookBackPeriodInHoursToLookByTheDefaultIs24Hours.ToString())}"); + if (theLookBackPeriodInHoursToLookByTheDefaultIs24Hours.HasValue) + queryParams.Add($"lookBackHours={Uri.EscapeDataString(theLookBackPeriodInHoursToLookByTheDefaultIs24Hours.Value.ToString())}"); var path = $"/api/domains/{Uri.EscapeDataString(theDomainName.ToString())}/stats" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -2767,11 +2767,11 @@ public virtual async Task GetDomainStatsAsync(string theDomainName, /// The look back period in hours to look by, the default is 24 hours. /// Cancellation token. /// The Ips - Get the statistics for the given ip address response. - public virtual async Task GetIpStatsAsync(string theIpAddress, int theLookBackPeriodInHoursToLookByTheDefaultIs24Hours = default, CancellationToken cancellationToken = default) + public virtual async Task GetIpStatsAsync(string theIpAddress, int? theLookBackPeriodInHoursToLookByTheDefaultIs24Hours = default, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (theLookBackPeriodInHoursToLookByTheDefaultIs24Hours != default) - queryParams.Add($"lookBackHours={Uri.EscapeDataString(theLookBackPeriodInHoursToLookByTheDefaultIs24Hours.ToString())}"); + if (theLookBackPeriodInHoursToLookByTheDefaultIs24Hours.HasValue) + queryParams.Add($"lookBackHours={Uri.EscapeDataString(theLookBackPeriodInHoursToLookByTheDefaultIs24Hours.Value.ToString())}"); var path = $"/api/ips/{Uri.EscapeDataString(theIpAddress.ToString())}/stats" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -2805,7 +2805,7 @@ public virtual async Task GetSingleInvestigationAsync(string idOf /// Includes count /// Cancellation token. /// An async enumerable of items across all pages. - public virtual AsyncPageable GetInvestigationsAsync(string filtersResults = default, string selectsProperties = default, string sortsResults = default, int returnsFirstResults = default, int skipsFirstResults = default, bool includesCount = default, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetInvestigationsAsync(string filtersResults = default, string selectsProperties = default, string sortsResults = default, int? returnsFirstResults = default, int? skipsFirstResults = default, bool? includesCount = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (filtersResults != default) @@ -2814,12 +2814,12 @@ public virtual AsyncPageable GetInvestigationsAsync(string filter queryParams.Add($"$select={Uri.EscapeDataString(selectsProperties.ToString())}"); if (sortsResults != default) queryParams.Add($"$orderby={Uri.EscapeDataString(sortsResults.ToString())}"); - if (returnsFirstResults != default) - queryParams.Add($"$top={Uri.EscapeDataString(returnsFirstResults.ToString())}"); - if (skipsFirstResults != default) - queryParams.Add($"$skip={Uri.EscapeDataString(skipsFirstResults.ToString())}"); - if (includesCount != default) - queryParams.Add($"$count={Uri.EscapeDataString(includesCount.ToString())}"); + if (returnsFirstResults.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(returnsFirstResults.Value.ToString())}"); + if (skipsFirstResults.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipsFirstResults.Value.ToString())}"); + if (includesCount.HasValue) + queryParams.Add($"$count={Uri.EscapeDataString(includesCount.Value.ToString())}"); var path = $"/api/investigations" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), @@ -2966,7 +2966,7 @@ public virtual async Task RunLiveResponseAsync(string machineId, /// Includes count /// Cancellation token. /// An async enumerable of items across all pages. - public virtual AsyncPageable GetRemediationActivitiesAsync(string filtersResults = default, string selectsProperties = default, string sortsResults = default, int returnsFirstResults = default, int skipsFirstResults = default, bool includesCount = default, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetRemediationActivitiesAsync(string filtersResults = default, string selectsProperties = default, string sortsResults = default, int? returnsFirstResults = default, int? skipsFirstResults = default, bool? includesCount = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (filtersResults != default) @@ -2975,12 +2975,12 @@ public virtual AsyncPageable GetRemediationActivitiesAsync( queryParams.Add($"$select={Uri.EscapeDataString(selectsProperties.ToString())}"); if (sortsResults != default) queryParams.Add($"$orderby={Uri.EscapeDataString(sortsResults.ToString())}"); - if (returnsFirstResults != default) - queryParams.Add($"$top={Uri.EscapeDataString(returnsFirstResults.ToString())}"); - if (skipsFirstResults != default) - queryParams.Add($"$skip={Uri.EscapeDataString(skipsFirstResults.ToString())}"); - if (includesCount != default) - queryParams.Add($"$count={Uri.EscapeDataString(includesCount.ToString())}"); + if (returnsFirstResults.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(returnsFirstResults.Value.ToString())}"); + if (skipsFirstResults.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipsFirstResults.Value.ToString())}"); + if (includesCount.HasValue) + queryParams.Add($"$count={Uri.EscapeDataString(includesCount.Value.ToString())}"); var path = $"/api/remediationtasks" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), @@ -3031,7 +3031,7 @@ public virtual AsyncPageable GetRemediationActivityMachineListAsync(str /// Includes count /// Cancellation token. /// An async enumerable of items across all pages. - public virtual AsyncPageable GetMachinesAsync(string filtersResults = default, string selectsProperties = default, string sortsResults = default, int returnsFirstResults = default, int skipsFirstResults = default, bool includesCount = default, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetMachinesAsync(string filtersResults = default, string selectsProperties = default, string sortsResults = default, int? returnsFirstResults = default, int? skipsFirstResults = default, bool? includesCount = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (filtersResults != default) @@ -3040,12 +3040,12 @@ public virtual AsyncPageable GetMachinesAsync(string filtersResults = d queryParams.Add($"$select={Uri.EscapeDataString(selectsProperties.ToString())}"); if (sortsResults != default) queryParams.Add($"$orderby={Uri.EscapeDataString(sortsResults.ToString())}"); - if (returnsFirstResults != default) - queryParams.Add($"$top={Uri.EscapeDataString(returnsFirstResults.ToString())}"); - if (skipsFirstResults != default) - queryParams.Add($"$skip={Uri.EscapeDataString(skipsFirstResults.ToString())}"); - if (includesCount != default) - queryParams.Add($"$count={Uri.EscapeDataString(includesCount.ToString())}"); + if (returnsFirstResults.HasValue) + queryParams.Add($"$top={Uri.EscapeDataString(returnsFirstResults.Value.ToString())}"); + if (skipsFirstResults.HasValue) + queryParams.Add($"$skip={Uri.EscapeDataString(skipsFirstResults.Value.ToString())}"); + if (includesCount.HasValue) + queryParams.Add($"$count={Uri.EscapeDataString(includesCount.Value.ToString())}"); var path = $"/api/machines" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), diff --git a/src/Azure.Connectors.Sdk/Generated/WebexExtensions.cs b/src/Azure.Connectors.Sdk/Generated/WebexExtensions.cs new file mode 100644 index 0000000..aea5da6 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/WebexExtensions.cs @@ -0,0 +1,1831 @@ +// WebexExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Webex.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Webex.Models +{ + + #region Types + + /// + /// Add Member to Space + /// + public class CreateSpaceMemberInput + { + /// Is moderator? + [JsonPropertyName("isModerator")] + public bool? IsModerator { get; set; } + + /// Email address + [JsonPropertyName("personEmail")] + public string PersonEmail { get; set; } + + /// Person ID of the new member + [JsonPropertyName("personId")] + public string PersonId { get; set; } + + /// Select a space + [JsonPropertyName("roomId")] + public string RoomId { get; set; } + } + + /// + /// Response for Add Member to Space + /// + public class CreateSpaceMemberResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// isModerator + [JsonPropertyName("isModerator")] + public bool? IsModerator { get; set; } + + /// isMonitor + [JsonPropertyName("isMonitor")] + public bool? IsMonitor { get; set; } + + /// personDisplayName + [JsonPropertyName("personDisplayName")] + public string PersonDisplayName { get; set; } + + /// personEmail + [JsonPropertyName("personEmail")] + public string PersonEmail { get; set; } + + /// personId + [JsonPropertyName("personId")] + public string PersonId { get; set; } + + /// personOrgId + [JsonPropertyName("personOrgId")] + public string PersonOrgId { get; set; } + + /// roomId + [JsonPropertyName("roomId")] + public string RoomId { get; set; } + } + + /// + /// Response for Get Messages + /// + public class GetMessagesResponse + { + /// items + [JsonPropertyName("items")] + public List Items { get; set; } + } + + /// + /// Send a Message + /// + public class SendMessageInput + { + /// files + [JsonPropertyName("files")] + public List Files { get; set; } + + /// Message, in markdown format + [JsonPropertyName("markdown")] + public string Markdown { get; set; } + + /// Select a recipient space + [JsonPropertyName("roomId")] + public string RoomId { get; set; } + + /// Message Text, in plain text, used for clients that do not support markdown + [JsonPropertyName("text")] + public string Text { get; set; } + + /// The email address of the recipient when sending a private 1:1 message + [JsonPropertyName("toPersonEmail")] + public string ToPersonEmail { get; set; } + + /// The ID of the recipient when sending a 1:1 message + [JsonPropertyName("toPersonId")] + public string ToPersonId { get; set; } + } + + /// + /// Response for Send a Message + /// + public class SendMessageResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// personEmail + [JsonPropertyName("personEmail")] + public string PersonEmail { get; set; } + + /// personId + [JsonPropertyName("personId")] + public string PersonId { get; set; } + + /// roomId + [JsonPropertyName("roomId")] + public string RoomId { get; set; } + + /// roomType + [JsonPropertyName("roomType")] + public string RoomType { get; set; } + + /// text + [JsonPropertyName("text")] + public string Text { get; set; } + + /// toPersonEmail + [JsonPropertyName("toPersonEmail")] + public string ToPersonEmail { get; set; } + } + + /// + /// Response for Get Message Details + /// + public class GetMessageDetailsResponse + { + /// created + [JsonPropertyName("created")] + public string Created { get; set; } + + /// files + [JsonPropertyName("files")] + public List Files { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// markdown + [JsonPropertyName("markdown")] + public string Markdown { get; set; } + + /// mentionedGroups + [JsonPropertyName("mentionedGroups")] + public List MentionedGroups { get; set; } + + /// mentionedPeople + [JsonPropertyName("mentionedPeople")] + public List MentionedPeople { get; set; } + + /// personEmail + [JsonPropertyName("personEmail")] + public string PersonEmail { get; set; } + + /// personId + [JsonPropertyName("personId")] + public string PersonId { get; set; } + + /// roomId + [JsonPropertyName("roomId")] + public string RoomId { get; set; } + + /// roomType + [JsonPropertyName("roomType")] + public string RoomType { get; set; } + + /// text + [JsonPropertyName("text")] + public string Text { get; set; } + + /// toPersonEmail + [JsonPropertyName("toPersonEmail")] + public string ToPersonEmail { get; set; } + + /// toPersonId + [JsonPropertyName("toPersonId")] + public string ToPersonId { get; set; } + } + + /// + /// Response for Get People + /// + public class GetPeopleResponse + { + /// items + [JsonPropertyName("items")] + public List Items { get; set; } + + /// notFoundIds + [JsonPropertyName("notFoundIds")] + public List NotFoundIds { get; set; } + } + + /// + /// Response for Get My Own Details + /// + public class GetMyOwnDetailsResponse + { + /// avatar + [JsonPropertyName("avatar")] + public string Avatar { get; set; } + + /// created + [JsonPropertyName("created")] + public string Created { get; set; } + + /// displayName + [JsonPropertyName("displayName")] + public string DisplayName { get; set; } + + /// emails + [JsonPropertyName("emails")] + public List Emails { get; set; } + + /// firstName + [JsonPropertyName("firstName")] + public string FirstName { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// lastActivity + [JsonPropertyName("lastActivity")] + public string LastActivity { get; set; } + + /// lastName + [JsonPropertyName("lastName")] + public string LastName { get; set; } + + /// nickName + [JsonPropertyName("nickName")] + public string NickName { get; set; } + + /// orgId + [JsonPropertyName("orgId")] + public string OrgId { get; set; } + + /// phoneNumbers + [JsonPropertyName("phoneNumbers")] + public List PhoneNumbers { get; set; } + + /// status + [JsonPropertyName("status")] + public string Status { get; set; } + + /// type + [JsonPropertyName("type")] + public string Type { get; set; } + } + + /// + /// Response for Get Spaces List + /// + public class GetSpacesResponse + { + /// items + [JsonPropertyName("items")] + public List Items { get; set; } + } + + /// + /// Create Space + /// + public class CreateSpaceInput + { + /// Optionally select a team + [JsonPropertyName("teamId")] + public string TeamId { get; set; } + + /// Space Title + [JsonPropertyName("title")] + public string Title { get; set; } + } + + /// + /// Response for Create Space + /// + public class CreateSpaceResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// creatorId + [JsonPropertyName("creatorId")] + public string CreatorId { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// isLocked + [JsonPropertyName("isLocked")] + public bool? IsLocked { get; set; } + + /// lastActivity + [JsonPropertyName("lastActivity")] + public DateTime? LastActivity { get; set; } + + /// title + [JsonPropertyName("title")] + public string Title { get; set; } + + /// type + [JsonPropertyName("type")] + public string Type { get; set; } + } + + /// + /// Response for Get Space Details + /// + public class GetSpaceDetailResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// creatorId + [JsonPropertyName("creatorId")] + public string CreatorId { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// isLocked + [JsonPropertyName("isLocked")] + public bool? IsLocked { get; set; } + + /// lastActivity + [JsonPropertyName("lastActivity")] + public DateTime? LastActivity { get; set; } + + /// title + [JsonPropertyName("title")] + public string Title { get; set; } + + /// type + [JsonPropertyName("type")] + public string Type { get; set; } + } + + /// + /// Add Member to Team + /// + public class CreateTeamMemberInput + { + /// Is Moderator? + [JsonPropertyName("isModerator")] + public bool? IsModerator { get; set; } + + /// Email address + [JsonPropertyName("personEmail")] + public string PersonEmail { get; set; } + + /// Person ID of the new member + [JsonPropertyName("personId")] + public string PersonId { get; set; } + + /// Select a team + [JsonPropertyName("teamId")] + public string TeamId { get; set; } + } + + /// + /// Response for Add Member to Team + /// + public class CreateTeamMemberResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// isModerator + [JsonPropertyName("isModerator")] + public bool? IsModerator { get; set; } + + /// personDisplayName + [JsonPropertyName("personDisplayName")] + public string PersonDisplayName { get; set; } + + /// personEmail + [JsonPropertyName("personEmail")] + public string PersonEmail { get; set; } + + /// personId + [JsonPropertyName("personId")] + public string PersonId { get; set; } + + /// personOrgId + [JsonPropertyName("personOrgId")] + public string PersonOrgId { get; set; } + + /// teamId + [JsonPropertyName("teamId")] + public string TeamId { get; set; } + } + + /// + /// When a membership is updated + /// + public class MembershipsUpdatedInput + { + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + } + + /// + /// Response for When a membership is updated + /// + public class MembershipsUpdatedResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// filter + [JsonPropertyName("filter")] + public string Filter { get; set; } + + /// secret + [JsonPropertyName("secret")] + public string Secret { get; set; } + + /// status + [JsonPropertyName("status")] + public string Status { get; set; } + } + + /// + /// When a membership is deleted + /// + public class MembershipsDeletedInput + { + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + } + + /// + /// Response for When a membership is deleted + /// + public class MembershipsDeletedResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// filter + [JsonPropertyName("filter")] + public string Filter { get; set; } + + /// secret + [JsonPropertyName("secret")] + public string Secret { get; set; } + + /// status + [JsonPropertyName("status")] + public string Status { get; set; } + } + + /// + /// When a membership is created + /// + public class MembershipsCreatedInput + { + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + } + + /// + /// Response for When a membership is created + /// + public class MembershipsCreatedResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// filter + [JsonPropertyName("filter")] + public string Filter { get; set; } + + /// secret + [JsonPropertyName("secret")] + public string Secret { get; set; } + + /// status + [JsonPropertyName("status")] + public string Status { get; set; } + } + + /// + /// When a message is created + /// + public class MessagesCreatedInput + { + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + } + + /// + /// Response for When a message is created + /// + public class MessagesCreatedResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// filter + [JsonPropertyName("filter")] + public string Filter { get; set; } + + /// secret + [JsonPropertyName("secret")] + public string Secret { get; set; } + + /// status + [JsonPropertyName("status")] + public string Status { get; set; } + } + + /// + /// When a message is deleted + /// + public class MessagesDeletedInput + { + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + } + + /// + /// Response for When a message is deleted + /// + public class MessagesDeletedResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// filter + [JsonPropertyName("filter")] + public string Filter { get; set; } + + /// secret + [JsonPropertyName("secret")] + public string Secret { get; set; } + + /// status + [JsonPropertyName("status")] + public string Status { get; set; } + } + + /// + /// When a space is created + /// + public class SpaceCreatedInput + { + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + } + + /// + /// Response for When a space is created + /// + public class SpaceCreatedResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// filter + [JsonPropertyName("filter")] + public string Filter { get; set; } + + /// secret + [JsonPropertyName("secret")] + public string Secret { get; set; } + + /// status + [JsonPropertyName("status")] + public string Status { get; set; } + } + + /// + /// When a space is updated + /// + public class SpaceUpdatedInput + { + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + } + + /// + /// Response for When a space is updated + /// + public class SpaceUpdatedResponse + { + /// created + [JsonPropertyName("created")] + public DateTime? Created { get; set; } + + /// id + [JsonPropertyName("id")] + public string Id { get; set; } + + /// name + [JsonPropertyName("name")] + public string Name { get; set; } + + /// targetUrl + [JsonPropertyName("targetUrl")] + public string TargetUrl { get; set; } + + /// resource + [JsonPropertyName("resource")] + public string Resource { get; set; } + + /// event + [JsonPropertyName("event")] + public string Event { get; set; } + + /// filter + [JsonPropertyName("filter")] + public string Filter { get; set; } + + /// secret + [JsonPropertyName("secret")] + public string Secret { get; set; } + + /// status + [JsonPropertyName("status")] + public string Status { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Webex models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class WebexModelFactory + { + /// + /// Creates a new instance of . + /// + public static CreateSpaceMemberInput CreateSpaceMemberInput( + bool? isModerator = default, + string personEmail = default, + string personId = default, + string roomId = default) + { + return new CreateSpaceMemberInput + { + IsModerator = isModerator, + PersonEmail = personEmail, + PersonId = personId, + RoomId = roomId, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateSpaceMemberResponse CreateSpaceMemberResponse( + DateTime? created = default, + string id = default, + bool? isModerator = default, + bool? isMonitor = default, + string personDisplayName = default, + string personEmail = default, + string personId = default, + string personOrgId = default, + string roomId = default) + { + return new CreateSpaceMemberResponse + { + Created = created, + Id = id, + IsModerator = isModerator, + IsMonitor = isMonitor, + PersonDisplayName = personDisplayName, + PersonEmail = personEmail, + PersonId = personId, + PersonOrgId = personOrgId, + RoomId = roomId, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetMessagesResponse GetMessagesResponse( + List items = default) + { + return new GetMessagesResponse + { + Items = items, + }; + } + + /// + /// Creates a new instance of . + /// + public static SendMessageInput SendMessageInput( + List files = default, + string markdown = default, + string roomId = default, + string text = default, + string toPersonEmail = default, + string toPersonId = default) + { + return new SendMessageInput + { + Files = files, + Markdown = markdown, + RoomId = roomId, + Text = text, + ToPersonEmail = toPersonEmail, + ToPersonId = toPersonId, + }; + } + + /// + /// Creates a new instance of . + /// + public static SendMessageResponse SendMessageResponse( + DateTime? created = default, + string id = default, + string personEmail = default, + string personId = default, + string roomId = default, + string roomType = default, + string text = default, + string toPersonEmail = default) + { + return new SendMessageResponse + { + Created = created, + Id = id, + PersonEmail = personEmail, + PersonId = personId, + RoomId = roomId, + RoomType = roomType, + Text = text, + ToPersonEmail = toPersonEmail, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetMessageDetailsResponse GetMessageDetailsResponse( + string created = default, + List files = default, + string id = default, + string markdown = default, + List mentionedGroups = default, + List mentionedPeople = default, + string personEmail = default, + string personId = default, + string roomId = default, + string roomType = default, + string text = default, + string toPersonEmail = default, + string toPersonId = default) + { + return new GetMessageDetailsResponse + { + Created = created, + Files = files, + Id = id, + Markdown = markdown, + MentionedGroups = mentionedGroups, + MentionedPeople = mentionedPeople, + PersonEmail = personEmail, + PersonId = personId, + RoomId = roomId, + RoomType = roomType, + Text = text, + ToPersonEmail = toPersonEmail, + ToPersonId = toPersonId, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetPeopleResponse GetPeopleResponse( + List items = default, + List notFoundIds = default) + { + return new GetPeopleResponse + { + Items = items, + NotFoundIds = notFoundIds, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetMyOwnDetailsResponse GetMyOwnDetailsResponse( + string avatar = default, + string created = default, + string displayName = default, + List emails = default, + string firstName = default, + string id = default, + string lastActivity = default, + string lastName = default, + string nickName = default, + string orgId = default, + List phoneNumbers = default, + string status = default, + string type = default) + { + return new GetMyOwnDetailsResponse + { + Avatar = avatar, + Created = created, + DisplayName = displayName, + Emails = emails, + FirstName = firstName, + Id = id, + LastActivity = lastActivity, + LastName = lastName, + NickName = nickName, + OrgId = orgId, + PhoneNumbers = phoneNumbers, + Status = status, + Type = type, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetSpacesResponse GetSpacesResponse( + List items = default) + { + return new GetSpacesResponse + { + Items = items, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateSpaceInput CreateSpaceInput( + string teamId = default, + string title = default) + { + return new CreateSpaceInput + { + TeamId = teamId, + Title = title, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateSpaceResponse CreateSpaceResponse( + DateTime? created = default, + string creatorId = default, + string id = default, + bool? isLocked = default, + DateTime? lastActivity = default, + string title = default, + string type = default) + { + return new CreateSpaceResponse + { + Created = created, + CreatorId = creatorId, + Id = id, + IsLocked = isLocked, + LastActivity = lastActivity, + Title = title, + Type = type, + }; + } + + /// + /// Creates a new instance of . + /// + public static GetSpaceDetailResponse GetSpaceDetailResponse( + DateTime? created = default, + string creatorId = default, + string id = default, + bool? isLocked = default, + DateTime? lastActivity = default, + string title = default, + string type = default) + { + return new GetSpaceDetailResponse + { + Created = created, + CreatorId = creatorId, + Id = id, + IsLocked = isLocked, + LastActivity = lastActivity, + Title = title, + Type = type, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateTeamMemberInput CreateTeamMemberInput( + bool? isModerator = default, + string personEmail = default, + string personId = default, + string teamId = default) + { + return new CreateTeamMemberInput + { + IsModerator = isModerator, + PersonEmail = personEmail, + PersonId = personId, + TeamId = teamId, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreateTeamMemberResponse CreateTeamMemberResponse( + DateTime? created = default, + string id = default, + bool? isModerator = default, + string personDisplayName = default, + string personEmail = default, + string personId = default, + string personOrgId = default, + string teamId = default) + { + return new CreateTeamMemberResponse + { + Created = created, + Id = id, + IsModerator = isModerator, + PersonDisplayName = personDisplayName, + PersonEmail = personEmail, + PersonId = personId, + PersonOrgId = personOrgId, + TeamId = teamId, + }; + } + + /// + /// Creates a new instance of . + /// + public static MembershipsUpdatedInput MembershipsUpdatedInput( + string @event = default, + string name = default, + string resource = default, + string targetUrl = default) + { + return new MembershipsUpdatedInput + { + Event = @event, + Name = name, + Resource = resource, + TargetUrl = targetUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static MembershipsUpdatedResponse MembershipsUpdatedResponse( + DateTime? created = default, + string id = default, + string name = default, + string targetUrl = default, + string resource = default, + string @event = default, + string filter = default, + string secret = default, + string status = default) + { + return new MembershipsUpdatedResponse + { + Created = created, + Id = id, + Name = name, + TargetUrl = targetUrl, + Resource = resource, + Event = @event, + Filter = filter, + Secret = secret, + Status = status, + }; + } + + /// + /// Creates a new instance of . + /// + public static MembershipsDeletedInput MembershipsDeletedInput( + string @event = default, + string name = default, + string resource = default, + string targetUrl = default) + { + return new MembershipsDeletedInput + { + Event = @event, + Name = name, + Resource = resource, + TargetUrl = targetUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static MembershipsDeletedResponse MembershipsDeletedResponse( + DateTime? created = default, + string id = default, + string name = default, + string targetUrl = default, + string resource = default, + string @event = default, + string filter = default, + string secret = default, + string status = default) + { + return new MembershipsDeletedResponse + { + Created = created, + Id = id, + Name = name, + TargetUrl = targetUrl, + Resource = resource, + Event = @event, + Filter = filter, + Secret = secret, + Status = status, + }; + } + + /// + /// Creates a new instance of . + /// + public static MembershipsCreatedInput MembershipsCreatedInput( + string @event = default, + string name = default, + string resource = default, + string targetUrl = default) + { + return new MembershipsCreatedInput + { + Event = @event, + Name = name, + Resource = resource, + TargetUrl = targetUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static MembershipsCreatedResponse MembershipsCreatedResponse( + DateTime? created = default, + string id = default, + string name = default, + string targetUrl = default, + string resource = default, + string @event = default, + string filter = default, + string secret = default, + string status = default) + { + return new MembershipsCreatedResponse + { + Created = created, + Id = id, + Name = name, + TargetUrl = targetUrl, + Resource = resource, + Event = @event, + Filter = filter, + Secret = secret, + Status = status, + }; + } + + /// + /// Creates a new instance of . + /// + public static MessagesCreatedInput MessagesCreatedInput( + string @event = default, + string name = default, + string resource = default, + string targetUrl = default) + { + return new MessagesCreatedInput + { + Event = @event, + Name = name, + Resource = resource, + TargetUrl = targetUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static MessagesCreatedResponse MessagesCreatedResponse( + DateTime? created = default, + string id = default, + string name = default, + string targetUrl = default, + string resource = default, + string @event = default, + string filter = default, + string secret = default, + string status = default) + { + return new MessagesCreatedResponse + { + Created = created, + Id = id, + Name = name, + TargetUrl = targetUrl, + Resource = resource, + Event = @event, + Filter = filter, + Secret = secret, + Status = status, + }; + } + + /// + /// Creates a new instance of . + /// + public static MessagesDeletedInput MessagesDeletedInput( + string @event = default, + string name = default, + string resource = default, + string targetUrl = default) + { + return new MessagesDeletedInput + { + Event = @event, + Name = name, + Resource = resource, + TargetUrl = targetUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static MessagesDeletedResponse MessagesDeletedResponse( + DateTime? created = default, + string id = default, + string name = default, + string targetUrl = default, + string resource = default, + string @event = default, + string filter = default, + string secret = default, + string status = default) + { + return new MessagesDeletedResponse + { + Created = created, + Id = id, + Name = name, + TargetUrl = targetUrl, + Resource = resource, + Event = @event, + Filter = filter, + Secret = secret, + Status = status, + }; + } + + /// + /// Creates a new instance of . + /// + public static SpaceCreatedInput SpaceCreatedInput( + string @event = default, + string name = default, + string resource = default, + string targetUrl = default) + { + return new SpaceCreatedInput + { + Event = @event, + Name = name, + Resource = resource, + TargetUrl = targetUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static SpaceCreatedResponse SpaceCreatedResponse( + DateTime? created = default, + string id = default, + string name = default, + string targetUrl = default, + string resource = default, + string @event = default, + string filter = default, + string secret = default, + string status = default) + { + return new SpaceCreatedResponse + { + Created = created, + Id = id, + Name = name, + TargetUrl = targetUrl, + Resource = resource, + Event = @event, + Filter = filter, + Secret = secret, + Status = status, + }; + } + + /// + /// Creates a new instance of . + /// + public static SpaceUpdatedInput SpaceUpdatedInput( + string @event = default, + string name = default, + string resource = default, + string targetUrl = default) + { + return new SpaceUpdatedInput + { + Event = @event, + Name = name, + Resource = resource, + TargetUrl = targetUrl, + }; + } + + /// + /// Creates a new instance of . + /// + public static SpaceUpdatedResponse SpaceUpdatedResponse( + DateTime? created = default, + string id = default, + string name = default, + string targetUrl = default, + string resource = default, + string @event = default, + string filter = default, + string secret = default, + string status = default) + { + return new SpaceUpdatedResponse + { + Created = created, + Id = id, + Name = name, + TargetUrl = targetUrl, + Resource = resource, + Event = @event, + Filter = filter, + Secret = secret, + Status = status, + }; + } + } + + #endregion Model Factory + +} + +namespace Azure.Connectors.Sdk.Webex +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Webex connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class WebexTriggerOperations + { + /// + /// When a membership is updated. + /// + public const string OnMembershipsUpdated = "MembershipsUpdated"; + + /// + /// When a membership is deleted. + /// + public const string OnMembershipsDeleted = "MembershipsDeleted"; + + /// + /// When a membership is created. + /// + public const string OnMembershipsCreated = "MembershipsCreated"; + + /// + /// When a message is created. + /// + public const string OnMessagesCreated = "MessagesCreated"; + + /// + /// When a message is deleted. + /// + public const string OnMessagesDeleted = "MessagesDeleted"; + + /// + /// When a space is created. + /// + public const string OnSpaceCreated = "SpaceCreated"; + + /// + /// When a space is updated. + /// + public const string OnSpaceUpdated = "SpaceUpdated"; + + } + + #endregion Trigger Operation Constants + + #region Client + + /// + /// Typed client for webex connector. + /// + public class WebexClient : ConnectorClientBase + { + /// + /// Creates a new WebexClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public WebexClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new WebexClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public WebexClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new WebexClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public WebexClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new WebexClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public WebexClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected WebexClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "webex"; + + /// + /// Add Member to Space + /// + /// Add a member to an existing space + /// The request body. + /// Cancellation token. + /// The Add Member to Space response. + public virtual async Task CreateSpaceMemberAsync(CreateSpaceMemberInput input, CancellationToken cancellationToken = default) + { + var path = $"/v1/memberships"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Messages + /// + /// Get a list of recent messages for a space + /// Space + /// Mentioned People + /// Before Message + /// Before + /// Max + /// Cancellation token. + /// The Get Messages response. + public virtual async Task GetMessagesAsync([DynamicValues("GetSpaces")] string space, string mentionedPeople = default, string beforeMessage = default, string before = default, int? max = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"roomId={Uri.EscapeDataString(space.ToString())}"); + if (mentionedPeople != default) + queryParams.Add($"mentionedPeople={Uri.EscapeDataString(mentionedPeople.ToString())}"); + if (beforeMessage != default) + queryParams.Add($"beforeMessage={Uri.EscapeDataString(beforeMessage.ToString())}"); + if (before != default) + queryParams.Add($"before={Uri.EscapeDataString(before.ToString())}"); + if (max.HasValue) + queryParams.Add($"max={Uri.EscapeDataString(max.Value.ToString())}"); + var path = $"/v1/messages" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Send a Message + /// + /// Send a message to webex + /// The request body. + /// Cancellation token. + /// The Send a Message response. + public virtual async Task SendMessageAsync(SendMessageInput input, CancellationToken cancellationToken = default) + { + var path = $"/v1/messages"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Message Details + /// + /// Shows details for a message, by message ID. + /// Message ID + /// Cancellation token. + /// The Get Message Details response. + public virtual async Task GetMessageDetailsAsync(string messageId, CancellationToken cancellationToken = default) + { + var path = $"/v1/messages/{Uri.EscapeDataString(messageId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get People + /// + /// Lookup details and presence information for people in your organization + /// Person ID + /// Email + /// Cancellation token. + /// The Get People response. + public virtual async Task GetPeopleAsync(string personId = default, string email = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (personId != default) + queryParams.Add($"id={Uri.EscapeDataString(personId.ToString())}"); + if (email != default) + queryParams.Add($"email={Uri.EscapeDataString(email.ToString())}"); + var path = $"/v1/people" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get My Own Details + /// + /// Lookup your own details + /// Cancellation token. + /// The Get My Own Details response. + public virtual async Task GetMyOwnDetailsAsync(CancellationToken cancellationToken = default) + { + var path = $"/v1/people/me"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Spaces List + /// + /// This action retrieves a list of spaces + /// Max Results + /// Type of space + /// Sort By + /// Cancellation token. + /// The Get Spaces List response. + public virtual async Task GetSpacesAsync(int? maxResults = default, string typeOfSpace = default, string sortBy = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + if (maxResults.HasValue) + queryParams.Add($"max={Uri.EscapeDataString(maxResults.Value.ToString())}"); + if (typeOfSpace != default) + queryParams.Add($"type={Uri.EscapeDataString(typeOfSpace.ToString())}"); + if (sortBy != default) + queryParams.Add($"sortBy={Uri.EscapeDataString(sortBy.ToString())}"); + var path = $"/v1/rooms" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create Space + /// + /// Create space or team space + /// The request body. + /// Cancellation token. + /// The Create Space response. + public virtual async Task CreateSpaceAsync(CreateSpaceInput input, CancellationToken cancellationToken = default) + { + var path = $"/v1/rooms"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get Space Details + /// + /// Return details of a given space + /// Space + /// Cancellation token. + /// The Get Space Details response. + public virtual async Task GetSpaceDetailAsync([DynamicValues("GetSpaces")] string space, CancellationToken cancellationToken = default) + { + var path = $"/v1/rooms/{Uri.EscapeDataString(space.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Add Member to Team + /// + /// Add a member to a team + /// The request body. + /// Cancellation token. + /// The Add Member to Team response. + public virtual async Task CreateTeamMemberAsync(CreateTeamMemberInput input, CancellationToken cancellationToken = default) + { + var path = $"/v1/team/memberships"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/WordPressExtensions.cs b/src/Azure.Connectors.Sdk/Generated/WordPressExtensions.cs new file mode 100644 index 0000000..2096c03 --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/WordPressExtensions.cs @@ -0,0 +1,822 @@ +// WordPressExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.WordPress.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.WordPress.Models +{ + + #region Types + + /// + /// Response for When a post is created + /// + public class ListPostsResponse + { + /// Posts + [JsonPropertyName("posts")] + public List Posts { get; set; } + } + + /// + /// Item in Posts + /// + public class PostResponse + { + /// ID + [JsonPropertyName("ID")] + public int? Id { get; set; } + + /// comment_count + [JsonPropertyName("comment_count")] + public int? CommentCount { get; set; } + + /// site_ID + [JsonPropertyName("site_ID")] + public int? SiteId { get; set; } + + /// date + [JsonPropertyName("date")] + public string Date { get; set; } + + /// modified + [JsonPropertyName("modified")] + public string Modified { get; set; } + + /// title + [JsonPropertyName("title")] + public string Title { get; set; } + + /// URL + [JsonPropertyName("URL")] + public string URL { get; set; } + + /// slug + [JsonPropertyName("slug")] + public string Slug { get; set; } + + /// type + [JsonPropertyName("type")] + public string Type { get; set; } + + /// like_count + [JsonPropertyName("like_count")] + public int? LikeCount { get; set; } + } + + /// + /// Response for Get site statistics + /// + public class SiteStatsModel + { + /// visitors_today + [JsonPropertyName("visitors_today")] + public int? VisitorsToday { get; set; } + + /// visitors_yesterday + [JsonPropertyName("visitors_yesterday")] + public int? VisitorsYesterday { get; set; } + + /// visitors + [JsonPropertyName("visitors")] + public int? Visitors { get; set; } + + /// views_today + [JsonPropertyName("views_today")] + public int? ViewToday { get; set; } + + /// views_yesterday + [JsonPropertyName("views_yesterday")] + public int? ViewsYesterday { get; set; } + + /// views_best_day + [JsonPropertyName("views_best_day")] + public string ViewsBestDay { get; set; } + + /// views_best_day_total + [JsonPropertyName("views_best_day_total")] + public int? ViewsBestDayTotal { get; set; } + + /// views + [JsonPropertyName("views")] + public int? Views { get; set; } + + /// comments + [JsonPropertyName("comments")] + public int? Comments { get; set; } + + /// posts + [JsonPropertyName("posts")] + public int? Posts { get; set; } + + /// followers_blog + [JsonPropertyName("followers_blog")] + public int? FollowersBlog { get; set; } + + /// followers_comments + [JsonPropertyName("followers_comments")] + public int? FollowersComments { get; set; } + + /// comments_per_month + [JsonPropertyName("comments_per_month")] + public int? CommentsPerMonth { get; set; } + + /// comments_most_active_recent_day + [JsonPropertyName("comments_most_active_recent_day")] + public string CommentsMostActiveRecentDay { get; set; } + + /// comments_most_active_time + [JsonPropertyName("comments_most_active_time")] + public string CommentsMostActiveTime { get; set; } + + /// comments_spam + [JsonPropertyName("comments_spam")] + public int? CommentsSpam { get; set; } + + /// categories + [JsonPropertyName("categories")] + public int? Categories { get; set; } + + /// tags + [JsonPropertyName("tags")] + public int? Tags { get; set; } + + /// shares + [JsonPropertyName("shares")] + public int? Shares { get; set; } + + /// shares_twitter + [JsonPropertyName("shares_twitter")] + public int? SharesTwitter { get; set; } + + /// shares_facebook + [JsonPropertyName("shares_facebook")] + public int? SharesFacebook { get; set; } + + /// shares_press-this + [JsonPropertyName("shares_press-this")] + public int? SharesPressThis { get; set; } + } + + /// + /// Response for Get post + /// + public class PostModel + { + /// ID + [JsonPropertyName("ID")] + public int? Id { get; set; } + + /// site_ID + [JsonPropertyName("site_ID")] + public int? SiteId { get; set; } + + /// date + [JsonPropertyName("date")] + public string Date { get; set; } + + /// modified + [JsonPropertyName("modified")] + public string Modified { get; set; } + + /// title + [JsonPropertyName("title")] + public string Title { get; set; } + + /// URL + [JsonPropertyName("URL")] + public string URL { get; set; } + + /// short_URL + [JsonPropertyName("short_URL")] + public string ShortURL { get; set; } + + /// content + [JsonPropertyName("content")] + public string Content { get; set; } + + /// excerpt + [JsonPropertyName("excerpt")] + public string Excerpt { get; set; } + + /// slug + [JsonPropertyName("slug")] + public string Slug { get; set; } + + /// status + [JsonPropertyName("status")] + public string Status { get; set; } + + /// sticky + [JsonPropertyName("sticky")] + public bool? Sticky { get; set; } + + /// password + [JsonPropertyName("password")] + public string Password { get; set; } + + /// parent + [JsonPropertyName("parent")] + public object Parent { get; set; } + + /// type + [JsonPropertyName("type")] + public string Type { get; set; } + + /// likes_enabled + [JsonPropertyName("likes_enabled")] + public bool? LikesEnabled { get; set; } + + /// sharing_enabled + [JsonPropertyName("sharing_enabled")] + public bool? SharingEnabled { get; set; } + + /// like_count + [JsonPropertyName("like_count")] + public int? LikeCount { get; set; } + + /// i_like + [JsonPropertyName("i_like")] + public bool? ILike { get; set; } + + /// is_reblogged + [JsonPropertyName("is_reblogged")] + public bool? IsRebloggled { get; set; } + + /// is_following + [JsonPropertyName("is_following")] + public bool? IsFollowing { get; set; } + + /// global_ID + [JsonPropertyName("global_ID")] + public string GlobalId { get; set; } + + /// featured_image + [JsonPropertyName("featured_image")] + public string FeaturedImage { get; set; } + + /// post_thumbnail + [JsonPropertyName("post_thumbnail")] + public object PostThumbnail { get; set; } + + /// format + [JsonPropertyName("format")] + public string Format { get; set; } + + /// geo + [JsonPropertyName("geo")] + public bool? Geo { get; set; } + } + + /// + /// Response for List sites + /// + public class SiteList + { + /// List of sites + [JsonPropertyName("sites")] + public List Sites { get; set; } + } + + /// + /// Item in List of sites + /// + public class Site + { + /// Site ID + [JsonPropertyName("ID")] + public int? SiteId { get; set; } + + /// Site Name + [JsonPropertyName("name")] + public string SiteName { get; set; } + + /// Site Description + [JsonPropertyName("description")] + public string SiteDescription { get; set; } + + /// Site URL + [JsonPropertyName("URL")] + public string SiteUrl { get; set; } + + /// Whether the site is a Multisite site or not. Always true for WP.com sites. + [JsonPropertyName("is_multisite")] + public bool? IsMultisite { get; set; } + + /// The number of posts the site has + [JsonPropertyName("post_count")] + public int? PostCount { get; set; } + + /// The number of subscribers the site has + [JsonPropertyName("subscribers_count")] + public int? SubscribersCount { get; set; } + + /// Language + [JsonPropertyName("lang")] + public string Language { get; set; } + + /// Site visibility + [JsonPropertyName("visible")] + public bool? Visible { get; set; } + + /// Is site private + [JsonPropertyName("is_private")] + public bool? IsPrivate { get; set; } + + /// Is single user site + [JsonPropertyName("single_user_site")] + public bool? IsSingleUserSite { get; set; } + + /// Is VIP + [JsonPropertyName("is_vip")] + public bool? IsVIP { get; set; } + + /// Is Following + [JsonPropertyName("is_following")] + public bool? IsFollowing { get; set; } + } + + /// + /// CreatePostModel + /// + public class CreatePostModel + { + /// The title of the post + [JsonPropertyName("title")] + public string Title { get; set; } + + /// The content of the post + [JsonPropertyName("content")] + public string Content { get; set; } + + /// The status of the post + [JsonPropertyName("status")] + public Status? Status { get; set; } + + /// The tags for post + [JsonPropertyName("tags")] + public string Tags { get; set; } + } + + /// + /// Extensible enum for known Status values. + /// + [JsonConverter(typeof(Status.StatusJsonConverter))] + public readonly struct Status : IEquatable + { + private readonly string _value; + + /// + /// Initializes a new instance of the struct. + /// + /// The string value. + public Status(string value) => this._value = value ?? throw new ArgumentNullException(nameof(value)); + + /// draft + public static Status Draft { get; } = new("draft"); + + /// publish + public static Status Publish { get; } = new("publish"); + + /// private + public static Status Private { get; } = new("private"); + + /// pending + public static Status Pending { get; } = new("pending"); + + /// future + public static Status Future { get; } = new("future"); + + /// auto-draft + public static Status AutoDraft { get; } = new("auto-draft"); + + /// Converts a string to . + public static implicit operator Status(string value) => new(value); + + /// Converts a to its string representation. + public static implicit operator string(Status value) => value.ToString(); + + /// + public override string ToString() => this._value; + + /// + public bool Equals(Status other) => string.Equals(this._value, other._value, StringComparison.OrdinalIgnoreCase); + + /// + public override bool Equals(object obj) => obj is Status other ? this.Equals(other) : obj is string text && string.Equals(this._value, text, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => this._value?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0; + + /// Equality operator. + public static bool operator ==(Status left, Status right) => left.Equals(right); + + /// Inequality operator. + public static bool operator !=(Status left, Status right) => !left.Equals(right); + + internal sealed class StatusJsonConverter : JsonConverter + { + public StatusJsonConverter() { } + public override Status Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.TokenType == JsonTokenType.String ? new(reader.GetString()) : throw new JsonException($"Expected string for Status, got '{reader.TokenType}'."); + public override void Write(Utf8JsonWriter writer, Status value, JsonSerializerOptions options) => writer.WriteStringValue(value.ToString()); + } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of WordPress models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class WordPressModelFactory + { + /// + /// Creates a new instance of . + /// + public static ListPostsResponse ListPostsResponse( + List posts = default) + { + return new ListPostsResponse + { + Posts = posts, + }; + } + + /// + /// Creates a new instance of . + /// + public static PostResponse PostResponse( + int? id = default, + int? commentCount = default, + int? siteId = default, + string date = default, + string modified = default, + string title = default, + string url = default, + string slug = default, + string type = default, + int? likeCount = default) + { + return new PostResponse + { + Id = id, + CommentCount = commentCount, + SiteId = siteId, + Date = date, + Modified = modified, + Title = title, + URL = url, + Slug = slug, + Type = type, + LikeCount = likeCount, + }; + } + + /// + /// Creates a new instance of . + /// + public static SiteStatsModel SiteStatsModel( + int? visitorsToday = default, + int? visitorsYesterday = default, + int? visitors = default, + int? viewToday = default, + int? viewsYesterday = default, + string viewsBestDay = default, + int? viewsBestDayTotal = default, + int? views = default, + int? comments = default, + int? posts = default, + int? followersBlog = default, + int? followersComments = default, + int? commentsPerMonth = default, + string commentsMostActiveRecentDay = default, + string commentsMostActiveTime = default, + int? commentsSpam = default, + int? categories = default, + int? tags = default, + int? shares = default, + int? sharesTwitter = default, + int? sharesFacebook = default, + int? sharesPressThis = default) + { + return new SiteStatsModel + { + VisitorsToday = visitorsToday, + VisitorsYesterday = visitorsYesterday, + Visitors = visitors, + ViewToday = viewToday, + ViewsYesterday = viewsYesterday, + ViewsBestDay = viewsBestDay, + ViewsBestDayTotal = viewsBestDayTotal, + Views = views, + Comments = comments, + Posts = posts, + FollowersBlog = followersBlog, + FollowersComments = followersComments, + CommentsPerMonth = commentsPerMonth, + CommentsMostActiveRecentDay = commentsMostActiveRecentDay, + CommentsMostActiveTime = commentsMostActiveTime, + CommentsSpam = commentsSpam, + Categories = categories, + Tags = tags, + Shares = shares, + SharesTwitter = sharesTwitter, + SharesFacebook = sharesFacebook, + SharesPressThis = sharesPressThis, + }; + } + + /// + /// Creates a new instance of . + /// + public static PostModel PostModel( + int? id = default, + int? siteId = default, + string date = default, + string modified = default, + string title = default, + string url = default, + string shortURL = default, + string content = default, + string excerpt = default, + string slug = default, + string status = default, + bool? sticky = default, + string password = default, + object parent = default, + string type = default, + bool? likesEnabled = default, + bool? sharingEnabled = default, + int? likeCount = default, + bool? iLike = default, + bool? isRebloggled = default, + bool? isFollowing = default, + string globalId = default, + string featuredImage = default, + object postThumbnail = default, + string format = default, + bool? geo = default) + { + return new PostModel + { + Id = id, + SiteId = siteId, + Date = date, + Modified = modified, + Title = title, + URL = url, + ShortURL = shortURL, + Content = content, + Excerpt = excerpt, + Slug = slug, + Status = status, + Sticky = sticky, + Password = password, + Parent = parent, + Type = type, + LikesEnabled = likesEnabled, + SharingEnabled = sharingEnabled, + LikeCount = likeCount, + ILike = iLike, + IsRebloggled = isRebloggled, + IsFollowing = isFollowing, + GlobalId = globalId, + FeaturedImage = featuredImage, + PostThumbnail = postThumbnail, + Format = format, + Geo = geo, + }; + } + + /// + /// Creates a new instance of . + /// + public static SiteList SiteList( + List sites = default) + { + return new SiteList + { + Sites = sites, + }; + } + + /// + /// Creates a new instance of . + /// + public static Site Site( + int? siteId = default, + string siteName = default, + string siteDescription = default, + string siteUrl = default, + bool? isMultisite = default, + int? postCount = default, + int? subscribersCount = default, + string language = default, + bool? visible = default, + bool? isPrivate = default, + bool? isSingleUserSite = default, + bool? isVIP = default, + bool? isFollowing = default) + { + return new Site + { + SiteId = siteId, + SiteName = siteName, + SiteDescription = siteDescription, + SiteUrl = siteUrl, + IsMultisite = isMultisite, + PostCount = postCount, + SubscribersCount = subscribersCount, + Language = language, + Visible = visible, + IsPrivate = isPrivate, + IsSingleUserSite = isSingleUserSite, + IsVIP = isVIP, + IsFollowing = isFollowing, + }; + } + + /// + /// Creates a new instance of . + /// + public static CreatePostModel CreatePostModel( + string title = default, + string content = default, + Status? status = default, + string tags = default) + { + return new CreatePostModel + { + Title = title, + Content = content, + Status = status, + Tags = tags, + }; + } + } + + #endregion Model Factory + +} + +namespace Azure.Connectors.Sdk.WordPress +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the WordPress connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class WordPressTriggerOperations + { + /// + /// When a post is created. + /// + public const string OnTriggerNewPost = "OnTriggerNewPost"; + + } + + #endregion Trigger Operation Constants + + #region Client + + /// + /// Typed client for wordpress connector. + /// + public class WordPressClient : ConnectorClientBase + { + /// + /// Creates a new WordPressClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public WordPressClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new WordPressClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public WordPressClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new WordPressClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public WordPressClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new WordPressClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public WordPressClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected WordPressClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "wordpress"; + + /// + /// Get site statistics + /// + /// Get statistics for a specified site + /// Site Id + /// Cancellation token. + /// The Get site statistics response. + public virtual async Task SiteStatsAsync([DynamicValues("ListSites")] string siteId, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("fields=stats"); + var path = $"/sites/{Uri.EscapeDataString(siteId.ToString())}/stats" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Get post + /// + /// Get post + /// Site Id + /// Post Id + /// Cancellation token. + /// The Get post response. + public virtual async Task GetAsync([DynamicValues("ListSites")] string siteId, string postId, CancellationToken cancellationToken = default) + { + var path = $"/sites/{Uri.EscapeDataString(siteId.ToString())}/posts/{Uri.EscapeDataString(postId.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Create post + /// + /// Create post + /// Site ID + /// The request body. + /// Cancellation token. + /// The Create post response. + public virtual async Task CreateAsync([DynamicValues("ListSites")] string siteId, CreatePostModel input, CancellationToken cancellationToken = default) + { + var path = $"/sites/{Uri.EscapeDataString(siteId.ToString())}/posts/new"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// List sites + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// The List sites response. + public virtual async Task ListSitesAsync(CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add("fields=ID%2C%20name%2C%20description%2C%20URL%2C%20%20is_multisite%2C%20post_count%2Csubscribers_count%2C%20lang%2Cvisible%2Cis_private%2Csingle_user_site%2Cis_vip%2Cis_following"); + var path = $"/me/sites" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/src/Azure.Connectors.Sdk/Generated/YammerExtensions.cs b/src/Azure.Connectors.Sdk/Generated/YammerExtensions.cs index 6bb8920..f3eeeac 100644 --- a/src/Azure.Connectors.Sdk/Generated/YammerExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/YammerExtensions.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Net.Http; using System.Net.Http.Headers; using System.Text; @@ -119,7 +118,7 @@ public class PageableMessageList /// /// Item in value /// - public class MessageV2 + public class Message { /// ID associated with the post. [JsonPropertyName("id")] @@ -248,96 +247,6 @@ public class MessageList public List Messages { get; set; } } - /// - /// MessageV2 - /// - public class Message - { - /// ID associated with the post. - [JsonPropertyName("id")] - public long? Id { get; set; } - - /// Text Content of the post. - [JsonPropertyName("content_excerpt")] - public string Text { get; set; } - - /// Unique ID of user who posted the message. - [JsonPropertyName("sender_id")] - public long? Sender { get; set; } - - /// ID of the message to which this message is a reply. - [JsonPropertyName("replied_to_id")] - public long? RepliedTo { get; set; } - - /// Time at which the message was created. - [JsonPropertyName("created_at")] - public string CreatedAt { get; set; } - - /// Id of the network message is associated with. - [JsonPropertyName("network_id")] - public long? Network { get; set; } - - /// Description of the message type. - [JsonPropertyName("message_type")] - public string Type { get; set; } - - /// Description of the type of sender. - [JsonPropertyName("sender_type")] - public string SenderType { get; set; } - - /// API url of the post. - [JsonPropertyName("url")] - public string Url { get; set; } - - /// Web url of the post. - [JsonPropertyName("web_url")] - public string WebUrl { get; set; } - - /// Unique ID of group who posted the message. - [JsonPropertyName("group_id")] - public long? GroupId { get; set; } - - /// body - [JsonPropertyName("body")] - public MessageBody Body { get; set; } - - /// Unique ID of thread. - [JsonPropertyName("thread_id")] - public long? ThreadId { get; set; } - - /// Flag to specify if the post is a a direct message. - [JsonPropertyName("direct_message")] - public bool? DirectMessage { get; set; } - - /// Type of the client. - [JsonPropertyName("client_type")] - public string ClientId { get; set; } - - /// Web link of the client. - [JsonPropertyName("client_url")] - public string ClientURL { get; set; } - - /// Language used in the message. - [JsonPropertyName("language")] - public string Language { get; set; } - - /// Details of users notified. - [JsonPropertyName("notified_user_ids")] - public List TaggedUser { get; set; } - - /// Details of the privacy associated with the message. - [JsonPropertyName("privacy")] - public string Privacy { get; set; } - - /// liked_by - [JsonPropertyName("liked_by")] - public LikedBy LikedBy { get; set; } - - /// Flag to specify if the post is a system generated message or not. - [JsonPropertyName("system_message")] - public bool? IsSystemMessage { get; set; } - } - /// /// PostOperationRequestV2 /// @@ -454,9 +363,9 @@ public static PageableMessageList PageableMessageList( } /// - /// Creates a new instance of . + /// Creates a new instance of . /// - public static MessageV2 MessageV2( + public static Message Message( long? id = default, string text = default, long? sender = default, @@ -479,7 +388,7 @@ public static MessageV2 MessageV2( LikedBy likedBy = default, bool? isSystemMessage = default) { - return new MessageV2 + return new Message { Id = id, Text = text, @@ -547,58 +456,6 @@ public static MessageList MessageList( }; } - /// - /// Creates a new instance of . - /// - public static Message Message( - long? id = default, - string text = default, - long? sender = default, - long? repliedTo = default, - string createdAt = default, - long? network = default, - string type = default, - string senderType = default, - string url = default, - string webUrl = default, - long? groupId = default, - MessageBody body = default, - long? threadId = default, - bool? directMessage = default, - string clientId = default, - string clientURL = default, - string language = default, - List taggedUser = default, - string privacy = default, - LikedBy likedBy = default, - bool? isSystemMessage = default) - { - return new Message - { - Id = id, - Text = text, - Sender = sender, - RepliedTo = repliedTo, - CreatedAt = createdAt, - Network = network, - Type = type, - SenderType = senderType, - Url = url, - WebUrl = webUrl, - GroupId = groupId, - Body = body, - ThreadId = threadId, - DirectMessage = directMessage, - ClientId = clientId, - ClientURL = clientURL, - Language = language, - TaggedUser = taggedUser, - Privacy = privacy, - LikedBy = likedBy, - IsSystemMessage = isSystemMessage, - }; - } - /// /// Creates a new instance of . /// @@ -624,10 +481,6 @@ public static PostOperationRequest PostOperationRequest( #endregion Model Factory - #region Trigger Payloads - - #endregion Trigger Payloads - } namespace Azure.Connectors.Sdk.Yammer @@ -781,15 +634,15 @@ public virtual async Task> GetNetworksAsync(CancellationToken canc /// Show All Company Group /// Cancellation token. /// The Get groups response. - public virtual async Task> GetGroupsAsync([DynamicValues("GetNetworks")] string networkId = default, int mine = default, int showAllCompanyGroup = default, CancellationToken cancellationToken = default) + public virtual async Task> GetGroupsAsync([DynamicValues("GetNetworks")] string networkId = default, int? mine = default, int? showAllCompanyGroup = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (networkId != default) queryParams.Add($"network_id={Uri.EscapeDataString(networkId.ToString())}"); - if (mine != default) - queryParams.Add($"mine={Uri.EscapeDataString(mine.ToString())}"); - if (showAllCompanyGroup != default) - queryParams.Add($"showAllCompanyGroup={Uri.EscapeDataString(showAllCompanyGroup.ToString())}"); + if (mine.HasValue) + queryParams.Add($"mine={Uri.EscapeDataString(mine.Value.ToString())}"); + if (showAllCompanyGroup.HasValue) + queryParams.Add($"showAllCompanyGroup={Uri.EscapeDataString(showAllCompanyGroup.Value.ToString())}"); var path = $"/groups.json" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -820,8 +673,7 @@ public virtual async Task GetUserDetailsByIdAsync(int userId, Cancellation public virtual async Task LikeMessageAsync(string messageId, CancellationToken cancellationToken = default) { var queryParams = new List(); - if (messageId != default) - queryParams.Add($"message_id={Uri.EscapeDataString(messageId.ToString())}"); + queryParams.Add($"message_id={Uri.EscapeDataString(messageId.ToString())}"); var path = $"/messages/liked_by/current.json" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); await this .CallConnectorAsync(HttpMethod.Post, path, cancellationToken: cancellationToken) @@ -839,19 +691,19 @@ await this /// Limit /// Cancellation token. /// The Get all messages (V3) response. - public virtual async Task GetAllMessagesAsync([DynamicValues("GetNetworks")] string uniqueIdentifierOfTheNetwork = default, int olderThan = default, int newerThan = default, string threadTypeOfMessages = default, int limit = default, CancellationToken cancellationToken = default) + public virtual async Task GetAllMessagesAsync([DynamicValues("GetNetworks")] string uniqueIdentifierOfTheNetwork = default, int? olderThan = default, int? newerThan = default, string threadTypeOfMessages = default, int? limit = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (uniqueIdentifierOfTheNetwork != default) queryParams.Add($"network_id={Uri.EscapeDataString(uniqueIdentifierOfTheNetwork.ToString())}"); - if (olderThan != default) - queryParams.Add($"older_than={Uri.EscapeDataString(olderThan.ToString())}"); - if (newerThan != default) - queryParams.Add($"newer_than={Uri.EscapeDataString(newerThan.ToString())}"); + if (olderThan.HasValue) + queryParams.Add($"older_than={Uri.EscapeDataString(olderThan.Value.ToString())}"); + if (newerThan.HasValue) + queryParams.Add($"newer_than={Uri.EscapeDataString(newerThan.Value.ToString())}"); if (threadTypeOfMessages != default) queryParams.Add($"threaded={Uri.EscapeDataString(threadTypeOfMessages.ToString())}"); - if (limit != default) - queryParams.Add($"limit={Uri.EscapeDataString(limit.ToString())}"); + if (limit.HasValue) + queryParams.Add($"limit={Uri.EscapeDataString(limit.Value.ToString())}"); var path = $"/v3/messages.json" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -869,19 +721,19 @@ public virtual async Task GetAllMessagesAsync([DynamicValue /// Limit /// Cancellation token. /// The Get the messages from my Following feed (V3) response. - public virtual async Task GetMessagesFollowingAsync([DynamicValues("GetNetworks")] string networkId = default, int olderThan = default, int newerThan = default, string threadTypeOfMessages = default, int limit = default, CancellationToken cancellationToken = default) + public virtual async Task GetMessagesFollowingAsync([DynamicValues("GetNetworks")] string networkId = default, int? olderThan = default, int? newerThan = default, string threadTypeOfMessages = default, int? limit = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (networkId != default) queryParams.Add($"network_id={Uri.EscapeDataString(networkId.ToString())}"); - if (olderThan != default) - queryParams.Add($"older_than={Uri.EscapeDataString(olderThan.ToString())}"); - if (newerThan != default) - queryParams.Add($"newer_than={Uri.EscapeDataString(newerThan.ToString())}"); + if (olderThan.HasValue) + queryParams.Add($"older_than={Uri.EscapeDataString(olderThan.Value.ToString())}"); + if (newerThan.HasValue) + queryParams.Add($"newer_than={Uri.EscapeDataString(newerThan.Value.ToString())}"); if (threadTypeOfMessages != default) queryParams.Add($"threaded={Uri.EscapeDataString(threadTypeOfMessages.ToString())}"); - if (limit != default) - queryParams.Add($"limit={Uri.EscapeDataString(limit.ToString())}"); + if (limit.HasValue) + queryParams.Add($"limit={Uri.EscapeDataString(limit.Value.ToString())}"); var path = $"/v3/messages/following.json" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) @@ -900,19 +752,19 @@ public virtual async Task GetMessagesFollowingAsync([Dynami /// Limit /// Cancellation token. /// The Get messages in a group (V3) response. - public virtual async Task GetMessagesInGroupAsync([DynamicValues("GetGroups")] int groupId, [DynamicValues("GetNetworks")] string networkId = default, int olderThan = default, int newerThan = default, string threadTypeOfMessages = default, int limit = default, CancellationToken cancellationToken = default) + public virtual async Task GetMessagesInGroupAsync([DynamicValues("GetGroups")] int groupId, [DynamicValues("GetNetworks")] string networkId = default, int? olderThan = default, int? newerThan = default, string threadTypeOfMessages = default, int? limit = default, CancellationToken cancellationToken = default) { var queryParams = new List(); if (networkId != default) queryParams.Add($"network_id={Uri.EscapeDataString(networkId.ToString())}"); - if (olderThan != default) - queryParams.Add($"older_than={Uri.EscapeDataString(olderThan.ToString())}"); - if (newerThan != default) - queryParams.Add($"newer_than={Uri.EscapeDataString(newerThan.ToString())}"); + if (olderThan.HasValue) + queryParams.Add($"older_than={Uri.EscapeDataString(olderThan.Value.ToString())}"); + if (newerThan.HasValue) + queryParams.Add($"newer_than={Uri.EscapeDataString(newerThan.Value.ToString())}"); if (threadTypeOfMessages != default) queryParams.Add($"threaded={Uri.EscapeDataString(threadTypeOfMessages.ToString())}"); - if (limit != default) - queryParams.Add($"limit={Uri.EscapeDataString(limit.ToString())}"); + if (limit.HasValue) + queryParams.Add($"limit={Uri.EscapeDataString(limit.Value.ToString())}"); var path = $"/v3/messages/in_group/{Uri.EscapeDataString(groupId.ToString())}.json" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) diff --git a/src/Azure.Connectors.Sdk/Generated/ZendeskExtensions.cs b/src/Azure.Connectors.Sdk/Generated/ZendeskExtensions.cs new file mode 100644 index 0000000..4e5ffeb --- /dev/null +++ b/src/Azure.Connectors.Sdk/Generated/ZendeskExtensions.cs @@ -0,0 +1,349 @@ +// ZendeskExtensions.cs - Auto-generated Connectors SDK +// Do not edit this file directly. + +#nullable disable +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk; +using Azure.Connectors.Sdk.Zendesk.Models; +using Azure.Core; +using Azure.Identity; + +namespace Azure.Connectors.Sdk.Zendesk.Models +{ + + #region Types + + /// + /// Response for Create Item + /// + [DynamicSchema("GetTable")] + public class Item + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + + /// dynamicProperties + [JsonPropertyName("dynamicProperties")] + public object DynamicProperties { get; set; } + } + + /// + /// Response for Search Articles + /// + public class SearchResult + { + /// results + [JsonPropertyName("results")] + public List Results { get; set; } + } + + /// + /// Response for When an item is modified + /// + public class ItemsList + { + /// value + [JsonPropertyName("value")] + public List Value { get; set; } + } + + #endregion Types + + #region Model Factory + + /// + /// Model factory for creating instances of Zendesk models. + /// Use these factory methods to construct model instances in tests and scenarios + /// where output-only properties (with internal setters) need to be populated. + /// + public static class ZendeskModelFactory + { + /// + /// Creates a new instance of . + /// + public static Item Item( + object dynamicProperties = default) + { + return new Item + { + DynamicProperties = dynamicProperties, + }; + } + + /// + /// Creates a new instance of . + /// + public static SearchResult SearchResult( + List results = default) + { + return new SearchResult + { + Results = results, + }; + } + + /// + /// Creates a new instance of . + /// + public static ItemsList ItemsList( + List value = default) + { + return new ItemsList + { + Value = value, + }; + } + } + + #endregion Model Factory + + #region Trigger Payloads + + /// + /// Typed trigger payload for the OnUpdatedItems trigger (Zendesk "When an item is modified", operationId: GetOnUpdatedItemsV2). + /// Deserialize Connector Namespace callbacks directly: JsonSerializer.Deserialize<ZendeskOnUpdatedItemsTriggerPayload>(body). + /// + public class ZendeskOnUpdatedItemsTriggerPayload : TriggerCallbackPayload + { + } + + /// + /// Static registry of trigger operations for the Zendesk connector that have typed payloads. + /// Maps operation names to their typed subtypes. + /// Triggers that return binary content (e.g., file downloads) are not included here + /// because they have no JSON-deserializable payload type. See + /// for the complete list of trigger operation name constants. + /// + public static class ZendeskTriggers + { + /// + /// Trigger operations with typed payloads for the Zendesk connector. + /// This is a subset of all triggers — see for the full list. + /// + public static IReadOnlyDictionary Operations { get; } = new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + ["GetOnUpdatedItemsV2"] = typeof(ZendeskOnUpdatedItemsTriggerPayload), + }); + } + + #endregion Trigger Payloads + +} + +namespace Azure.Connectors.Sdk.Zendesk +{ + + #region Trigger Operation Constants + + /// + /// Trigger operation name constants for the Zendesk connector. + /// Use these constants with the [ConnectorTrigger] attribute's OperationName property + /// and with the Connector Namespace TriggerConfig operationName field. + /// + public static class ZendeskTriggerOperations + { + /// + /// When an item is modified. + /// Payload type: . + /// + public const string OnUpdatedItems = "GetOnUpdatedItemsV2"; + + } + + #endregion Trigger Operation Constants + + #region Trigger Parameter Metadata + + /// + /// Trigger input parameter name constants for the Zendesk connector. + /// These correspond to the Connector Namespace TriggerConfig parameters array. + /// + public static class ZendeskTriggerParameters + { + /// + /// Input parameters for the OnUpdatedItems trigger operation (operationId: GetOnUpdatedItemsV2). + /// + public static class OnUpdatedItems + { + /// + /// An ODATA filter query to restrict the entries returned (e.g. stringColumn eq 'string' OR numberColumn lt 123). + /// + public const string Filter = "$filter"; + + /// + /// An ODATA orderBy query for specifying the order of entries + /// + public const string Orderby = "$orderby"; + + /// + /// Number of entries to skip (default = 0) + /// + public const string Skip = "$skip"; + + /// + /// Maximum number of entries to retrieve (default = 512) + /// + public const string Top = "$top"; + + } + + } + + #endregion Trigger Parameter Metadata + + #region Client + + /// + /// Typed client for zendesk connector. + /// + public class ZendeskClient : ConnectorClientBase + { + /// + /// Creates a new ZendeskClient with the specified connection runtime URL. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public ZendeskClient(Uri connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + /// + /// Creates a new ZendeskClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + /// Optional client options for retry, timeout, etc. + public ZendeskClient(Uri connectionRuntimeUrl, TokenCredential credential, ConnectorClientOptions options = null) + : base(connectionRuntimeUrl, credential, options) + { + } + + /// + /// Creates a new ZendeskClient with the specified connection runtime URL and credential. + /// + /// The connection runtime URL from Azure Portal. + /// The Azure credential for authentication. + public ZendeskClient(Uri connectionRuntimeUrl, TokenCredential credential) + : base(connectionRuntimeUrl, credential) + { + } + + /// + /// Creates a new ZendeskClient with the specified connection runtime URL string. + /// Uses by default. + /// + /// The connection runtime URL from Azure Portal. + public ZendeskClient(string connectionRuntimeUrl) + : base(connectionRuntimeUrl) + { + } + + protected ZendeskClient() : this(new Uri("https://localhost")) { } + + public override string ConnectorName => "zendesk"; + + /// + /// Create Item + /// + /// Creates a Zendesk item + /// Table name + /// The request body. + /// Cancellation token. + /// The Create Item response. + public virtual async Task PostItemAsync([DynamicValues("GetTables")] string tableName, Item input, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/tables/{Uri.EscapeDataString(tableName.ToString())}/items"; + return await this + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Delete item + /// + /// Deletes a Zendesk item + /// Table name + /// Item key + /// Cancellation token. + public virtual async Task DeleteItemAsync([DynamicValues("GetTables")] string tableName, string itemKey, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/tables/{Uri.EscapeDataString(tableName.ToString())}/items/{Uri.EscapeDataString(itemKey.ToString())}"; + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Update item + /// + /// Updates an existing Zendesk item + /// Table name + /// Item key + /// The request body. + /// Cancellation token. + /// The Update item response. + public virtual async Task PatchItemAsync([DynamicValues("GetTables")] string tableName, string itemKey, Item input, CancellationToken cancellationToken = default) + { + var path = $"/datasets/default/tables/{Uri.EscapeDataString(tableName.ToString())}/items/{Uri.EscapeDataString(itemKey.ToString())}"; + return await this + .CallConnectorAsync(HttpMethod.Patch, path, input, cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Search Articles + /// + /// Returns a default number of 25 articles per page, up to a maximum of 1000 results. + /// Query + /// Locale + /// Brand Id + /// Category + /// Section + /// Label Names + /// Multibrand + /// Cancellation token. + /// The Search Articles response. + public virtual async Task SearchArticlesAsync(string query, string locale = default, int? brandId = default, int? category = default, int? section = default, string labelNames = default, bool? multibrand = default, CancellationToken cancellationToken = default) + { + var queryParams = new List(); + queryParams.Add($"query={Uri.EscapeDataString(query.ToString())}"); + if (locale != default) + queryParams.Add($"locale={Uri.EscapeDataString(locale.ToString())}"); + if (brandId.HasValue) + queryParams.Add($"brand_id={Uri.EscapeDataString(brandId.Value.ToString())}"); + if (category.HasValue) + queryParams.Add($"category={Uri.EscapeDataString(category.Value.ToString())}"); + if (section.HasValue) + queryParams.Add($"section={Uri.EscapeDataString(section.Value.ToString())}"); + if (labelNames != default) + queryParams.Add($"label_names={Uri.EscapeDataString(labelNames.ToString())}"); + if (multibrand.HasValue) + queryParams.Add($"multibrand={Uri.EscapeDataString(multibrand.Value.ToString())}"); + var path = $"/api/v2/help_center/articles/search" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } + + #endregion Client +} + diff --git a/tests/Azure.Connectors.Sdk.Tests/BoxClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/BoxClientTests.cs new file mode 100644 index 0000000..720e753 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/BoxClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Box; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class BoxClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static BoxClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new BoxClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new BoxClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new BoxClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new BoxClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new BoxClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetFileMetadataAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetFileMetadataAsync(fileId: "file1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetFileMetadataAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetFileMetadataAsync(fileId: "file1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/DocuSignClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/DocuSignClientTests.cs new file mode 100644 index 0000000..b6cc9ad --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/DocuSignClientTests.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.DocuSign; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class DocuSignClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static DocuSignClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new DocuSignClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new DocuSignClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new DocuSignClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new DocuSignClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new DocuSignClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetDocgenFormFieldsAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetDocgenFormFieldsAsync(account: "acct1", + envelope: "env1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetDocgenFormFieldsAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetDocgenFormFieldsAsync(account: "acct1", + envelope: "env1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/DropboxClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/DropboxClientTests.cs new file mode 100644 index 0000000..f1288c4 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/DropboxClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Dropbox; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class DropboxClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static DropboxClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new DropboxClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new DropboxClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new DropboxClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new DropboxClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new DropboxClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetFileMetadataAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetFileMetadataAsync(file: "file1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetFileMetadataAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetFileMetadataAsync(file: "file1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/DynamicsAXClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/DynamicsAXClientTests.cs new file mode 100644 index 0000000..0a8f9da --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/DynamicsAXClientTests.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.DynamicsAX; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class DynamicsAXClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static DynamicsAXClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new DynamicsAXClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new DynamicsAXClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new DynamicsAXClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new DynamicsAXClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new DynamicsAXClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetProcedureAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetProcedureAsync(instance: "inst1", + action: "act1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetProcedureAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetProcedureAsync(instance: "inst1", + action: "act1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/EventbriteClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/EventbriteClientTests.cs new file mode 100644 index 0000000..8e6dcc9 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/EventbriteClientTests.cs @@ -0,0 +1,119 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Eventbrite; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class EventbriteClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static EventbriteClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new EventbriteClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new EventbriteClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new EventbriteClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new EventbriteClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new EventbriteClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetCategoriesAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetCategoriesAsync(cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetCategoriesAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetCategoriesAsync(cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/FtpClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/FtpClientTests.cs new file mode 100644 index 0000000..d860081 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/FtpClientTests.cs @@ -0,0 +1,125 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Ftp; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class FtpClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static FtpClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new FtpClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new FtpClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new FtpClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new FtpClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new FtpClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task CreateFileAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .CreateFileAsync(input: Array.Empty(), + folderPath: "/test", + fileName: "file.txt", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task CreateFileAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.CreateFileAsync(input: Array.Empty(), + folderPath: "/test", + fileName: "file.txt", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/GitHubClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/GitHubClientTests.cs new file mode 100644 index 0000000..70fb054 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/GitHubClientTests.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.GitHub; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class GitHubClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static GitHubClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new GitHubClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new GitHubClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new GitHubClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new GitHubClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new GitHubClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetRepositoryPublicKeyAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetRepositoryPublicKeyAsync(repositoryOwner: "owner1", + repositoryName: "repo1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetRepositoryPublicKeyAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetRepositoryPublicKeyAsync(repositoryOwner: "owner1", + repositoryName: "repo1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/GoogleCalendarClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/GoogleCalendarClientTests.cs new file mode 100644 index 0000000..7ae0227 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/GoogleCalendarClientTests.cs @@ -0,0 +1,119 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.GoogleCalendar; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class GoogleCalendarClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static GoogleCalendarClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new GoogleCalendarClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new GoogleCalendarClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new GoogleCalendarClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new GoogleCalendarClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new GoogleCalendarClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task ListCalendarsAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .ListCalendarsAsync(cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task ListCalendarsAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.ListCalendarsAsync(cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/GoogleDriveClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/GoogleDriveClientTests.cs new file mode 100644 index 0000000..7397439 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/GoogleDriveClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.GoogleDrive; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class GoogleDriveClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static GoogleDriveClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new GoogleDriveClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new GoogleDriveClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new GoogleDriveClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new GoogleDriveClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new GoogleDriveClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetFileMetadataAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetFileMetadataAsync(file: "file1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetFileMetadataAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetFileMetadataAsync(file: "file1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/GoogleTasksClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/GoogleTasksClientTests.cs new file mode 100644 index 0000000..a511c85 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/GoogleTasksClientTests.cs @@ -0,0 +1,119 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.GoogleTasks; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class GoogleTasksClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static GoogleTasksClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new GoogleTasksClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new GoogleTasksClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new GoogleTasksClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new GoogleTasksClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new GoogleTasksClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task ListTaskListsAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .ListTaskListsAsync(cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task ListTaskListsAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.ListTaskListsAsync(cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/JiraClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/JiraClientTests.cs new file mode 100644 index 0000000..1e0d245 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/JiraClientTests.cs @@ -0,0 +1,119 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Jira; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class JiraClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static JiraClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new JiraClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new JiraClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new JiraClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new JiraClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new JiraClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task ListIssuesAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .ListIssuesAsync(cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task ListIssuesAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.ListIssuesAsync(cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/MailChimpClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/MailChimpClientTests.cs new file mode 100644 index 0000000..d971f6e --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/MailChimpClientTests.cs @@ -0,0 +1,119 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.MailChimp; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class MailChimpClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static MailChimpClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new MailChimpClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new MailChimpClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new MailChimpClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new MailChimpClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new MailChimpClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetCampaignsAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetCampaignsAsync(cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetCampaignsAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetCampaignsAsync(cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/MondayClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/MondayClientTests.cs new file mode 100644 index 0000000..0c54409 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/MondayClientTests.cs @@ -0,0 +1,119 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Monday; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class MondayClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static MondayClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new MondayClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new MondayClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new MondayClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new MondayClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new MondayClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetColumnNamesSchemaAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetColumnNamesSchemaAsync(cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetColumnNamesSchemaAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetColumnNamesSchemaAsync(cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/OneDriveClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/OneDriveClientTests.cs new file mode 100644 index 0000000..e8df004 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/OneDriveClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.OneDrive; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class OneDriveClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static OneDriveClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new OneDriveClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new OneDriveClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new OneDriveClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new OneDriveClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new OneDriveClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetFileMetadataAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetFileMetadataAsync(file: "file1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetFileMetadataAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetFileMetadataAsync(file: "file1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/RssClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/RssClientTests.cs new file mode 100644 index 0000000..38a98d6 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/RssClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Rss; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class RssClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static RssClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new RssClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new RssClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new RssClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new RssClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new RssClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task ListFeedItemsAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("[]") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .ListFeedItemsAsync(theRSSFeedURL: "https://test.com/feed", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task ListFeedItemsAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.ListFeedItemsAsync(theRSSFeedURL: "https://test.com/feed", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/SalesforceClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/SalesforceClientTests.cs new file mode 100644 index 0000000..389ec4a --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/SalesforceClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Salesforce; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class SalesforceClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static SalesforceClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new SalesforceClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new SalesforceClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new SalesforceClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new SalesforceClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new SalesforceClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetTableAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetTableAsync(salesforceObjectType: "Account", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetTableAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetTableAsync(salesforceObjectType: "Account", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/SendGridClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/SendGridClientTests.cs new file mode 100644 index 0000000..685e40e --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/SendGridClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.SendGrid; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class SendGridClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static SendGridClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new SendGridClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new SendGridClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new SendGridClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new SendGridClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new SendGridClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetGlobalSuppressionAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetGlobalSuppressionAsync(email: "test@test.com", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetGlobalSuppressionAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetGlobalSuppressionAsync(email: "test@test.com", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/SlackClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/SlackClientTests.cs new file mode 100644 index 0000000..888abf3 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/SlackClientTests.cs @@ -0,0 +1,119 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Slack; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class SlackClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static SlackClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new SlackClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new SlackClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new SlackClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new SlackClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new SlackClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task SetDNDAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .SetDNDAsync(cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task SetDNDAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.SetDNDAsync(cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/SqlClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/SqlClientTests.cs new file mode 100644 index 0000000..c6c69d6 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/SqlClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Sql; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class SqlClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static SqlClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new SqlClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new SqlClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new SqlClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new SqlClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new SqlClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetDatabasesAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetDatabasesAsync(serverName: "server1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetDatabasesAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetDatabasesAsync(serverName: "server1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/TrelloClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/TrelloClientTests.cs new file mode 100644 index 0000000..6549ef9 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/TrelloClientTests.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Trello; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class TrelloClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static TrelloClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new TrelloClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new TrelloClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new TrelloClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new TrelloClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new TrelloClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetCardAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetCardAsync(cardId: "card1", + boardId: "board1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetCardAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetCardAsync(cardId: "card1", + boardId: "board1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/TwitterClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/TwitterClientTests.cs new file mode 100644 index 0000000..0f10c0c --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/TwitterClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Twitter; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class TwitterClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static TwitterClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new TwitterClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new TwitterClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new TwitterClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new TwitterClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new TwitterClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task UserAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .UserAsync(userName: "user1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task UserAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.UserAsync(userName: "user1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/TypeformClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/TypeformClientTests.cs new file mode 100644 index 0000000..484d330 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/TypeformClientTests.cs @@ -0,0 +1,119 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Typeform; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class TypeformClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static TypeformClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new TypeformClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new TypeformClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new TypeformClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new TypeformClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new TypeformClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task ListFormsAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .ListFormsAsync(cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task ListFormsAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.ListFormsAsync(cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/WebexClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/WebexClientTests.cs new file mode 100644 index 0000000..0db0b58 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/WebexClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Webex; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class WebexClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static WebexClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new WebexClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new WebexClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new WebexClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new WebexClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new WebexClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task GetMessagesAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .GetMessagesAsync(space: "space1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task GetMessagesAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.GetMessagesAsync(space: "space1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/WordPressClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/WordPressClientTests.cs new file mode 100644 index 0000000..6135887 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/WordPressClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.WordPress; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class WordPressClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static WordPressClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new WordPressClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new WordPressClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new WordPressClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new WordPressClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new WordPressClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task SiteStatsAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .SiteStatsAsync(siteId: "site1", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task SiteStatsAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.SiteStatsAsync(siteId: "site1", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +} diff --git a/tests/Azure.Connectors.Sdk.Tests/ZendeskClientTests.cs b/tests/Azure.Connectors.Sdk.Tests/ZendeskClientTests.cs new file mode 100644 index 0000000..4fa3cf7 --- /dev/null +++ b/tests/Azure.Connectors.Sdk.Tests/ZendeskClientTests.cs @@ -0,0 +1,121 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Azure.Connectors.Sdk.Zendesk; +using global::Azure.Core; +using global::Azure.Core.Pipeline; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using Moq.Protected; + +namespace Azure.Connectors.Sdk.Tests +{ + [TestClass] + public class ZendeskClientTests + { + private static readonly Mock SharedMockCredential = CreateMockCredential(); + + private static Mock CreateMockCredential() + { + var mock = new Mock(); + mock.Setup(credential => credential.GetTokenAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1))); + return mock; + } + + private static ZendeskClient CreateMockedClient(HttpResponseMessage response) + { + var mockHandler = new Mock(); + mockHandler.Protected() + .Setup>( + "SendAsync", + ItExpr.IsAny(), + ItExpr.IsAny()) + .ReturnsAsync(response) + .Callback(() => { }) + .Verifiable(); + + var options = new ConnectorClientOptions(); + options.Transport = new HttpClientTransport(new HttpClient(mockHandler.Object)); + options.Retry.MaxRetries = 0; + + return new ZendeskClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object, + options: options); + } + + [TestMethod] + public void Constructor_WithValidUrl_ShouldCreateInstance() + { + using var client = new ZendeskClient("https://test.azure.com/connection"); + Assert.IsNotNull(client); + } + + [TestMethod] + public void Constructor_WithNullUrl_ShouldThrowArgumentNullException() + { + Assert.ThrowsExactly(() => new ZendeskClient((string)null!)); + } + + [TestMethod] + public void Dispose_ShouldNotThrow() + { + var client = new ZendeskClient("https://test.azure.com/connection"); + client.Dispose(); + } + + [TestMethod] + public void Dispose_CalledTwice_ShouldNotThrow() + { + var client = new ZendeskClient( + connectionRuntimeUrl: new Uri("https://test.azure.com/connection"), + credential: SharedMockCredential.Object); + client.Dispose(); + client.Dispose(); + } + + [TestMethod] + public async Task SearchArticlesAsync_WithMockedResponse_ReturnsExpected() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.OK, + Content = new StringContent("{}") + }; + + using var client = CreateMockedClient(responseMessage); + + var result = await client + .SearchArticlesAsync(query: "test", + cancellationToken: CancellationToken.None) + .ConfigureAwait(continueOnCapturedContext: false); + + Assert.IsNotNull(result); + } + + [TestMethod] + public async Task SearchArticlesAsync_WithErrorResponse_ThrowsConnectorException() + { + using var responseMessage = new HttpResponseMessage + { + StatusCode = HttpStatusCode.BadRequest, + Content = new StringContent("{\"error\": \"Bad request\"}") + }; + + using var client = CreateMockedClient(responseMessage); + + await Assert.ThrowsExactlyAsync(() => + client.SearchArticlesAsync(query: "test", + cancellationToken: CancellationToken.None)) + .ConfigureAwait(continueOnCapturedContext: false); + } + + } +}