Table of Contents

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

BaseDataManagementClient

OssApi

public BaseOSSClient OssApi { get; init; }

Property Value

BaseOSSClient

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 RequestInformation

The 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 string

Project Id. Prefix 'b.' handled automatically

fileItemUrn string

File 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 string

Id of the project. The prefix 'b.' is handled automatically

fileVersionUrn string

Id of the file version

Returns

Task<Stream>

File content

DownloadFileVersionAsync(string, string, int)

Download file version from ACC/BIM360

public Task<Stream> DownloadFileVersionAsync(string projectId, string itemUrn, int version)

Parameters

projectId string

Id of the project. The prefix 'b.' is handled automatically

itemUrn string

Id of the file item

version int

Version number starting at 1

Returns

Task<Stream>

File content

DownloadFromStorageAsync(string)

Download file from storage url

public Task<Stream> DownloadFromStorageAsync(string storageUrl)

Parameters

storageUrl string

Returns

Task<Stream>

File content

DownloadLatestFileVersionAsync(string, string)

Download the latest file version from ACC/BIM360

public Task<Stream> DownloadLatestFileVersionAsync(string projectId, string itemUrn)

Parameters

projectId string

Id of the project. The prefix 'b.' is handled automatically

itemUrn string

Id of the file item

Returns

Task<Stream>

File content

FixHubId(string)

Fix hub id by adding the prefix 'b.' if it is missing

public string FixHubId(string hubId)

Parameters

hubId string

Hub 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 string

Current 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 string

Project Id. Prefix 'b.' is handled

folderId string

Folder urn like: urn:adsk.wipprod:dm.folder:hC6k4hndRWaeIVhIjvHu8w

fileExtensions IEnumerable<string>

File extensions filter

Returns

Task<List<FileItem>>

List of file items

GetAllFilesByFolderPathAsync(string, bool)

Return the files in a folder

public Task<(FolderPath Folder, List<FileItem> Files)> GetAllFilesByFolderPathAsync(string folderPath, bool recursive = false)

Parameters

folderPath string
recursive bool

Returns

Task<(FolderPath Folder, List<FileItem> Files)>

List of file ids

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 string
folderId string
fileExtensionFilter 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

projectId string
folderId string
filters List<(string Name, string Value)>

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 string

The id of the hub

Returns

Task<List<IdNameMap>>

List of project Id

GetAllProjectsByHubNameAsync(string)

Get all projects in a hub

public Task<(string HubId, List<IdNameMap> Projects)> GetAllProjectsByHubNameAsync(string hubName)

Parameters

hubName string

Name of the hub

Returns

Task<(string hubId, List<IdNameMap> projects)>

List of projects

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

projectId string
parentFolderId string

Returns

Task<List<IdNameMap>>

List of the of sub folders path and id

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 string

Project Id. Prefix 'b.' is handled

folderId string

Folder 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 string
recursive bool

Optional: 'true' returns files within the sub folders. Default: 'false'

Returns

IAsyncEnumerable<(FolderPath Folder, FileItem File)>

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

InvalidOperationException

GetHubsByNameAsync(string)

Get the hubs given the name

public Task<List<Hubs_data>> GetHubsByNameAsync(string hubName)

Parameters

hubName string

Name of the hub. Insensitive case

Returns

Task<List<Hubs_data>>

Hub data

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 string
folderId string
fileExtensionFilter 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

projectId string
folderId string
filters List<(string Name, string Value)>

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

hubName string
projectName string

Returns

Task<(string hubId, List<IdNameMap> projects)>

Exceptions

InvalidOperationException
ArgumentException

Thrown if the hub na

GetProjectsByHubIdAsync(string)

Get all projects in a hub

public IAsyncEnumerable<IdNameMap> GetProjectsByHubIdAsync(string hubId)

Parameters

hubId string

The 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 string

Name 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

hubId string

hub id.

projectId string

project id

Returns

Task<string>

The RFI container ID

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

projectId string
parentFolderId string

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 string

Project Id. Prefix 'b.' is handled

folderId string

Folder 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

Task<Search>

First 100 search results. Use page[number] to get the next results

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 string
folderId string
skipDeleted 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

InvalidOperationException

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 string
folderId string
skipDeleted 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

InvalidOperationException

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 string

File destination

uniqueFileName string

Unique file name like {{GUID}}.ifc

fileContent Stream

Content of the file to upload

defaultChunkSize int

Optional: 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 string

Project Id. Prefix 'b.' handled automatically

folderId string

Folder id like:

fileName string

File name as displayed in ACC/BIM360

fileContent Stream
defaultChunkSize int

Optional: 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