Class DataManagementClientHelper
- Namespace
- Autodesk.DataManagement.Helpers
- Assembly
- Autodesk.DataManagement.dll
public class DataManagementClientHelper
- Inheritance
-
DataManagementClientHelper
- Inherited Members
Properties
DataMgtApi
public BaseDataManagementClient DataMgtApi { get; init; }
Property Value
OssApi
public BaseOSSClient OssApi { get; init; }
Property Value
Methods
CreateRequestWithFilters(RequestInformation, List<(string Name, string Value)>)
Update the request URI with advanced search filters that includes comparison type or custom filter like 'filter[fileType]=rvt,jpg&filter[attributes.fileName]-contains=Floor'
public string CreateRequestWithFilters(RequestInformation requestInfo, List<(string Name, string Value)> filters)
Parameters
requestInfo
RequestInformationThe request info for the original endpoint. Use 'ToGetRequestInformation()' to retrieve it
filters
List<(string Name, string Value)>Filters to include as query parameters
Returns
- string
New URL combining the original one and filters
DeleteFileAsync(string, string)
Delete a file item (all versions) from Docs
public Task<(string fileItemId, string versionId)> DeleteFileAsync(string projectId, string fileItemUrn)
Parameters
projectId
stringProject Id. Prefix 'b.' handled automatically
fileItemUrn
stringFile Item Urn like '
Returns
- Task<(string fileItemId, string versionId)>
The deleted file
Remarks
File is not really deleted but marked as "deleted" and can be restored
DownloadFileVersionAsync(string, string)
Download file version from ACC/BIM360
public Task<Stream> DownloadFileVersionAsync(string projectId, string fileVersionUrn)
Parameters
projectId
stringId of the project. The prefix 'b.' is handled automatically
fileVersionUrn
stringId of the file version
Returns
DownloadFileVersionAsync(string, string, int)
Download file version from ACC/BIM360
public Task<Stream> DownloadFileVersionAsync(string projectId, string itemUrn, int version)
Parameters
projectId
stringId of the project. The prefix 'b.' is handled automatically
itemUrn
stringId of the file item
version
intVersion number starting at 1
Returns
DownloadFromStorageAsync(string)
Download file from storage url
public Task<Stream> DownloadFromStorageAsync(string storageUrl)
Parameters
storageUrl
string
Returns
DownloadLatestFileVersionAsync(string, string)
Download the latest file version from ACC/BIM360
public Task<Stream> DownloadLatestFileVersionAsync(string projectId, string itemUrn)
Parameters
projectId
stringId of the project. The prefix 'b.' is handled automatically
itemUrn
stringId of the file item
Returns
FixHubId(string)
Fix hub id by adding the prefix 'b.' if it is missing
public string FixHubId(string hubId)
Parameters
hubId
stringHub id to fix
Returns
- string
Hub id with 'b.' prefix
FixProjectId(string)
Fix project id by adding the prefix 'b.' if it is missing
public string FixProjectId(string projectId)
Parameters
projectId
stringCurrent project id
Returns
- string
Project id with 'b.' prefix
GetAllFileItemIdsByFolderIdAsync(string, string, IEnumerable<string>?)
Get file items from a folder (not recursive)
public Task<List<FileItem>> GetAllFileItemIdsByFolderIdAsync(string projectId, string folderId, IEnumerable<string>? fileExtensions = null)
Parameters
projectId
stringProject Id. Prefix 'b.' is handled
folderId
stringFolder urn like:
urn:adsk.wipprod:dm.folder:hC6k4hndRWaeIVhIjvHu8w
fileExtensions
IEnumerable<string>File extensions filter
Returns
GetAllFilesByFolderPathAsync(string, bool)
Return the files in a folder
public Task<(FolderPath Folder, List<FileItem> Files)> GetAllFilesByFolderPathAsync(string folderPath, bool recursive = false)
Parameters
Returns
GetAllLatestFilesVersionAsync(string, string, IEnumerable<string>)
Get files in a folder (not recursive) and return the latest version of each file
public Task<List<FileVersion>> GetAllLatestFilesVersionAsync(string projectId, string folderId, IEnumerable<string> fileExtensionFilter)
Parameters
projectId
stringfolderId
stringfileExtensionFilter
IEnumerable<string>
Returns
- Task<List<FileVersion>>
List of file version
Remarks
Use search for recursive search
Exceptions
- InvalidOperationException
Unexpected output
GetAllLatestFilesVersionAsync(string, string, List<(string Name, string Value)>?)
Get the latest version of each file within a folder
public Task<List<FileVersion>> GetAllLatestFilesVersionAsync(string projectId, string folderId, List<(string Name, string Value)>? filters = null)
Parameters
Returns
- Task<List<FileVersion>>
List of file version
Remarks
Use search for recursive search
Exceptions
- InvalidOperationException
Unexpected output
GetAllProjectsByHubIdAsync(string)
Get all projects in a hub
public Task<List<IdNameMap>> GetAllProjectsByHubIdAsync(string hubId)
Parameters
hubId
stringThe id of the hub
Returns
GetAllProjectsByHubNameAsync(string)
Get all projects in a hub
public Task<(string HubId, List<IdNameMap> Projects)> GetAllProjectsByHubNameAsync(string hubName)
Parameters
hubName
stringName of the hub
Returns
Exceptions
- InvalidOperationException
hubName
is not unique or not found
GetAllSubFoldersAsync(string, string)
Return the ids of all sub folders
public Task<List<IdNameMap>> GetAllSubFoldersAsync(string projectId, string parentFolderId)
Parameters
Returns
Remarks
Not recursive
GetAllSubFoldersByPathAsync(string)
Get the ids of all sub folders in a folder
public Task<(FolderPath Folder, List<IdNameMap> SubFolders)> GetAllSubFoldersByPathAsync(string folderPath)
Parameters
folderPath
string
Returns
- Task<(FolderPath Folder, List<IdNameMap> SubFolders)>
List of folder ids
GetFileItemByFolderIdAsync(string, string, IEnumerable<string>?)
Get file items from a folder (not recursive)
public IAsyncEnumerable<FileItem> GetFileItemByFolderIdAsync(string projectId, string folderId, IEnumerable<string>? fileExtensions = null)
Parameters
projectId
stringProject Id. Prefix 'b.' is handled
folderId
stringFolder urn like:
urn:adsk.wipprod:dm.folder:hC6k4hndRWaeIVhIjvHu8w
fileExtensions
IEnumerable<string>File extensions filter
Returns
- IAsyncEnumerable<FileItem>
List of file items
GetFileItemByPathAsync(string)
Get the file item by its path
public Task<(FolderPath PathData, FileItem FileData)> GetFileItemByPathAsync(string filePath)
Parameters
filePath
string
Returns
- Task<(FolderPath PathData, FileItem FileData)>
File item and path data
Exceptions
- FileNotFoundException
Thrown when file is not found. File name included in the exception
GetFilesByFolderPathAsync(string, bool)
Return the files in a folder (optional recursively)
public IAsyncEnumerable<(FolderPath Folder, FileItem File)> GetFilesByFolderPathAsync(string folderPath, bool recursive = false)
Parameters
folderPath
stringrecursive
boolOptional: 'true' returns files within the sub folders. Default: 'false'
Returns
GetFolderByPathAsync(string)
Return the ids of all elements in the path
public Task<FolderPath> GetFolderByPathAsync(string folderPath)
Parameters
folderPath
string
Returns
- Task<FolderPath>
The ids of all elements in the path
Exceptions
GetHubsByNameAsync(string)
Get the hubs given the name
public Task<List<Hubs_data>> GetHubsByNameAsync(string hubName)
Parameters
hubName
stringName of the hub. Insensitive case
Returns
GetLatestFilesVersionAsync(string, string, IEnumerable<string>)
Get files in a folder (not recursive) and return the latest version of each file
public IAsyncEnumerable<FileVersion> GetLatestFilesVersionAsync(string projectId, string folderId, IEnumerable<string> fileExtensionFilter)
Parameters
projectId
stringfolderId
stringfileExtensionFilter
IEnumerable<string>
Returns
- IAsyncEnumerable<FileVersion>
Stream of file version
Remarks
Use search for recursive search
Exceptions
- InvalidOperationException
Unexpected output
GetLatestFilesVersionAsync(string, string, List<(string Name, string Value)>?)
Get the latest version of each file within a folder
public IAsyncEnumerable<FileVersion> GetLatestFilesVersionAsync(string projectId, string folderId, List<(string Name, string Value)>? filters = null)
Parameters
Returns
- IAsyncEnumerable<FileVersion>
Stream of file version
Remarks
Use search for recursive search
Exceptions
- InvalidOperationException
Unexpected output
GetProjectIdsByNameAsync(string, string)
Return the ids of all projects with the same name in a hub
public Task<(string hubId, List<IdNameMap> projects)> GetProjectIdsByNameAsync(string hubName, string projectName)
Parameters
Returns
Exceptions
- InvalidOperationException
- ArgumentException
Thrown if the hub na
GetProjectsByHubIdAsync(string)
Get all projects in a hub
public IAsyncEnumerable<IdNameMap> GetProjectsByHubIdAsync(string hubId)
Parameters
hubId
stringThe id of the hub
Returns
- IAsyncEnumerable<IdNameMap>
Stream of project Id
GetProjectsByHubNameAsync(string)
Get all projects in a hub
public IAsyncEnumerable<(string HubId, IdNameMap Project)> GetProjectsByHubNameAsync(string hubName)
Parameters
hubName
stringName of the hub
Returns
- IAsyncEnumerable<(string HubId, IdNameMap Project)>
Stream of projects
Exceptions
- InvalidOperationException
hubName
is not unique or not found
GetRFIsContainerIdAsync(string, string)
Get the container id of the RFIs
public Task<string> GetRFIsContainerIdAsync(string hubId, string projectId)
Parameters
Returns
Remarks
The 'b.' for the hubId
and projectId
is managed automatically
Exceptions
- InvalidOperationException
If RFIs container not found
GetSubFoldersAsync(string, string)
Return the ids of all sub folders
public IAsyncEnumerable<IdNameMap> GetSubFoldersAsync(string projectId, string parentFolderId)
Parameters
Returns
- IAsyncEnumerable<IdNameMap>
Stream of the of sub folders path and id
Remarks
Not recursive
GetSubFoldersByPathAsync(string)
Get the ids of sub folders in a folder
public IAsyncEnumerable<(FolderPath Folder, IdNameMap SubFolder)> GetSubFoldersByPathAsync(string folderPath)
Parameters
folderPath
string
Returns
- IAsyncEnumerable<(FolderPath Folder, IdNameMap SubFolder)>
Stream of sub folders name and their id
Remarks
Not recursive
SearchAdvancedAsync(string, string, List<(string Name, string Value)>)
Use Search endpoint to search for files in a folder recursively based on advanced search filters
public Task<Search?> SearchAdvancedAsync(string projectId, string folderId, List<(string Name, string Value)> filters)
Parameters
projectId
stringProject Id. Prefix 'b.' is handled
folderId
stringFolder urn like:
urn:adsk.wipprod:dm.folder:hC6k4hndRWaeIVhIjvHu8w
filters
List<(string Name, string Value)>List of filters used as query parameters like: ("filter[fileTYpe]","rvt,mwd") https://aps.autodesk.com/en/docs/data/v2/developers_guide/filtering/
Returns
Remarks
Required 3 legged authentication
SearchAllLatestFileVersionAsync(string, string, bool, List<(string Name, string Value)>?)
Search for files in a folder recursively and return the latest version of each file
public Task<List<FileVersion>> SearchAllLatestFileVersionAsync(string projectId, string folderId, bool skipDeleted = true, List<(string Name, string Value)>? filters = null)
Parameters
projectId
stringfolderId
stringskipDeleted
bool(Optional) Ignore deleted files
filters
List<(string Name, string Value)>(Optional) Query string like: 'filter[fileType]=txt,jpg'.See documentation https://aps.autodesk.com/en/docs/data/v2/developers_guide/filtering/.
Returns
- Task<List<FileVersion>>
List of file version
Exceptions
SearchLatestFileVersionAsync(string, string, bool, List<(string Name, string Value)>?)
Search for files in a folder recursively and return the latest version of each file
public IAsyncEnumerable<FileVersion> SearchLatestFileVersionAsync(string projectId, string folderId, bool skipDeleted = true, List<(string Name, string Value)>? filters = null)
Parameters
projectId
stringfolderId
stringskipDeleted
bool(Optional) Ignore deleted files
filters
List<(string Name, string Value)>(Optional) Query string like: 'filter[fileType]=txt,jpg'.See documentation https://aps.autodesk.com/en/docs/data/v2/developers_guide/filtering/.
Returns
- IAsyncEnumerable<FileVersion>
Stream of file version
Exceptions
UploadFileAsync(string, string, Stream, int)
Upload file by chunks to a bucket
public Task<Completes3upload_response_200> UploadFileAsync(string bucketId, string uniqueFileName, Stream fileContent, int defaultChunkSize = 10000000)
Parameters
bucketId
stringFile destination
uniqueFileName
stringUnique file name like {{GUID}}.ifc
fileContent
StreamContent of the file to upload
defaultChunkSize
intOptional: Chunk size in bytes value 10 000 000
Returns
- Task<Completes3upload_response_200>
Upload results
Exceptions
- InvalidDataException
No signed url was created
UploadFileAsync(string, string, string, Stream, int)
Create a new file version in a ACC/BIM360 folder. If the file exists, create a new version.
public Task<(string fileItemId, string versionId)> UploadFileAsync(string projectId, string folderId, string fileName, Stream fileContent, int defaultChunkSize = 10000000)
Parameters
projectId
stringProject Id. Prefix 'b.' handled automatically
folderId
stringFolder id like:
fileName
stringFile name as displayed in ACC/BIM360
fileContent
StreamdefaultChunkSize
intOptional: Chunk size in bytes value 10 000 000
Returns
- Task<(string fileItemId, string versionId)>
File item id and version Id of the file version created in ACC/BIM360
Exceptions
- InvalidDataException
Upload failed
- InvalidOperationException
Version creation failed