private async Task <CreateTransferResult> UpdateFileTransferAsync(PictureparkAsset asset) { var transferIdentifier = $"Smint.io Update Import {Guid.NewGuid().ToString()}"; var localFile = await asset.GetDownloadedFileAsync(); var filePaths = new FileLocations[] { new FileLocations(localFile.FullName, asset.RecommendedFileName, asset.RecommendedFileName) }; var request = new CreateTransferRequest { Name = transferIdentifier, TransferType = TransferType.FileUpload, Files = new TransferUploadFile[] { new TransferUploadFile() { FileName = asset.RecommendedFileName } } }; var uploadOptions = new UploadOptions { ChunkSize = 1024 * 1024, ConcurrentUploads = 4, SuccessDelegate = Console.WriteLine, ErrorDelegate = ErrorDelegate, WaitForTransferCompletion = true }; return(await _client.Transfer.UploadFilesAsync(transferIdentifier, filePaths, uploadOptions)); }
private DataDictionary GetCompoundAssetsMetadata(PictureparkAsset asset, IList <PictureparkAsset> assetParts) { var dataDictionary = new DataDictionary() { { "name", asset.Name }, { "compoundAssetParts", assetParts.Select(assetPart => GetCompoundAssetPartMetadata(assetPart)).ToArray() } }; return(dataDictionary); }
private object GetCompoundAssetPartMetadata(PictureparkAsset assetPart) { var dataDictionary = new DataDictionary() { { "_relationType", "CompoundAssetPart" }, { "_sourceDocType", "Content" }, { "_targetDocType", "Content" }, { "_targetId", assetPart.TargetAssetUuid } }; if (assetPart.BinaryUsage?.Count > 0) { dataDictionary.Add("usage", assetPart.BinaryUsage); } return(dataDictionary); }