### Retrieve Manifest Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Demonstrates how to fetch a manifest and iterate through its derivatives. ```csharp var manifest = await modelClient.GetManifestAsync( urn: base64EncodedUrn, accessToken: "token" ); foreach (var derivative in manifest.Derivatives) { Console.WriteLine($"Derivative: {derivative.OutputType} - {derivative.Status}"); } ``` -------------------------------- ### Get User Info Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/authentication-client.md Demonstrates how to retrieve and display user information using an access token. ```csharp var userInfo = await authClient.GetUserInfoAsync( authorization: "three-legged-access-token" ); Console.WriteLine($"User ID: {userInfo.UserId}"); Console.WriteLine($"Email: {userInfo.EmailVerified}"); ``` -------------------------------- ### Initialize AuthClientConfiguration Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Example of initializing the authentication client configuration. ```csharp var authConfig = new AuthClientConfiguration { BaseAddress = new Uri("https://developer.api.autodesk.com") }; ``` -------------------------------- ### Initialize ApsConfiguration Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Examples of initializing configuration for production, staging, or custom endpoints. ```csharp // Production (default) var prodConfig = new ApsConfiguration(); // Staging var stagingConfig = new ApsConfiguration(AdskEnvironment.Stg); // Custom URL var customConfig = new ApsConfiguration { BaseAddress = new Uri("https://custom.api.endpoint.com") }; ``` -------------------------------- ### StartJobAsync Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Demonstrates how to initialize a JobPayload and submit it to the Model Derivative service. ```csharp var jobPayload = new JobPayload { Input = new Input { Urn = Convert.ToBase64String(Encoding.UTF8.GetBytes("urn:adsk.objects:os.object:bucket/object")) }, Output = new Output { Formats = new List { new Format { Type = "svf2", Views = new List { "3d" } }, new Format { Type = "pdf" } } } }; var job = await modelClient.StartJobAsync( jobPayload: jobPayload, accessToken: "two-legged-token" ); Console.WriteLine($"Job ID: {job.Result.Id}"); Console.WriteLine($"Status: {job.Result.Status}"); ``` -------------------------------- ### CreateItemAsync Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/datamanagement-client.md Example of creating a new item with a payload. ```csharp var payload = new CreateItemPayload { Data = new CreateItemData { Type = "items", Attributes = new CreateItemAttributes { Name = "new-file.pdf", DisplayName = "New Document" } } }; var newItem = await dataClient.CreateItemAsync( projectId: "project-id", folderId: "folder-id", payload: payload, accessToken: "three-legged-token" ); ``` -------------------------------- ### Download Derivative Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Demonstrates how to download a derivative stream and save it to a local file. ```csharp using (var derivativeStream = await modelClient.GetDerivativeAsync( urn: base64EncodedSourceUrn, derivativeUrn: derivativeFromManifest, accessToken: "token")) { using (var fileStream = File.Create("output.svf2")) { await derivativeStream.CopyToAsync(fileStream); } } ``` -------------------------------- ### GetHubAsync Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/datamanagement-client.md Example of retrieving and displaying details for a specific hub. ```csharp var hubDetail = await dataClient.GetHubAsync( hubId: "b.abc123def456", accessToken: "three-legged-token" ); Console.WriteLine($"Hub Name: {hubDetail.Data.Attributes.Name}"); ``` -------------------------------- ### Initialize CreateItemPayload Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/types.md Example instantiation of the CreateItemPayload for creating a new file. ```csharp var payload = new CreateItemPayload { Data = new CreateItemData { Type = "items", Attributes = new CreateItemAttributes { Name = "new-file.pdf", DisplayName = "New Document" }, Relationships = new CreateItemRelationships { Folder = new Folder { Data = new RefData { Id = "folder-id" } } } } }; ``` -------------------------------- ### Download Thumbnail Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Demonstrates how to download a thumbnail image stream and save it to a file. ```csharp using (var thumbnailStream = await modelClient.GetThumbnailAsync( urn: base64EncodedUrn, accessToken: "token")) { using (var fileStream = File.Create("thumbnail.png")) { await thumbnailStream.CopyToAsync(fileStream); } } ``` -------------------------------- ### List Service Accounts Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/secureserviceaccount-client.md Demonstrates how to fetch service accounts and iterate through the returned items. ```csharp var accounts = await ssaClient.ListServiceAccountsAsync( teamId: "team-id", limit: 50, accessToken: "token" ); foreach (var account in accounts.Items) { Console.WriteLine($"Account: {account.Title} ({account.Id})"); } ``` -------------------------------- ### GetItemAsync Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/datamanagement-client.md Example of retrieving an item using the Data Management client. ```csharp var item = await dataClient.GetItemAsync( projectId: "project-id", itemId: "item-id", accessToken: "three-legged-token" ); Console.WriteLine($"Item Name: {item.Data.Attributes.Name}"); ``` -------------------------------- ### Authorize Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/authentication-client.md Demonstrates how to construct an authorization URL to redirect users for consent. ```csharp var scopes = new List { Scopes.DataRead, Scopes.CodeAll }; var authUrl = authClient.Authorize( clientId: "your-client-id", responseType: ResponseType.Code, redirectUri: "https://yourapp.com/callback", scopes: scopes, state: "random-state-string" ); // Redirect user to authUrl ``` -------------------------------- ### ListHubsAsync Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/datamanagement-client.md Example of listing hubs and iterating through the results. ```csharp var hubs = await dataClient.ListHubsAsync( accessToken: "three-legged-token" ); foreach (var hub in hubs.Data) { Console.WriteLine($"Hub: {hub.Attributes.Name}"); } ``` -------------------------------- ### ListProjectsAsync Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/datamanagement-client.md Demonstrates how to call ListProjectsAsync with a hub ID and access token. ```csharp var projects = await dataClient.ListProjectsAsync( hubId: "b.abc123def456", accessToken: "three-legged-token" ); ``` -------------------------------- ### Refresh Token Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/authentication-client.md Demonstrates how to use the RefreshTokenAsync method to obtain a new token. ```csharp var newToken = await authClient.RefreshTokenAsync( refreshToken: "existing-refresh-token", clientId: "your-client-id", clientSecret: "your-client-secret" ); ``` -------------------------------- ### Get System Event Hooks Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/webhooks-client.md Retrieves and iterates through a list of system event webhooks. ```csharp var hooks = await webhooksClient.GetSystemEventHooksAsync( system: "data", _event: "version.added", limit: 50, accessToken: "token" ); foreach (var hook in hooks.Hooks) { Console.WriteLine($"Webhook: {hook.Id} -> {hook.CallbackUrl}"); } ``` -------------------------------- ### ListFoldersAsync Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/datamanagement-client.md Demonstrates how to call ListFoldersAsync with specific project and folder identifiers. ```csharp var contents = await dataClient.ListFoldersAsync( projectId: "project-id", folderId: "folder-id", accessToken: "three-legged-token", pageLimit: 100 ); ``` -------------------------------- ### Initialize HookPayload Instance Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/types.md Example of instantiating a HookPayload object with a callback URL, token, and a JMESPath filter. ```csharp new HookPayload { CallbackUrl = "https://myapp.com/webhooks/handler", Token = "secret-token", Filter = "projectId=='proj-123' && (event == 'version.added' || event == 'version.modified')" } ``` -------------------------------- ### Instantiate ModelDerivativeClient Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Examples of creating a new client instance with or without a custom authentication provider. ```csharp var modelClient = new ModelDerivativeClient(); // or with authentication provider var modelClient = new ModelDerivativeClient( authenticationProvider: customAuthProvider ); ``` -------------------------------- ### GetItemVersionsAsync Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/datamanagement-client.md Demonstrates how to fetch and iterate through item versions using the data client. ```csharp var versions = await dataClient.GetItemVersionsAsync( projectId: "project-id", itemId: "item-id", accessToken: "three-legged-token" ); foreach (var version in versions.Data) { Console.WriteLine($"Version: {version.Attributes.Name}"); } ``` -------------------------------- ### GetFormatsAsync Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Demonstrates how to call GetFormatsAsync and iterate through the returned supported formats and output types. ```csharp var formats = await modelClient.GetFormatsAsync( accessToken: "two-legged-token" ); foreach (var format in formats.Formats) { Console.WriteLine($"Input Type: {format.Name}"); foreach (var output in format.OutputFormats) { Console.WriteLine($" -> {output}"); } } ``` -------------------------------- ### Create a new bucket Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/oss-client.md Defines the method signature and provides an example of creating a bucket with a specific retention policy. ```csharp public async Task CreateBucketAsync( string bucketKey, string policyKey, string xUserId = default, string accessToken = default, bool throwOnError = true ) ``` ```csharp var bucket = await ossClient.CreateBucketAsync( bucketKey: "my-unique-bucket-123", policyKey: "transient", accessToken: "two-legged-token" ); Console.WriteLine($"Bucket created: {bucket.BucketKey}"); ``` -------------------------------- ### GetJobAsync Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Demonstrates how to check the progress and status of a previously submitted job. ```csharp var jobStatus = await modelClient.GetJobAsync( jobId: "returned-from-start-job", accessToken: "token" ); Console.WriteLine($"Progress: {jobStatus.Result.Progress}%"); if (jobStatus.Result.Status == "success") { Console.WriteLine("Translation complete"); } ``` -------------------------------- ### Retrieve bucket details Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/oss-client.md Defines the method signature and provides an example of fetching details for a specific bucket key. ```csharp public async Task GetBucketDetailsAsync( string bucketKey, string xUserId = default, string accessToken = default, bool throwOnError = true ) ``` ```csharp var details = await ossClient.GetBucketDetailsAsync( bucketKey: "my-bucket", accessToken: "token" ); Console.WriteLine($"Bucket Region: {details.Region}"); ``` -------------------------------- ### Get Manifest Definition Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Defines the signature for retrieving a design file manifest. ```csharp public async Task GetManifestAsync( string urn, string acceptEncoding = default, string accessToken = default, bool throwOnError = true ) ``` -------------------------------- ### Get Thumbnail Definition Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Defines the signature for downloading a design file thumbnail. ```csharp public async Task GetThumbnailAsync( string urn, int width = 200, int height = 200, string accessToken = default, bool throwOnError = true ) ``` -------------------------------- ### Update Service Account Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/secureserviceaccount-client.md Shows how to construct an update payload and apply changes to a specific service account. ```csharp var updatePayload = new UpdateServiceAccountPayload { Title = "Updated Data Processing Service", Tags = new List { "production", "v2" } }; var updated = await ssaClient.UpdateServiceAccountAsync( teamId: "team-id", serviceAccountId: "sa-id", payload: updatePayload, accessToken: "token" ); ``` -------------------------------- ### List accessible buckets Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/oss-client.md Defines the method signature and provides an example of retrieving a paginated list of buckets. ```csharp public async Task ListBucketsAsync( string region = default, int limit = 10, int offset = 0, string xUserId = default, string accessToken = default, bool throwOnError = true ) ``` ```csharp var buckets = await ossClient.ListBucketsAsync( limit: 50, accessToken: "two-legged-token" ); foreach (var bucket in buckets.Items) { Console.WriteLine($"Bucket: {bucket.BucketKey}"); } ``` -------------------------------- ### Retrieve Webhook History Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/webhooks-client.md Demonstrates how to fetch and iterate through webhook delivery history entries, including checking for error details. ```csharp var history = await webhooksClient.GetHookHistoryAsync( hookId: "webhook-id", eventType: "version.added", status: "failed", accessToken: "token" ); foreach (var entry in history.History) { Console.WriteLine($"Event: {entry.EventType} - {entry.Status} - {entry.Timestamp}"); if (!string.IsNullOrEmpty(entry.LastError)) { Console.WriteLine($" Error: {entry.LastError}"); } } ``` -------------------------------- ### DeleteCredentialAsync Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/secureserviceaccount-client.md Demonstrates how to invoke the DeleteCredentialAsync method and verify the operation success. ```csharp var response = await ssaClient.DeleteCredentialAsync( teamId: "team-id", serviceAccountId: "sa-id", credentialId: "cred-id", accessToken: "token" ); if (response.IsSuccessStatusCode) { Console.WriteLine("Credential revoked"); } ``` -------------------------------- ### Delete Service Account Usage Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/secureserviceaccount-client.md Demonstrates how to delete a service account and verify the operation via the HTTP response. ```csharp var response = await ssaClient.DeleteServiceAccountAsync( teamId: "team-id", serviceAccountId: "sa-id", accessToken: "token" ); if (response.IsSuccessStatusCode) { Console.WriteLine("Service account deleted"); } ``` -------------------------------- ### Update System Event Hook Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/webhooks-client.md Demonstrates updating the callback URL for an existing system event webhook. ```csharp var response = await webhooksClient.UpdateSystemEventHookAsync( system: "data", _event: "version.added", hookId: "webhook-id", hookPayload: new HookPayload { CallbackUrl = "https://myapp.com/webhook/updated-url" }, accessToken: "token" ); ``` -------------------------------- ### Get User Info Async Method Definition Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/authentication-client.md Defines the signature for retrieving authenticated user information. ```csharp public async Task GetUserInfoAsync( string authorization, bool throwOnError = true ) ``` -------------------------------- ### Execute Translation Workflow Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md A complete sequence for checking formats, starting a job, polling for completion, and downloading derivatives. ```csharp // 1. Check supported formats var formats = await modelClient.GetFormatsAsync(accessToken: token); // 2. Submit translation job var jobPayload = new JobPayload { /* ... */ }; var job = await modelClient.StartJobAsync(jobPayload, accessToken: token); // 3. Poll job status while (true) { var status = await modelClient.GetJobAsync(job.Result.Id, accessToken: token); if (status.Result.Status == "success") break; await Task.Delay(5000); } // 4. Retrieve manifest var manifest = await modelClient.GetManifestAsync(base64Urn, accessToken: token); // 5. Download derivatives foreach (var derivative in manifest.Derivatives) { using (var stream = await modelClient.GetDerivativeAsync( base64Urn, derivative.Urn, accessToken: token)) { // Save to file } } ``` -------------------------------- ### Initialize OssClient Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/oss-client.md Instantiate the client with optional SDK manager and authentication provider configurations. ```csharp var ossClient = new OssClient(); // or with authentication provider var ossClient = new OssClient( authenticationProvider: customAuthProvider ); ``` -------------------------------- ### Initialize SdkManager with minimal configuration Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/README.md Uses default production environment settings and an automatically created HttpClient. ```csharp var sdkManager = SdkManagerBuilder.Create().Build(); // Uses default production environment and auto-created HttpClient ``` -------------------------------- ### Initialize Service Clients with SDKManager Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Demonstrates explicit SDKManager configuration versus automatic default initialization. ```csharp // Explicit SDKManager var sdkManager = SdkManagerBuilder.Create() .WithEnvironment(AdskEnvironment.Prd) .Build(); var authClient = new AuthenticationClient(sdkManager); var dataClient = new DataManagementClient(sdkManager); var ossClient = new OssClient(sdkManager); // Automatic default SDKManager var autoClient = new AuthenticationClient(); // Uses default SDKManager internally ``` -------------------------------- ### Initialize AuthenticationClient Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/authentication-client.md Instantiate the client with default settings or a custom SDK manager. ```csharp var authClient = new AuthenticationClient(); // or with custom SDK manager var authClient = new AuthenticationClient(customSdkManager); ``` -------------------------------- ### Initialize SDK with Authentication Provider Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Configures the SdkManager and DataManagementClient using an instance of the authentication provider. ```csharp var authProvider = new DefaultAuthenticationProvider(clientId, clientSecret); var sdkManager = SdkManagerBuilder.Create() .WithAuthenticationProvider(authProvider) .Build(); var dataClient = new DataManagementClient(sdkManager, authProvider); ``` -------------------------------- ### Initialize OssClient Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Constructor for the OssClient service. ```csharp public OssClient( SDKManager.SDKManager sdkManager = default, IAuthenticationProvider authenticationProvider = default ) ``` -------------------------------- ### StartJobAsync Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Submits a file for translation into requested derivative formats. ```APIDOC ## StartJobAsync ### Description Submits a file for translation into requested derivative formats. ### Method public async Task StartJobAsync(JobPayload jobPayload, bool xAdsForce = false, string accessToken = default, bool throwOnError = true) ### Parameters - **jobPayload** (JobPayload) - Required - Job specification including input URN, output formats, and options. - **xAdsForce** (bool) - Optional - Force retranslation of the URN even if derivatives exist. - **accessToken** (string) - Optional - Access token (optional if authenticationProvider is set). - **throwOnError** (bool) - Optional - Whether to throw an exception on API errors. ### Returns Task - Job details with job ID, URN, and status. ``` -------------------------------- ### Initialize SecureServiceAccountClient Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/secureserviceaccount-client.md Instantiate the client with optional SDK manager and authentication provider configurations. ```csharp var ssaClient = new SecureServiceAccountClient(); // or with authentication provider var ssaClient = new SecureServiceAccountClient( authenticationProvider: customAuthProvider ); ``` -------------------------------- ### Get Metadata Properties Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Retrieves the collection of property name-value pairs for a specific object. ```csharp public async Task GetMetadataPropertiesAsync( string urn, string objectId, string acceptEncoding = default, string accessToken = default, bool throwOnError = true ) ``` ```csharp var properties = await modelClient.GetMetadataPropertiesAsync( urn: base64EncodedUrn, objectId: "objectIdFromMetadata", accessToken: "token" ); foreach (var prop in properties.Collection) { Console.WriteLine($"{prop.Name}: {prop.Value}"); } ``` -------------------------------- ### Get Metadata Tree Structure Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Retrieves the metadata hierarchy for a design file. Requires a base64-encoded URN. ```csharp public async Task GetMetadataAsync( string urn, string acceptEncoding = default, string accessToken = default, bool throwOnError = true ) ``` ```csharp var metadata = await modelClient.GetMetadataAsync( urn: base64EncodedUrn, accessToken: "token" ); foreach (var item in metadata.Data) { Console.WriteLine($"Object: {item.Name} (ID: {item.ObjectId})"); } ``` -------------------------------- ### Create Service Account with Explicit Token Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/secureserviceaccount-client.md Demonstrates creating a service account using an explicit access token and handling potential API exceptions. ```csharp try { var account = await ssaClient.CreateServiceAccountAsync( teamId: "team-id", payload: payload, accessToken: "token" ); } catch (SecureServiceAccountApiException ex) { Console.WriteLine($"Error: {ex.Message}"); } ``` -------------------------------- ### Verify SDK Configuration Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Output current configuration settings to the console for verification. ```csharp var config = new ApsConfiguration(); Console.WriteLine($"Base Address: {config.BaseAddress}"); Console.WriteLine($"Timeout: {httpClient.Timeout.TotalSeconds}s"); Console.WriteLine($"Max Connections: {handler.MaxConnectionsPerServer}"); ``` -------------------------------- ### Delete System Event Hook Example Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/webhooks-client.md Demonstrates deleting a system event webhook and checking the response status. ```csharp var response = await webhooksClient.DeleteSystemEventHookAsync( system: "data", _event: "version.added", hookId: "webhook-id-to-delete", accessToken: "token" ); if (response.IsSuccessStatusCode) { Console.WriteLine("Webhook deleted"); } ``` -------------------------------- ### Create a Service Account Credential Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/secureserviceaccount-client.md Demonstrates how to initialize the payload and invoke the creation method. The secret key is only returned during this initial creation call. ```csharp var credPayload = new CreateCredentialPayload { Name = "API Key 2024", Type = "RSA_2048", ExpiresAt = DateTime.UtcNow.AddYears(1) }; var credential = await ssaClient.CreateCredentialAsync( teamId: "team-id", serviceAccountId: "sa-id", payload: credPayload, accessToken: "token" ); Console.WriteLine($"Credential ID: {credential.Id}"); Console.WriteLine($"Save the secret: {credential.SecretKey}"); // Only shown once ``` -------------------------------- ### Basic SDKManager Configuration Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Initializes an SDKManager instance with a specific environment. ```csharp var sdkManager = SdkManagerBuilder.Create() .WithEnvironment(AdskEnvironment.Prd) .Build(); ``` -------------------------------- ### Configure Proxy Settings Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Sets up a web proxy with authentication or defines bypass rules for direct connections. ```csharp var handler = new SocketsHttpHandler { Proxy = new WebProxy("http://proxy.company.com:8080") { Credentials = new NetworkCredential("username", "password") } }; var sdkManager = SdkManagerBuilder.Create() .WithHttpClient(new HttpClient(handler)) .Build(); ``` ```csharp var proxy = new WebProxy("http://proxy:8080"); proxy.BypassList.AddRange(new[] { "localhost", "*.internal.com" }); ``` -------------------------------- ### Configure and Initialize APS SDK Clients Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Sets up a custom SDKManager with specific HTTP handler settings and initializes the required service clients for API interaction. ```csharp public class ApsConfiguration { public static SDKManager CreateConfiguredSdkManager( string clientId, string clientSecret, AdskEnvironment environment = AdskEnvironment.Prd) { // 1. Configure HTTP client var handler = new SocketsHttpHandler { PooledConnectionLifetime = TimeSpan.FromMinutes(2), AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate, MaxConnectionsPerServer = 10 }; var httpClient = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(60) }; // 2. Create authentication provider var authProvider = new DefaultAuthenticationProvider(clientId, clientSecret); // 3. Build SDK manager return SdkManagerBuilder.Create() .WithEnvironment(environment) .WithHttpClient(httpClient) .WithAuthenticationProvider(authProvider) .Build(); } public static void InitializeClients( SDKManager sdkManager, IAuthenticationProvider authProvider, out AuthenticationClient authClient, out DataManagementClient dataClient, out OssClient ossClient, out ModelDerivativeClient modelClient, out WebhooksClient webhooksClient) { authClient = new AuthenticationClient(sdkManager); dataClient = new DataManagementClient(sdkManager, authProvider); ossClient = new OssClient(sdkManager, authProvider); modelClient = new ModelDerivativeClient(sdkManager, authProvider); webhooksClient = new WebhooksClient(sdkManager, authProvider); } } // Usage var sdkManager = ApsConfiguration.CreateConfiguredSdkManager( clientId: "your-client-id", clientSecret: "your-client-secret", environment: AdskEnvironment.Prd ); ApsConfiguration.InitializeClients(sdkManager, authProvider, out var authClient, out var dataClient, out var ossClient, out var modelClient, out var webhooksClient); ``` -------------------------------- ### Manage Buckets and Objects Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/README.md Creates a storage bucket and uploads a file stream to a specific object key. ```csharp var ossClient = new OssClient(); var bucket = await ossClient.CreateBucketAsync( bucketKey: "my-bucket", policyKey: "transient", accessToken: token.AccessToken ); using (var fileStream = File.OpenRead("file.zip")) { var result = await ossClient.UploadObjectAsync( bucketKey: "my-bucket", objectKey: "uploads/file.zip", sourceToUpload: fileStream, accessToken: token.AccessToken ); } ``` -------------------------------- ### Get Metadata Property Names Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Fetches available property names for a specific object ID without retrieving the actual values. ```csharp public async Task GetMetadataPropertyNamesAsync( string urn, string objectId, string acceptEncoding = default, string accessToken = default, bool throwOnError = true ) ``` ```csharp var propertyNames = await modelClient.GetMetadataPropertyNamesAsync( urn: base64EncodedUrn, objectId: "objectIdFromMetadata", accessToken: "token" ); ``` -------------------------------- ### Get Resource Event Hooks Method Signature Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/webhooks-client.md Defines the method signature for retrieving webhooks associated with a specific resource event. ```csharp public async Task GetResourceEventHooksAsync( string system, string resourceId, string _event, int limit = 10, int offset = 0, Region region = default, string accessToken = default, bool throwOnError = true ) ``` -------------------------------- ### Initialize WebhooksClient Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/webhooks-client.md Instantiate the client with an optional authentication provider for automatic token injection. ```csharp var webhooksClient = new WebhooksClient(); // or with authentication provider var webhooksClient = new WebhooksClient( authenticationProvider: customAuthProvider ); ``` -------------------------------- ### Get System Event Hooks Method Signature Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/webhooks-client.md Defines the method signature for retrieving a list of webhooks for a specific system event. ```csharp public async Task GetSystemEventHooksAsync( string system, string _event, int limit = 10, int offset = 0, Region region = default, string accessToken = default, bool throwOnError = true ) ``` -------------------------------- ### Initialize DataManagementClient Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Constructor for the DataManagementClient service. ```csharp public DataManagementClient( SDKManager.SDKManager sdkManager = default, IAuthenticationProvider authenticationProvider = default ) ``` -------------------------------- ### Configure File Transfer Settings Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/oss-client.md Initializes the file transfer configuration and applies it to the OSS client instance. ```csharp var transferConfig = new FileTransferConfigurations( numberOfThreads: 5 ) { ChunkSize = 5 * 1024 * 1024 // 5 MB chunks }; var ossClient = new OssClient(); // File transfer is automatically configured on client creation ``` -------------------------------- ### Handle Bucket Not Found Exception Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/errors.md Demonstrates catching an OssApiException to handle a 404 error by creating a new bucket. ```csharp try { var details = await ossClient.GetBucketDetailsAsync( bucketKey: "nonexistent-bucket" ); } catch (OssApiException ex) { if (ex.ErrorCode == "404") { Console.WriteLine("Bucket does not exist. Creating..."); await ossClient.CreateBucketAsync( bucketKey: "my-bucket", policyKey: "transient" ); } } ``` -------------------------------- ### ApsConfiguration Constructors Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Available constructors for initializing the configuration object. ```csharp public ApsConfiguration() // Defaults to https://developer.api.autodesk.com public ApsConfiguration(AdskEnvironment environment) ``` -------------------------------- ### SdkManagerBuilder Configuration Methods Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Methods available on the SdkManagerBuilder for setting up the environment, HTTP client, and authentication. ```csharp public SdkManagerBuilder WithBaseUrl(string baseUrl) public SdkManagerBuilder WithHttpClient(HttpClient httpClient) public SdkManagerBuilder WithEnvironment(AdskEnvironment environment) public SdkManagerBuilder WithAuthenticationProvider(IAuthenticationProvider authProvider) public SDKManager Build() ``` -------------------------------- ### Initialize WebhooksClient Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Constructor for the WebhooksClient service. ```csharp public WebhooksClient( SDKManager.SDKManager sdkManager = default, IAuthenticationProvider authenticationProvider = default ) ``` -------------------------------- ### Authenticate with APS Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/README.md Initializes the authentication client and retrieves a two-legged access token using client credentials. ```csharp var authClient = new AuthenticationClient(); var token = await authClient.GetTwoLeggedTokenAsync( clientId: "your-client-id", clientSecret: "your-client-secret", scopes: new List { Scopes.DataRead, Scopes.DataWrite } ); ``` -------------------------------- ### Client Service Constructors Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Initializes various APS client services with an optional SDKManager and authentication provider. ```APIDOC ## Client Service Constructors ### Description Constructors for initializing client services including AuthenticationClient, DataManagementClient, OssClient, ModelDerivativeClient, and WebhooksClient. ### Parameters - **sdkManager** (SDKManager) - Optional - The SDK manager instance for HTTP configuration. - **authenticationProvider** (IAuthenticationProvider) - Optional - Provider for automatic token injection. - **region** (Region) - Optional - Geographical location (specific to WebhooksClient). ### Example ```csharp var client = new DataManagementClient( sdkManager: mySdkManager, authenticationProvider: myAuthProvider ); ``` -------------------------------- ### StartJobAsync Method Definition Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/modelderivative-client.md Defines the signature for submitting a translation job. ```csharp public async Task StartJobAsync( JobPayload jobPayload, bool xAdsForce = false, string accessToken = default, bool throwOnError = true ) ``` -------------------------------- ### Execute Complete Webhook Workflow in C# Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/webhooks-client.md Illustrates the full lifecycle of a webhook, including creation, listing, history retrieval, updating, and deletion. ```csharp // 1. Create webhook var hookPayload = new HookPayload { CallbackUrl = "https://myapp.com/webhooks/callback", Token = "secret-token" }; var createResponse = await webhooksClient.CreateSystemEventHookAsync( system: "data", _event: "version.added", hookPayload: hookPayload, region: Region.US, accessToken: twoLeggedToken ); var hookId = createResponse.Headers.GetValues("x-hook-id").FirstOrDefault(); // 2. List webhooks var hooks = await webhooksClient.GetSystemEventHooksAsync( system: "data", _event: "version.added", accessToken: twoLeggedToken ); // 3. Check delivery history var history = await webhooksClient.GetHookHistoryAsync( hookId: hookId, accessToken: twoLeggedToken ); // 4. Update webhook var updateResponse = await webhooksClient.UpdateSystemEventHookAsync( system: "data", _event: "version.added", hookId: hookId, hookPayload: new HookPayload { CallbackUrl = "https://myapp.com/webhooks/updated-callback" }, accessToken: twoLeggedToken ); // 5. Delete webhook var deleteResponse = await webhooksClient.DeleteSystemEventHookAsync( system: "data", _event: "version.added", hookId: hookId, accessToken: twoLeggedToken ); ``` -------------------------------- ### Enable HttpClient Logging Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Integrate logging for HTTP requests using HttpClientFactory. ```csharp var httpClient = new HttpClient(); // Add HttpClientFactory with logging // (Requires Microsoft.Extensions.Http.Logging) ``` -------------------------------- ### CreateBucketAsync Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/oss-client.md Creates a new bucket for object storage. ```APIDOC ## CreateBucketAsync ### Description Creates a new bucket for object storage. ### Method public async Task CreateBucketAsync(string bucketKey, string policyKey, string xUserId = default, string accessToken = default, bool throwOnError = true) ### Parameters - **bucketKey** (string) - Required - Unique bucket identifier (lowercase, alphanumeric, hyphens allowed). - **policyKey** (string) - Required - Data retention policy: transient (24 hours), temporary (30 days), or persistent. - **xUserId** (string) - Optional - In two-legged auth, limits the call to a specific user. - **accessToken** (string) - Optional - Access token (optional if authenticationProvider is set). - **throwOnError** (bool) - Optional - Whether to throw an exception on API errors. ### Returns Task - Bucket details including key, region, and creation date. ``` -------------------------------- ### SdkManagerBuilder.Create() Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Configures the SDK environment or custom base URL for API communication. ```APIDOC ## SdkManagerBuilder.Create() ### Description Initializes the SDKManager with specific environment settings or a custom base URL. ### Method Builder Pattern ### Parameters - **WithEnvironment** (AdskEnvironment) - Optional - Sets the target environment (Prd, Stg, Dev, Local). - **WithBaseUrl** (string) - Optional - Sets a custom base URL for API requests. ### Example ```csharp var sdkManager = SdkManagerBuilder.Create() .WithEnvironment(AdskEnvironment.Prd) .Build(); ``` ``` -------------------------------- ### Handle Bucket Conflict Exception Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/errors.md Demonstrates catching a 409 error when attempting to create a bucket that already exists. ```csharp try { var bucket = await ossClient.CreateBucketAsync( bucketKey: "my-bucket", // Already exists policyKey: "transient" ); } catch (OssApiException ex) { if (ex.ErrorCode == "409") { Console.WriteLine("Bucket already exists. Using existing bucket..."); var existing = await ossClient.GetBucketDetailsAsync("my-bucket"); } } ``` -------------------------------- ### Custom HTTP Client Configuration Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Configures the SDKManager with a custom HttpClient instance. ```csharp var httpClient = new HttpClient(new SocketsHttpHandler { PooledConnectionLifetime = TimeSpan.FromMinutes(2) }); var sdkManager = SdkManagerBuilder.Create() .WithHttpClient(httpClient) .WithEnvironment(AdskEnvironment.Prd) .Build(); ``` -------------------------------- ### Complete Service Account Workflow Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/secureserviceaccount-client.md Illustrates the full lifecycle of a service account, including creation, credential management, rotation, and final deletion. ```csharp // 1. Create service account var serviceAccount = await ssaClient.CreateServiceAccountAsync( teamId: "team-id", payload: new CreateServiceAccountPayload { Title = "Data Processing", Tags = new List { "production" } }, accessToken: twoLeggedToken ); // 2. Create credential var credential = await ssaClient.CreateCredentialAsync( teamId: "team-id", serviceAccountId: serviceAccount.Id, payload: new CreateCredentialPayload { Name = "Primary Key", Type = "RSA_2048", ExpiresAt = DateTime.UtcNow.AddYears(1) }, accessToken: twoLeggedToken ); Console.WriteLine($"Save this key securely: {credential.SecretKey}"); // 3. List credentials var credentials = await ssaClient.ListCredentialsAsync( teamId: "team-id", serviceAccountId: serviceAccount.Id, accessToken: twoLeggedToken ); // 4. Rotate credential (create new, delete old) var newCred = await ssaClient.CreateCredentialAsync( teamId: "team-id", serviceAccountId: serviceAccount.Id, payload: new CreateCredentialPayload { Name = "Rotated Key", Type = "RSA_2048" }, accessToken: twoLeggedToken ); // Update applications to use new credential... await ssaClient.DeleteCredentialAsync( teamId: "team-id", serviceAccountId: serviceAccount.Id, credentialId: credential.Id, accessToken: twoLeggedToken ); // 5. Decommission service account await ssaClient.DeleteServiceAccountAsync( teamId: "team-id", serviceAccountId: serviceAccount.Id, accessToken: twoLeggedToken ); ``` -------------------------------- ### Create a Service Account Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/secureserviceaccount-client.md Create a new service account by providing the team ID and a populated payload object. ```csharp var payload = new CreateServiceAccountPayload { Title = "Data Processing Service", Description = "Service account for automated data processing", Tags = new List { "production", "automation" } }; var serviceAccount = await ssaClient.CreateServiceAccountAsync( teamId: "team-id", payload: payload, accessToken: "two-legged-token" ); Console.WriteLine($"Service Account ID: {serviceAccount.Id}"); ``` -------------------------------- ### Handle Unsupported Format Exception Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/errors.md Demonstrates catching a 400 error when an unsupported output format is requested and retrieving valid formats. ```csharp try { var job = await modelClient.StartJobAsync( jobPayload: new JobPayload { Input = new Input { Urn = base64EncodedUrn }, Output = new Output { Formats = new List { new Format { Type = "xyz" } // Unsupported format } } } ); } catch (ModelDerivativeApiException ex) { if (ex.ErrorCode == "400" && ex.Message.Contains("format")) { Console.WriteLine("Unsupported format. Checking available formats..."); var formats = await modelClient.GetFormatsAsync(); // Show supported formats to user } } ``` -------------------------------- ### Authenticate with Three-Legged Flow (Public App with PKCE) Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/README.md Use for public applications that cannot securely store a client secret. Implements Proof Key for Code Exchange (PKCE) for enhanced security. ```csharp // 1. Generate PKCE pair string codeVerifier = GenerateRandomString(128); string codeChallenge = EncodeBase64Url(Sha256(codeVerifier)); // 2. Get authorization URL var authUrl = authClient.Authorize( clientId: "app-id", responseType: ResponseType.Code, redirectUri: "https://myapp.com/callback", scopes: new List { Scopes.DataRead }, codeChallenge: codeChallenge, codeChallengeMethod: "S256" ); // 3. Exchange authorization code for token var token = await authClient.GetThreeLeggedTokenAsync( clientId: "app-id", code: codeFromCallback, redirectUri: "https://myapp.com/callback", codeVerifier: codeVerifier // PKCE verifier ); ``` -------------------------------- ### Implement Custom Authentication Provider Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Provides a template for caching tokens and implementing custom acquisition logic. ```csharp public class CustomAuthenticationProvider : IAuthenticationProvider { private string _cachedToken; private DateTime _tokenExpiry; public async Task GetAccessToken() { if (_cachedToken != null && DateTime.UtcNow < _tokenExpiry) { return _cachedToken; } // Implement your token acquisition logic var token = await AcquireNewToken(); _cachedToken = token; _tokenExpiry = DateTime.UtcNow.AddHours(1); return token; } private async Task AcquireNewToken() { // Your implementation throw new NotImplementedException(); } } ``` -------------------------------- ### Configure Proxy Settings Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Route network traffic through a proxy server by providing a SocketsHttpHandler with a WebProxy instance. ```csharp var handler = new SocketsHttpHandler { Proxy = new WebProxy("http://proxy.company.com:8080") }; var sdkManager = SdkManagerBuilder.Create() .WithHttpClient(new HttpClient(handler)) .Build(); ``` -------------------------------- ### Enable Compression Support Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Configures the handler to automatically decompress GZip or Deflate responses. ```csharp var handler = new SocketsHttpHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }; var sdkManager = SdkManagerBuilder.Create() .WithHttpClient(new HttpClient(handler)) .Build(); ``` -------------------------------- ### Manage Secure Service Accounts Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/README.md Creates a service account and generates a new credential for it. ```csharp var ssaClient = new SecureServiceAccountClient(); var serviceAccount = await ssaClient.CreateServiceAccountAsync( teamId: "team-id", payload: new CreateServiceAccountPayload { Title = "Data Processing Service", Tags = new List { "production" } }, accessToken: token.AccessToken ); var credential = await ssaClient.CreateCredentialAsync( teamId: "team-id", serviceAccountId: serviceAccount.Id, payload: new CreateCredentialPayload { Name = "API Key", Type = "RSA_2048" }, accessToken: token.AccessToken ); ``` -------------------------------- ### Initialize ModelDerivativeClient Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Constructor for the ModelDerivativeClient service. ```csharp public ModelDerivativeClient( SDKManager.SDKManager sdkManager = default, IAuthenticationProvider authenticationProvider = default ) ``` -------------------------------- ### Configure SDKManager with Custom HTTP Client Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Initializes the SDKManager using a custom HttpClient and authentication provider for specific network requirements. ```csharp // 1. Create authentication provider var authProvider = new CustomAuthenticationProvider { ClientId = "your-client-id", ClientSecret = "your-client-secret" }; // 2. Configure HTTP client with custom settings var handler = new SocketsHttpHandler { PooledConnectionLifetime = TimeSpan.FromMinutes(2), AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }; var httpClient = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(30) }; // 3. Build SDKManager var sdkManager = SdkManagerBuilder.Create() .WithEnvironment(AdskEnvironment.Prd) .WithHttpClient(httpClient) .WithAuthenticationProvider(authProvider) .Build(); // 4. Initialize service clients var authClient = new AuthenticationClient(sdkManager, authProvider); var dataClient = new DataManagementClient(sdkManager, authProvider); var ossClient = new OssClient(sdkManager, authProvider); ``` -------------------------------- ### DataManagementClient Constructor Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/datamanagement-client.md Initializes a new instance of the DataManagementClient class, optionally accepting an SDKManager and an authentication provider. ```APIDOC ## DataManagementClient Constructor ### Description Initializes a new instance of the DataManagementClient class. ### Signature public DataManagementClient(SDKManager.SDKManager sdkManager = default, IAuthenticationProvider authenticationProvider = default) ### Parameters - **sdkManager** (SDKManager.SDKManager) - Optional - The SDK manager instance. If null, creates a default SDKManager. - **authenticationProvider** (IAuthenticationProvider) - Optional - Provider for automatic access token injection. ### Example var dataClient = new DataManagementClient(authenticationProvider: new CustomAuthProvider()); ``` -------------------------------- ### Create Webhooks Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/README.md Registers a system event webhook for data notifications. ```csharp var webhooksClient = new WebhooksClient(); var response = await webhooksClient.CreateSystemEventHookAsync( system: "data", _event: "version.added", hookPayload: new HookPayload { CallbackUrl = "https://myapp.com/webhooks/callback", Token = "secret-token" }, region: Region.US, accessToken: token.AccessToken ); ``` -------------------------------- ### AdskEnvironment Enumeration Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Defines the available environments for service endpoints. ```csharp public enum AdskEnvironment { Dev = 0, // Development environment Stg = 1, // Staging environment Prd = 2, // Production (default) Local = 3 // Local development server } ``` -------------------------------- ### Implement Batch Operation Pagination Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Retrieve large datasets efficiently by iterating through pages with a defined page size. ```csharp // Retrieve all items across pages efficiently var allItems = new List(); int pageNumber = 0; int pageSize = 200; // Maximum allowed while (true) { var page = await dataClient.ListFoldersAsync( projectId: "id", folderId: "id", pageNumber: pageNumber, pageLimit: pageSize ); allItems.AddRange(page.Data); if (page.Data.Count < pageSize) break; // Last page pageNumber++; } ``` -------------------------------- ### Configure SSL/TLS Settings Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Defines specific SSL protocols and certificate revocation checks for secure communication. ```csharp var handler = new SocketsHttpHandler { SslOptions = new System.Net.Security.SslClientAuthenticationOptions { TargetHost = "api.autodesk.com", EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslProtocols.Tls13, CertificateRevocationCheckMode = System.Security.Cryptography.X509Certificates.X509RevocationMode.Online } }; var sdkManager = SdkManagerBuilder.Create() .WithHttpClient(new HttpClient(handler)) .Build(); ``` -------------------------------- ### Handle Upload Failure Exceptions Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/errors.md Demonstrates handling 413 (insufficient space) and 401 (unauthorized) errors during object upload. ```csharp try { using (var fileStream = File.OpenRead("large-file.zip")) { var result = await ossClient.UploadObjectAsync( bucketKey: "my-bucket", objectKey: "uploads/file.zip", sourceToUpload: fileStream ); } } catch (OssApiException ex) { if (ex.ErrorCode == "413") { Console.WriteLine("Bucket is full. Please clean up old files."); } else if (ex.ErrorCode == "401") { Console.WriteLine("Token expired. Acquiring new token..."); // Refresh authentication } } ``` -------------------------------- ### Custom Authentication Configuration Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/sdkmanager.md Configures the SDKManager with a custom authentication provider. ```csharp var authProvider = new CustomAuthenticationProvider(); var sdkManager = SdkManagerBuilder.Create() .WithAuthenticationProvider(authProvider) .WithEnvironment(AdskEnvironment.Prd) .Build(); ``` -------------------------------- ### Handle Authentication Exceptions in C# Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/api-reference/authentication-client.md Demonstrates catching AuthenticationApiException when throwOnError is set to true by default. ```csharp try { var token = await authClient.GetTwoLeggedTokenAsync( clientId: "invalid-id", clientSecret: "invalid-secret", scopes: new List { Scopes.DataRead } ); } catch (AuthenticationApiException ex) { Console.WriteLine($"Error: {ex.Message}"); } ``` -------------------------------- ### Configure Pagination Source: https://github.com/autodesk-platform-services/aps-sdk-net/blob/main/_autodocs/configuration.md Define page index and limit for list operations to control the number of items returned. ```csharp var items = await dataClient.ListFoldersAsync( projectId: "id", folderId: "id", pageNumber: 0, // Page index (0-based) pageLimit: 100 // Items per page (1-200) ); ```