/// <summary> /// Creates an Object Anchors asset conversion job request. /// </summary> /// <param name="options">The asset conversion job creation options.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>The asset conversion operation.</returns> public virtual AssetConversionOperation StartAssetConversion(AssetConversionOptions options, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ObjectAnchorsConversionClient)}.{nameof(StartAssetConversion)}"); scope.Start(); try { if (!SupportedAssetFileTypes.Contains(options.InputAssetFileType)) { throw new AssetFileTypeNotSupportedException(options.InputAssetFileType, SupportedAssetFileTypes); } AssetConversionProperties properties = new AssetConversionProperties { InputAssetFileType = options.InputAssetFileType, ConversionConfiguration = options.ConversionConfiguration, InputAssetUri = options.InputAssetUri }; _ingestionJobRestClient.Create(AccountId, options.JobId, body: properties, cancellationToken: cancellationToken); return(new AssetConversionOperation(options.JobId, this)); } catch (Exception ex) { scope.Failed(ex); throw; } }
/// <summary> /// Creates an Object Anchors asset conversion job request. /// </summary> /// <param name="options">The asset conversion job creation options</param> /// <param name="cancellationToken">The cancellation toke</param> /// <returns>The asset conversion operation</returns> public virtual async Task <AssetConversionOperation> StartAssetConversionAsync(AssetConversionOptions options, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ObjectAnchorsConversionClient)}.{nameof(StartAssetConversion)}"); scope.Start(); try { AssetConversionProperties properties = new AssetConversionProperties { InputAssetFileType = options.InputAssetFileType, ConversionConfiguration = options.ConversionConfiguration, InputAssetUri = options.InputAssetUri }; await _ingestionJobRestClient.CreateAsync(AccountId, options.JobId, body : properties, cancellationToken : cancellationToken).ConfigureAwait(false); return(new AssetConversionOperation(options.JobId, this)); } catch (Exception ex) { scope.Failed(ex); throw; } }