### Minimal example using Data Management toolkit Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/GetStarted/quickStart.md A basic example demonstrating how to initialize the DataManagementClient and retrieve hubs. ```csharp public async Task GetHub() { async Task getAccessToken() { //return access token with your logic } var DMclient = new DataManagementClient(getAccessToken); var hubs = await DMclient.DataMgtApi.Project.V1.Hubs.GetAsync(); return hubs; } ``` -------------------------------- ### Minimal example using the authentication toolkit Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/GetStarted/quickStart.md An example showing how to use the Authentication toolkit to obtain an access token and initialize the DataManagementClient. ```csharp public async Task GetHub() { var APS_CLIENT_ID="abcd"; // Replace with your client id var APS_CLIENT_SECRET="1234"; // Replace with your client secret AuthenticationClient authClient = new(); async Task getAccessToken() { var token = await authClient.Helper.GetTwoLeggedToken(APS_CLIENT_ID, APS_CLIENT_SECRET, [ AuthenticationScope.DataRead]); return token?.AccessToken is null ? throw new InvalidOperationException() : token.AccessToken; } var DMclient = new DataManagementClient(getAccessToken); var hubs = await DMclient.DataMgtApi.Project.V1.Hubs.GetAsync(); return hubs; } ``` -------------------------------- ### Helper method for retrieving an enumerable of FileVersions Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/GetStarted/quickStart.md Example signature for a helper method that retrieves an enumerable of FileVersions, useful for parallelization. ```csharp IAsyncEnumerable GetLatestFilesVersionAsync() ``` -------------------------------- ### Helper method for retrieving all FileVersions Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/GetStarted/quickStart.md Example signature for a helper method that retrieves all FileVersions in a single call, suitable for smaller datasets. ```csharp Task> GetAllLatestFilesVersionAsync() ``` -------------------------------- ### Quick Start Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BIM360/llm.txt Demonstrates how to initialize the BIM360client and use both the Manager and Fluent URL approaches to list issues. ```csharp using Autodesk.BIM360; var client = new BIM360client(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Manager approach (recommended) — auto-paginates await foreach (var issue in client.IssuesManager.ListIssuesAsync(containerId)) Console.WriteLine(issue.Title); // Fluent URL approach — direct REST mapping var response = await client.Api.Issues.V2.Containers[containerId].QualityIssues.GetAsync(); ``` -------------------------------- ### Quick Start Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/README.md Demonstrates how to create an auto-refreshing 2-legged token using the Authentication client and then use it with the Data Management client to list projects or fetch hubs. ```csharp using Autodesk.Authentication; using Autodesk.DataManagement; // 1. Create an auto-refreshing 2-legged token var authClient = new AuthenticationClient(); var tokenStore = new InMemoryTokenStore(); var getToken = authClient.Helper.CreateTwoLeggedAutoRefreshToken( clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET", scopes: new[] { "data:read", "data:write" }, tokenStore); // 2. Use any service client var dmClient = new DataManagementClient(getToken); // Manager approach (recommended) — auto-paginates all pages await foreach (var project in dmClient.Projects.ListProjectsAsync("b.my-account-id")) { Console.WriteLine($"{project.Id} — {project.Attributes?.Name}"); } // Fluent URL approach — mirrors the REST endpoint directly var hubs = await dmClient.DataMgtApi.Project.V1.Hubs.GetAsync(); ``` -------------------------------- ### Dependency Injection Setup Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Common.HttpClient/README.md Example of setting up and using the HttpClient library with .NET dependency injection. ```csharp using Autodesk.Common.HttpClientLibrary; using Microsoft.Extensions.DependencyInjection; // In your Startup.cs or Program.cs services.AddAdskToolkitHttpClient("MyHttpClient"); // Use in your services public class MyService { private readonly HttpClient _httpClient; public MyService(IHttpClientFactory httpClientFactory) { _httpClient = httpClientFactory.CreateClient("MyHttpClient"); } } ``` -------------------------------- ### Complete Example with Authentication and Rate Limiting Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Common.HttpClient/README.md A comprehensive example demonstrating the setup of the Autodesk Common HttpClient with dependency injection, authentication using a token provider, and client creation. ```csharp using Autodesk.Common.HttpClientLibrary; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; var builder = Host.CreateApplicationBuilder(args); // Register HttpClient builder.Services.AddAdskToolkitHttpClient("ApsClient"); // Register your token provider builder.Services.AddScoped(); var host = builder.Build(); // Use the client var httpClientFactory = host.Services.GetRequiredService(); var tokenProvider = host.Services.GetRequiredService(); var httpClient = httpClientFactory.CreateClient("ApsClient"); var adapter = HttpClientFactory.CreateAdapter( () => tokenProvider.GetTokenAsync(), httpClient ); // Use adapter with your SDK clients var dataManagementClient = new DataManagementClient(adapter); ``` -------------------------------- ### Installation Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Parameters/README.md Installs the Parameters and Authentication SDK packages using the .NET CLI. ```bash dotnet add package Adsk.Platform.Parameters dotnet add package Adsk.Platform.Authentication ``` -------------------------------- ### Basic Filtering Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/DataManagement/README.md C# code example demonstrating how to get folder content with basic filtering using the DataManagementClient. ```csharp public async Task> getFolderContentByPageAsync(string projectId, string folderId) { return await _dataMgtClient.Projects[projectId].Folders[folderId].Contents .GetAsync(r => { r.QueryParameters.Filtertype = ["item"]; r.QueryParameters.FilterextensionType = ["items:autodesk.bim360:File"]; }); } ``` -------------------------------- ### Quick example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BIM360/linkedin-post.md Example of how to instantiate the BIM360 client and retrieve quality issues. ```csharp var bim360 = new BIM360client(getAccessToken); // Get quality issues var issues = await bim360.Issues.Containers[containerId].QualityIssues.GetAsync(); ``` -------------------------------- ### Quick Start Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.ACC/llm.txt Demonstrates how to initialize the ACC client and use both the Manager API (recommended) and the Fluent URL API to list issues. ```csharp using Autodesk.ACC; var client = new ACCclient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Manager approach (recommended) — auto-paginates await foreach (var issue in client.IssuesManager.ListIssuesAsync("PROJECT_ID")) Console.WriteLine(issue.Title); // Fluent URL approach — direct REST mapping var response = await client.Api.Construction.Issues.V1.Projects["PROJECT_ID"].Issues.GetAsync(); ``` -------------------------------- ### Installation Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BIM360/README.md Installs the BIM 360 SDK and the Authentication SDK using the .NET CLI. ```bash dotnet add package Adsk.Platform.BIM360 dotnet add package Adsk.Platform.Authentication ``` -------------------------------- ### SDK Representation of REST API Endpoint Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/GetStarted/quickStart.md This snippet shows how a REST API endpoint (GET https://developer.api.autodesk.com/project/v1/hubs) is represented in the SDK. ```csharp //https://developer.api.autodesk.com / project / v1 / hubs (GET) client.DataMgtApi . Project . V1 . Hubs . GetAsync() ``` -------------------------------- ### Upload a File (OSS) Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.DataManagement/README.md Example code for uploading a file using the Object Storage Service (OSS), involving getting a signed URL, uploading to S3, and completing the upload. ```csharp // 1. Get a signed upload URL var upload = await client.Objects.GetS3SignedUploadUrlAsync("my-bucket", "my-file.txt"); // 2. Upload the file to S3 using the signed URL (use HttpClient or similar) // ... // 3. Complete the upload await client.Objects.CompleteS3UploadAsync("my-bucket", "my-file.txt", new Completes3upload_body { UploadKey = upload?.UploadKey, ETags = new List { eTag } }); ``` -------------------------------- ### Quick Start Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Automation/llm.txt Demonstrates how to initialize the AutomationClient and use both the Manager and Fluent URL approaches to interact with the Design Automation API. ```csharp using Autodesk.Automation; var client = new AutomationClient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Manager approach (recommended) — auto-paginates await foreach (var activityId in client.ActivitiesManager.ListActivitiesAsync()) Console.WriteLine(activityId); // Fluent URL approach — direct REST mapping var response = await client.Api.Da.UsEast.V3.Activities.GetAsync(); ``` -------------------------------- ### Usage Examples - List Groups and Collections Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Parameters/README.md An example demonstrating how to list parameter groups and their associated collections. ```csharp using Autodesk.Parameters; var groups = await client.GroupsManager.ListGroupsAsync(accountId); foreach (var group in groups?.Results ?? []) { Console.WriteLine($"Group: {group.Id} — {group.Title}"); await foreach (var collection in client.CollectionsManager.ListCollectionsAsync(accountId, group.Id)) { Console.WriteLine($" Collection: {collection.Id} — {collection.Title}"); } } ``` -------------------------------- ### Installation Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/BuildingConnected/index.md Install the Adsk.Platform.BuildingConnected package using the .NET CLI. ```bash dotnet add package Adsk.Platform.BuildingConnected ``` -------------------------------- ### Install Adsk.Platform.Authentication Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/Authentication/README.md Installs the Adsk.Platform.Authentication package using the .NET CLI. ```bash dotnet add package Adsk.Platform.Authentication ``` -------------------------------- ### Installation Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Automation/README.md Installs the Design Automation SDK for .NET packages. ```bash dotnet add package Adsk.Platform.Automation dotnet add package Adsk.Platform.Authentication ``` -------------------------------- ### Installation Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Common.HttpClient/README.md Command to install the HttpClient library using the .NET CLI. ```cmd dotnet add package Adsk.Platform.HttpClient ``` -------------------------------- ### Error Handling Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BIM360/README.md Example demonstrating how to catch HttpRequestException for non-success HTTP responses. ```csharp try { var issues = await client.IssuesManager.ListIssuesAsync(containerId).ToListAsync(); } catch (HttpRequestException ex) { Console.WriteLine($"Status: {ex.StatusCode} — {ex.Message}"); if (ex.Data["context"] is HttpResponseMessage response) { Console.WriteLine($"URI: {response.RequestMessage?.RequestUri}"); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine($"Body: {body}"); } } ``` -------------------------------- ### Install Adsk.Platform.BIM360 Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/BIM360/index.md Install the Adsk.Platform.BIM360 package using the .NET CLI. ```bash dotnet add package Adsk.Platform.BIM360 ``` -------------------------------- ### Error Handling Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Parameters/README.md Example demonstrating how to catch HttpRequestException for non-success HTTP responses. ```csharp try { var groups = await client.GroupsManager.ListGroupsAsync(accountId); } catch (HttpRequestException ex) { Console.WriteLine($"Status: {ex.StatusCode} — {ex.Message}"); if (ex.Data["context"] is HttpResponseMessage response) { Console.WriteLine($"URI: {response.RequestMessage?.RequestUri}"); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine($"Body: {body}"); } } ``` -------------------------------- ### Create Parameters Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Parameters/README.md Example of how to create new parameters using the ParametersManager. ```csharp using Autodesk.Parameters.Parameters.V1.Accounts.Item.Groups.Item.Collections.Item.Parameters; var created = await client.ParametersManager.CreateParametersAsync(accountId, groupId, collectionId, new ParametersPostRequestBody { // Set parameter definition properties }); ``` -------------------------------- ### List RFIs Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BIM360/README.md Example of how to list all RFIs for a given container. ```csharp await foreach (var rfi in client.RFIsManager.ListRfisAsync(containerId)) { Console.WriteLine($"{rfi.Title} — {rfi.Status}"); } ``` -------------------------------- ### Installation Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BuildingConnected/README.md Installs the Autodesk BuildingConnected SDK and the Autodesk Authentication SDK using the .NET CLI. ```bash dotnet add package Adsk.Platform.BuildingConnected dotnet add package Adsk.Platform.Authentication ``` -------------------------------- ### Installation Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.ACC/README.md Installs the Autodesk Construction Cloud SDK for .NET and the Authentication package. ```bash dotnet add package Adsk.Platform.ACC dotnet add package Adsk.Platform.Authentication ``` -------------------------------- ### Basic Usage Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Common.HttpClient/README.md Example of creating a basic HttpClient instance. ```csharp using Autodesk.Common.HttpClientLibrary; // Create a basic HttpClient var httpClient = HttpClientFactory.Create(); // Create with rate limiting var rateLimitedClient = HttpClientFactory.Create((maxConcurrentRequests: 10, timeWindow: TimeSpan.FromMinutes(1))); ``` -------------------------------- ### Search Parameters Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Parameters/README.md Example of how to search for parameters using the ParametersManager. ```csharp using Autodesk.Parameters.Parameters.V1.Accounts.Item.Groups.Item.Collections.Item.ParametersSearch; await foreach (var param in client.ParametersManager.SearchParametersAsync(accountId, groupId, collectionId, new ParametersSearchPostRequestBody())) { Console.WriteLine($"{param.Id}: {param.Name}"); } ``` -------------------------------- ### List Hubs and Projects Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.DataManagement/README.md Example code for listing hubs and iterating through projects within an account. ```csharp var hubs = await client.Hubs.GetHubsAsync(); await foreach (var project in client.Projects.ListProjectsAsync("b.my-account-id")) { Console.WriteLine($"{project.Id} - {project.Attributes?.Name}"); } ``` -------------------------------- ### Get a 2-legged access token Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/Authentication/README.md Example of using the AuthenticationClient helper to get a 2-legged access token. ```csharp // Create a new instance of the AuthenticationClient var authClient = new AuthenticationClient(); // Use helpers to get a 2-legged access token AuthTokenExtended authToken = await authClient.Helper.GetTwoLeggedToken( APS_CLIENT_ID, APS_CLIENT_SECRET, [AuthenticationScopeDefaults.DataWrite, AuthenticationScopeDefaults.DataRead]); ``` -------------------------------- ### Get HTTP Response Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/HowTo/getHttpResponse.md This C# code snippet demonstrates how to use a NativeResponseHandler to capture the raw HTTP response from a request to get a large object tree. ```csharp public async Task GetObjectTree(string fileUrnToBase64, string modelGuid) { // Override the default response handler to get the response HttpResponseMessage getTree = async () => { // Create a response handler to capture the raw HTTP response var responseHandler = new NativeResponseHandler(); var objectTree = await api.Designdata[fileUrnToBase4].Metadata[modelGuid].GetAsync(r => { r.QueryParameters.Forceget = true; r.Headers.Add("ForceGet", "true"); // Add the response handler to the request options r.Options.Add(new ResponseHandlerOption() { ResponseHandler = responseHandler }); }); // Return the raw HTTP response return responseHandler.Value as HttpResponseMessage; }; HttpResponseMessage response = await getTree(); // For large models, the response is 202 Accepted, and the tree is not ready yet. // We need to wait and retry until the tree is ready. while (response.StatusCode == System.Net.HttpStatusCode.Created) { await Task.Delay(5000); response = await getTree(); } // Now we call again the API to get the tree with the default response handler. //In this way, the response is unzipped and parsed and the tree is returned. var objectTree = await api.Designdata[fileUrnToBase4].Metadata[modelGuid].GetAsync(); return objectTree; } ``` -------------------------------- ### Create an Activity Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Automation/README.md Example of creating a Design Automation activity. ```csharp using Autodesk.Automation.Da.UsEast.V3.Activities; ActivitiesPostResponse? activity = await client.ActivitiesManager.CreateActivityAsync(new ActivitiesPostRequestBody { Id = "MyActivity", Engine = "Autodesk.AutoCAD+24", CommandLine = ["$(engine.path)\\accoreconsole.exe /i $(args[input].path) /s $(settings[script].path)"] }); Console.WriteLine($"Activity created: {activity?.Id}"); ``` -------------------------------- ### Quick Start Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Automation/README.md Demonstrates basic usage of the SDK, including listing engines and creating a work item. ```csharp using Autodesk.Automation; var client = new AutomationClient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // List all engines (auto-paginated) await foreach (var engineId in client.EnginesManager.ListEnginesAsync()) { Console.WriteLine(engineId); } // Create a WorkItem using Autodesk.Automation.Da.UsEast.V3.Workitems; WorkitemsPostResponse? workItem = await client.WorkItemsManager.CreateWorkItemAsync(new WorkitemsPostRequestBody { ActivityId = "MyNickname.MyActivity+MyAlias" }); Console.WriteLine($"WorkItem created: {workItem?.Id} — Status: {workItem?.Status}"); ``` -------------------------------- ### Get Item Tip Version Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.DataManagement/README.md Example code for retrieving the latest version (tip) of an item. ```csharp var tip = await client.Items.GetItemTipAsync("b.my-project-id", itemId); Console.WriteLine($"Latest version: {tip?.Data?.Id}"); ``` -------------------------------- ### Quick Start - Fluent URL Approach Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Parameters/README.md Demonstrates the Fluent URL API approach for directly mirroring REST endpoint structures. ```csharp using Autodesk.Parameters; var client = new ParametersClient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Fluent URL approach — mirrors the REST path directly var response = await client.Api.Parameters.V1.Accounts[accountId].Groups[groupId].Collections.GetAsync(); ``` -------------------------------- ### Quick Start Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BIM360/README.md Demonstrates how to initialize the BIM360 client and use both the Manager API (recommended) and the Fluent URL API to interact with BIM 360 services. ```csharp using Autodesk.BIM360; var client = new BIM360client(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Manager approach (recommended) — auto-paginates all pages await foreach (var issue in client.IssuesManager.ListIssuesAsync(containerId)) { Console.WriteLine($"{issue.Title} — {issue.Status}"); } // Fluent URL approach — mirrors the REST path directly var response = await client.Api.Issues.V2.Containers[containerId].QualityIssues.GetAsync(); ``` -------------------------------- ### Get the file id by the file path Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/index.md An example demonstrating how to use the helper function to get a file ID by its path. ```csharp using Autodesk.DataManagement; // Initialize the DataManagementClient var authToken() => Task.FromResult("YOUR_ACCESS_TOKEN"); var DMclient = new DataManagementClient(authToken); // A single method getting the file id by path var file = await DMclient.Helper.GetFileItemByPathAsync("Account/Project/Folder/SubFolder/FileName.ext"); Console.WriteLine($"File ID: {file.Id}"); ``` -------------------------------- ### Browse Folder Contents Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.DataManagement/README.md Example code for browsing the contents of a folder, starting from the top folders of a project. ```csharp var topFolders = await client.Projects.GetTopFoldersAsync("b.my-account-id", "b.my-project-id"); var rootFolderId = topFolders?.Data?.FirstOrDefault()?.Id; await foreach (var item in client.Folders.ListFolderContentsAsync("b.my-project-id", rootFolderId!)) { Console.WriteLine($"{item.Type}: {item.Id}"); } ``` -------------------------------- ### Quick Start - Manager Approach Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Parameters/README.md Demonstrates the recommended Manager API approach for listing parameter collections with automatic pagination. ```csharp using Autodesk.Parameters; var client = new ParametersClient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Manager approach (recommended) — auto-paginates all pages await foreach (var collection in client.CollectionsManager.ListCollectionsAsync(accountId, groupId)) { Console.WriteLine($"{collection.Id}: {collection.Title}"); } ``` -------------------------------- ### Get User Info using Helper Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/Authentication/README.md Example of how to retrieve user information using the `Helper` class from the `AuthenticationClient`. ```csharp var authClient = new AuthenticationClient(); var userInfo=authClient.Helper.GetUserInfoAsync("your three legged token"); ``` -------------------------------- ### Quick Start - Fluent URL Approach Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.ACC/README.md Demonstrates the Fluent URL API approach, which mirrors the REST endpoint structure. ```csharp // Fluent URL approach — mirrors the REST path directly var response = await client.Api.Construction.Issues.V1.Projects[projectId].Issues.GetAsync(); ``` -------------------------------- ### Get the hub ids Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/index.md An example demonstrating how to use the Fluent API to retrieve hub IDs. ```csharp using Autodesk.DataManagement; // Initialize the DataManagementClient var authToken() => Task.FromResult("YOUR_ACCESS_TOKEN"); var DMclient = new DataManagementClient(authToken); // Fluent API reproducing the API endpoint to get the hub ids var hubs = await DMclient.DataMgtApi.Project.V1.Hubs.GetAsync(); var hubIds = hubs?.Data?.Select(h => h?.Id ?? "")?.ToArray() ?? []; Console.WriteLine($"Hubs: {string.Join(';', hubIds)}"); ``` -------------------------------- ### Get WorkItem Status Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Automation/README.md Retrieves the status and progress of a specific work item using its GUID. ```csharp using Autodesk.Automation.Da.UsEast.V3.Workitems.Item; WorkitemsGetResponse? status = await client.WorkItemsManager.GetWorkItemStatusAsync("workitem-guid"); Console.WriteLine($"Status: {status?.Status}, Progress: {status?.Progress}"); ``` -------------------------------- ### Quick Start - Manager Approach Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.ACC/README.md Demonstrates the recommended Manager API approach for listing issues, including automatic pagination. ```csharp using Autodesk.ACC; var client = new ACCclient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Manager approach (recommended) — auto-paginates all pages await foreach (var issue in client.IssuesManager.ListIssuesAsync(projectId)) { Console.WriteLine($"{issue.Title} — {issue.Status}"); } ``` -------------------------------- ### Use DataConnectorClient to get jobs Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/ACC/DataConnector/index.md Example C# code demonstrating how to use the DataConnectorClient to retrieve jobs for a given account. ```csharp using Autodesk.ACC.DataConnector; using Autodesk.ACC.DataConnector.Models; public async Task GetJobs() { async Task getAccessToken() { //return access token with your logic } var DataConnectorClient = new DataConnectorClient(getAccessToken); var accountId = ""; // Replace with your account id // The `DataConnectorClient.Api` object refers to the base url `https://developer.api.autodesk.com/data-connector/v1/` // Returns the jobs for the specified account in ascending order var jobs = await Api.Accounts[accountId].Jobs.GetAsync(r => r.QueryParameters.Sort="asc"); return jobs; } ``` -------------------------------- ### Quick Start Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Parameters/llm.txt Demonstrates how to initialize the ParametersClient and use both the Manager and Fluent URL approaches to interact with the API. ```csharp using Autodesk.Parameters; var client = new ParametersClient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Manager approach (recommended) — auto-paginates await foreach (var collection in client.CollectionsManager.ListCollectionsAsync(accountId, groupId)) Console.WriteLine($"{collection.Id}: {collection.Title}"); // Fluent URL approach — direct REST mapping var response = await client.Api.Parameters.V1.Accounts[accountId].Groups[groupId].Collections.GetAsync(); ``` -------------------------------- ### Usage Example - Get Product by ID Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.InformedDesign/README.md Retrieves a specific product using its unique ID. ```csharp using Autodesk.InformedDesign.IndustrializedConstruction.InformedDesign.V1.Products.Item; Guid productId = Guid.Parse("your-product-id"); WithProductGetResponse? product = await client.ProductsManager.GetProductAsync(productId); ``` -------------------------------- ### Quick Start - Manager Approach Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BuildingConnected/README.md Demonstrates the recommended Manager API approach for listing projects, which automatically handles pagination. ```csharp using Autodesk.BuildingConnected; var client = new BuildingConnectedClient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Manager approach (recommended) — auto-paginates all pages await foreach (var project in client.ProjectsManager.ListProjectsAsync()) { Console.WriteLine($"{project.Name} — {project.State}"); } ``` -------------------------------- ### Quick Start - Fluent URL Approach Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Vault/README.md Demonstrates how to retrieve server information using the Fluent URL API. ```csharp var serverInfo = await client.Api.ServerInfo.GetAsync(); Console.WriteLine($"Server Version: {serverInfo?.ServerVersion}"); ``` -------------------------------- ### Quick Start - Fluent URL Approach Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BuildingConnected/README.md Demonstrates the Fluent URL API approach, which directly mirrors the REST endpoint structure. ```csharp using Autodesk.BuildingConnected; var client = new BuildingConnectedClient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Fluent URL approach — mirrors the REST path directly var response = await client.Api.Construction.Buildingconnected.V2.Projects.GetAsync(); ``` -------------------------------- ### Get the hub list using DataManagementClient Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/Authentication/README.md Example of obtaining a 2-legged access token and then using it to fetch the hub list via the DataManagementClient. ```csharp using Autodesk.DataManagement; using Autodesk.Authentication; public async Task GetHub() { var APS_CLIENT_ID="abcd"; // Replace with your client id var APS_CLIENT_SECRET="1234"; // Replace with your client secret AuthenticationClient authClient = new(); async Task getAccessToken() { var token = await authClient.Helper.GetTwoLeggedToken(APS_CLIENT_ID, APS_CLIENT_SECRET, [ AuthenticationScopeDefaults.DataWrite]); return token?.AccessToken is null ? throw new InvalidOperationException() : token.AccessToken; } var DMclient = new DataManagementClient(getAccessToken); var hubs = await DMclient.DataMgtApi.Project.V1.Hubs.GetAsync(); return hubs; } ``` -------------------------------- ### Using the Fluent URL API Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Parameters/README.md Examples demonstrating how to use the fluent URL API for direct endpoint access. ```csharp // GET /parameters/v1/accounts/{accountId}/groups var groups = await client.Api.Parameters.V1.Accounts[accountId].Groups.GetAsync(); // GET /parameters/v1/specs var specs = await client.Api.Parameters.V1.Specs.GetAsync(); // GET /parameters/v1/classifications/categories var categories = await client.Api.Parameters.V1.Classifications.Categories.GetAsync(); ``` -------------------------------- ### Using the Fluent URL API Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.InformedDesign/README.md Examples of using the fluent API to list products and get a single variant. ```csharp // List products directly via fluent API var response = await client.Api.IndustrializedConstruction.InformedDesign.V1.Products .GetAsync(config => { config.QueryParameters.AccessType = GetAccessTypeQueryParameterType.ACC; config.QueryParameters.AccessId = "your-access-id"; }); // Get a single variant Guid variantId = Guid.Parse("your-variant-id"); var variant = await client.Api.IndustrializedConstruction.InformedDesign.V1.Variants[variantId] .GetAsync(); ``` -------------------------------- ### Quick Start Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Tandem/README.md Demonstrates basic usage of the TandemClient using both the Manager API and the Fluent URL API. ```csharp using Autodesk.Tandem; var client = new TandemClient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Manager approach (recommended) var groups = await client.GroupsManager.GetGroupsAsync(); var twin = await client.TwinsManager.GetTwinAsync("urn:adsk.dtt:..."); // Fluent URL approach — mirrors the REST path directly var response = await client.Api.Tandem.V1.Groups.GetAsync(); ``` -------------------------------- ### List Groups and Get Twins Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Tandem/README.md Example of fetching groups and then retrieving twins associated with a specific group. ```csharp using Autodesk.Tandem; var client = new TandemClient(getAccessToken); var groups = await client.GroupsManager.GetGroupsAsync(); var twins = await client.TwinsManager.GetTwinsByGroupAsync("urn:adsk.dtg:..."); ``` -------------------------------- ### Create an AppBundle and Upload Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Automation/README.md Example of creating an AppBundle and obtaining upload parameters. ```csharp using Autodesk.Automation.Da.UsEast.V3.Appbundles; AppbundlesPostResponse? bundle = await client.AppBundlesManager.CreateAppBundleAsync(new AppbundlesPostRequestBody { Id = "MyAppBundle", Engine = "Autodesk.AutoCAD+24" }); // Use bundle.UploadParameters to upload the package string? uploadUrl = bundle?.UploadParameters?.EndpointURL; ``` -------------------------------- ### Using the Fluent URL API Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BIM360/README.md Examples demonstrating how to use the Fluent URL API for direct REST path access. ```csharp // GET /issues/v2/containers/{containerId}/quality-issues var issues = await client.Api.Issues.V2.Containers[containerId].QualityIssues.GetAsync(); // GET /bim360/assets/v2/projects/{projectId}/assets var assets = await client.Api.Bim360.Assets.V2.Projects[projectId].Assets.GetAsync(); // GET /cost/v1/containers/{containerId}/budgets var budgets = await client.Api.Cost.V1.Containers[containerId].Budgets.GetAsync(); ``` -------------------------------- ### Helper Method Example Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/README.md Illustrates the use of Helper methods for simplifying multi-step workflows. ```csharp // Single call to navigate the folder hierarchy by path var file = await dmClient.Helper.GetFileItemByPathAsync( "MyAccount/MyProject/Folder/SubFolder/FileName.ext"); ``` -------------------------------- ### Using the Fluent URL API Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Vault/README.md Examples of using the fluent URL API to interact with Vault resources, such as getting server info, users, or a file by ID. ```csharp // Get server information var serverInfo = await client.Api.ServerInfo.GetAsync(); // Get all users var users = await client.Api.Users.GetAsync(); // Get file by ID through the full path var file = await client.Api.Vaults[vaultId].Files[fileId].GetAsync(); ``` -------------------------------- ### Create a Project and Bid Package Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BuildingConnected/README.md Demonstrates how to create a new project and then create a bid package associated with that project. ```csharp using Autodesk.BuildingConnected.Construction.Buildingconnected.V2.Projects; using Autodesk.BuildingConnected.Construction.Buildingconnected.V2.BidPackages; var newProject = await client.ProjectsManager.CreateProjectAsync(new ProjectsPostRequestBody { Name = "New Office Building", }); var bidPackage = await client.BidPackagesManager.CreateBidPackageAsync(new BidPackagesPostRequestBody { ProjectId = newProject?.Id, Name = "Electrical Package", }); ``` -------------------------------- ### Install Adsk.Platform.VaultData Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/VaultData/index.md Installs the Adsk.Platform.VaultData package using the .NET CLI. ```bash dotnet add package Adsk.Platform.VaultData ``` -------------------------------- ### Quick Start - Manager Approach Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.InformedDesign/README.md Demonstrates how to initialize the InformedDesignClient and use the Manager API to list products. ```csharp using Autodesk.InformedDesign; var client = new InformedDesignClient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Manager approach (recommended) — auto-paginates all pages await foreach (var product in client.ProductsManager.ListProductsAsync()) { Console.WriteLine(product); } // Create a product using Autodesk.InformedDesign.IndustrializedConstruction.InformedDesign.V1.Products; ProductsPostRequestBody body = new() { /* set properties */ }; ProductsPostResponse? created = await client.ProductsManager.CreateProductAsync(body); ``` -------------------------------- ### Install the package Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/InformedDesign/index.md Installs the Adsk.Platform.InformedDesign package using the .NET CLI. ```bash dotnet add package Adsk.Platform.InformedDesign ``` -------------------------------- ### Quick Start Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Tandem/llm.txt Demonstrates how to initialize the TandemClient and use both the Manager approach and the Fluent URL approach to interact with the API. ```csharp using Autodesk.Tandem; var client = new TandemClient(() => Task.FromResult("YOUR_ACCESS_TOKEN")); // Manager approach (recommended) var groups = await client.GroupsManager.GetGroupsAsync(); // Fluent URL approach — direct REST mapping var response = await client.Api.Tandem.V1.Groups.GetAsync(); ``` -------------------------------- ### Authentication with 2-Legged OAuth Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Parameters/README.md Shows how to set up authentication for server-to-server communication using the Authentication SDK. ```csharp using Autodesk.Parameters; using Autodesk.Authentication; using Autodesk.Authentication.Helpers.Models; var authClient = new AuthenticationClient(); var tokenStore = new InMemoryTokenStore(); var getAccessToken = authClient.Helper.CreateTwoLeggedAutoRefreshToken( clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET", scopes: new[] { "data:read", "data:write" }, tokenStore); var client = new ParametersClient(getAccessToken); ``` -------------------------------- ### Install Adsk.Platform.Automation Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Documentation/docs/Automation/index.md Installs the Adsk.Platform.Automation package using the .NET CLI. ```bash dotnet add package Adsk.Platform.Automation ``` -------------------------------- ### Quick Start - Manager Approach Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.Vault/README.md Demonstrates how to initialize the VaultClient and retrieve a list of vaults using the Manager API. ```csharp using Autodesk.Vault; var client = new VaultClient( () => Task.FromResult("YOUR_ACCESS_TOKEN"), vaultServerUrl: "https://your-vault-server"); // Manager approach (recommended) var vaults = await client.Informational.GetVaultsAsync(); foreach (var vault in vaults?.Data ?? []) { Console.WriteLine($"Vault: {vault.Name} (ID: {vault.Id})"); } ``` -------------------------------- ### Authentication with 2-Legged OAuth Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BIM360/README.md Shows how to set up authentication for server-to-server communication using the Adsk.Platform.Authentication package. ```csharp using Autodesk.BIM360; using Autodesk.Authentication; using Autodesk.Authentication.Helpers.Models; var authClient = new AuthenticationClient(); var tokenStore = new InMemoryTokenStore(); var getAccessToken = authClient.Helper.CreateTwoLeggedAutoRefreshToken( clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET", scopes: new[] { "data:read", "data:write", "account:read" }, tokenStore); var client = new BIM360client(getAccessToken); ``` -------------------------------- ### Dependency Injection Setup Source: https://github.com/adsk-duszykf/adsk.platform.toolkit.dotnet/blob/main/Autodesk.BuildingConnected/README.md Illustrates how to configure the SDK for use with Dependency Injection in ASP.NET Core applications. ```csharp using Autodesk.Common.HttpClientLibrary; using Microsoft.Extensions.DependencyInjection; builder.Services.AddAdskToolkitHttpClient("ApsClient"); // In your service: public class MyService(IHttpClientFactory httpClientFactory) { public BuildingConnectedClient CreateClient(Func> getAccessToken) { var httpClient = httpClientFactory.CreateClient("ApsClient"); return new BuildingConnectedClient(getAccessToken, httpClient); } } ```