Skip to content

TrimbleCloud.DataOcean3

TrimbleCloud.DataOcean3

Contents

AclApplicationIdentity type

Namespace

TrimbleCloud.DataOcean3.Model

#ctor(applicationId) constructor

Summary

Creates an application identity.

Parameters
NameTypeDescription
applicationIdSystem.GuidThe application id.

AclDeviceIdentity type

Namespace

TrimbleCloud.DataOcean3.Model

#ctor(deviceId,applicationId) constructor

Summary

Creates a device identity.

Parameters
NameTypeDescription
deviceIdSystem.GuidThe device id; otherwise, AclIdentity.ALL to represent any device.
applicationIdSystem.GuidThe application id; otherwise AclIdentity.ALL to represent any application.

AclIdentity type

Namespace

TrimbleCloud.DataOcean3.Model

ALL constants

Summary

Use ALL to represent cases where any client is allowed. For example, new AclUserIdentity(userID, AclIdentity.ALL) will allow a particular user from any application.

AclPermission type

Namespace

TrimbleCloud.DataOcean3.Model

ReadOnly constants

Summary

Read-only permission

ReadWrite constants

Summary

Read and write permission. For files, write permission allows users to create new versions of the file.

ReadWriteDelete constants

Summary

Read, write, and delete permission.

AclUserIdentity type

Namespace

TrimbleCloud.DataOcean3.Model

#ctor(userId,applicationId) constructor

Summary

Creates a user identity.

Parameters
NameTypeDescription
userIdSystem.GuidThe user id; otherwise, AclIdentity.ALL to represent any user.
applicationIdSystem.GuidThe application id; otherwise AclIdentity.ALL to represent any application.

DataOceanClient type

Namespace

TrimbleCloud.DataOcean3

Summary

A client for the Trimble Cloud Platform Data Ocean

Example
const TOKEN = "...";
const BASE_URL = "https://cloud.stage.api.trimblecloud.com/dataocean/api/3.0";
var tokenProvider = new FixedTokenProvider(TOKEN);
var httpClientProvider = new BearerTokenHttpClientProvider(tokenProvider, new Uri(BASE_URL, UriKind.Absolute));
var dataOceanClient = new DataOceanClient(httpClientProvider);
var directories = await dataOceanClient.Directories.GetDirectoriesList().GetItems();
var files = await dataOceanClient.Directories.GetFilesList().GetItems();
var file = await dataOceanClient.Files.Create(new File() { ... });
using (var stream = File.OpenRead("helloworld.txt"))
{
await dataOceanClient.Files.Upload(file.id, stream);
}

#ctor(clientProvider,productName) constructor

Summary

Public constructor for a Data Ocean client

Parameters
NameTypeDescription
clientProviderTrimble.ID.IHttpClientProviderA provider of a pre-configured HttpClient used for API calls made by this client
productNameSystem.StringThe product name of the consuming application

Configuration constants

Directories property

Summary

Directories API

Files property

Summary

Files API

Jobs property

Summary

Jobs API

Dispose() method

Summary

Inherit from parent.

Parameters

This method has no parameters.

DataOceanExtensions type

Namespace

TrimbleCloud.DataOcean3

Summary

A client for the Trimble Cloud Platform Data Ocean

Example
// Setup
const TOKEN = "...";
const BASE_URL = "https://cloud.stage.api.trimblecloud.com/dataocean/api/3.0";
var tokenProvider = new FixedTokenProvider(TOKEN);
services.AddDataOcean(tokenProvider, BASE_URL);
// Usage
public class UseDataOcean(IDirectoriesAPI directoriesAPI, IFilesAPI filesAPI)
{
private IDirectoriesAPI _directoriesAPI;
public UseDataOcean(IDirectoriesAPI directoriesAPI, IFilesAPI filesAPI)
{
_directoriesAPI = directoriesAPI;
_filesAPI = filesAPI;
}
public async Task DoWork()
{
var directories = await _directoriesAPI.GetDirectoriesList().GetItems();
var files = await _directoriesAPI.GetFilesList().GetItems();
var file = await _filesAPI.Create(new File() { ... });
using (var stream = File.OpenRead("helloworld.txt"))
{
await _filesAPI.Upload(file.id, stream);
}
}
}

AddDataOcean(services,tokenProvider,baseAddress,configuration,logger,productName) method

Summary

Adds Data Ocean services.

Parameters
NameTypeDescription
servicesMicrosoft.Extensions.DependencyInjection.IServiceCollectionThe service collection to add Data Ocean to.
tokenProviderTrimble.ID.ITokenProviderThe token provider.
baseAddressSystem.UriThe base address for the service.
configurationTrimbleCloud.DataOcean3.Utilities.IDataOceanConfigurationThe optional Data Ocean configuration.
loggerTrimbleCloud.Common.Logging.ILoggerThe optional Data Ocean logger.
productNameSystem.StringThe product name of the consuming application

ReformatApiCloudv1Address(baseAddress) method

Summary

Reformats the base address if we detect it is from API Cloud v1.0

Returns

The unmodified or modified uri.

Parameters
NameTypeDescription
baseAddressSystem.UriThe base address.

Directory type

Namespace

TrimbleCloud.DataOcean3.Model

Summary

Represents a directory in the data ocean.

Acl property

Summary

Gets or sets the access control list (ACL) for the directory.

ApplicationId property

Summary

Gets or sets the application identifier associated with the directory.

ContentSize property

Summary

Gets or sets the size of the content in the directory.

ContentUpdatedAt property

Summary

Gets or sets the date and time when the content of the directory was last updated.

CreatedAt property

Summary

Gets or sets the date and time when the directory was created.

Id property

Summary

Gets or sets the unique identifier of the directory.

Metadata property

Summary

Gets or sets the metadata associated with the directory.

OwnerId property

Summary

Gets or sets the owner identifier of the directory.

Path property

Summary

Gets or sets the path of the directory.

UpdatedAt property

Summary

Gets or sets the date and time when the directory was last updated.

DirectoryCreate type

Namespace

TrimbleCloud.DataOcean3.Model

Summary

Represents a directory creation request.

Acl property

Summary

Gets or sets the access control list (ACL) for the directory.

Metadata property

Summary

Gets or sets the metadata associated with the directory.

Path property

Summary

Gets or sets the path of the directory.

DirectoryPage type

Namespace

TrimbleCloud.DataOcean3.Model

Summary

Represents a page of directories.

Directories property

Summary

Gets or sets the list of directories.

NextPageToken property

Summary

Gets or sets the token for the next page.

DirectoryResponse type

Namespace

TrimbleCloud.DataOcean3.Model

Summary

Represents a response containing directory information.

Directory property

Summary

Gets or sets the directory information.

JobId property

Summary

Gets or sets the job ID associated with the directory response.

DirectoryUpdate type

Namespace

TrimbleCloud.DataOcean3.Model

Summary

Represents a directory update in the data ocean.

Acl property

Summary

Gets or sets the access control list (ACL) for the directory.

Metadata property

Summary

Gets or sets the metadata for the directory update. The type of the metadata is dynamic, allowing for flexibility in the data structure.

Path property

Summary

Gets or sets the path of the directory update.

File type

Namespace

TrimbleCloud.DataOcean3.Model

Summary

Represents a file.

Acl property

Summary

Gets or sets the access control list (ACL) of the file.

ApplicationId property

Summary

Gets or sets the application identifier associated with the file.

CreatedAt property

Summary

Gets or sets the date and time when the file was created.

Download property

Summary

Gets or sets the download information of the file.

ExpiresAt property

Summary

Gets or sets the expiration date and time of the file.

Fileset property

Summary

Gets or sets a value indicating whether the file is part of a fileset.

FirstVersionCreatedAt property

Summary

Gets or sets the date and time when the first version of the file was created.

Id property

Summary

Gets or sets the unique identifier of the file.

LastScannedAt property

Summary

Gets or sets the date and time when the file was last scanned for malware.

MalwareStatus property

Summary

Gets or sets the malware status of the file.

MasterId property

Summary

Gets or sets the master identifier of the file.

Md5 property

Summary

Gets or sets the MD5 hash of the file.

Metadata property

Summary

Gets or sets the metadata of the file.

Multipart property

Summary

Gets or sets a value indicating whether the file is multipart.

OwnerId property

Summary

Gets or sets the owner identifier of the file.

Path property

Summary

Gets or sets the path of the file.

PathTemplate property

Summary

Gets or sets the path template of the file.

RegionPreferences property

Summary

Gets or sets the region preferences for the file.

Regions property

Summary

Gets or sets the regions associated with the file.

RestrictedAccess property

Summary

Gets or sets a value indicating whether the file has restricted access.

Size property

Summary

Gets or sets the size of the file in bytes.

Status property

Summary

Gets or sets the status of the file.

UpdatedAt property

Summary

Gets or sets the date and time when the file was last updated.

Upload property

Summary

Gets or sets the upload information of the file.

Version property

Summary

Gets or sets the version of the file.

FileCopy type

Namespace

TrimbleCloud.DataOcean3.Model

Summary

Represents a file copy operation.

ExpiresAt property

Summary

Gets or sets the expiration date and time of the file.

Metadata property

Summary

Gets or sets the metadata associated with the file.

Path property

Summary

Gets or sets the path of the file.

Regions property

Summary

Gets or sets the regions where the file is available.

RestrictedAccess property

Summary

Gets or sets a value indicating whether the file has restricted access.

FileCreate type

Namespace

TrimbleCloud.DataOcean3.Model

Summary

Represents the information required to create a file.

Acl property

Summary

Gets or sets the access control list (ACL) of the file.

ExpiresAt property

Summary

Gets or sets the expiration date and time of the file.

Fileset property

Summary

Gets or sets a value indicating whether the file is part of a fileset.

MasterId property

Summary

Gets or sets the master ID of the file.

Metadata property

Summary

Gets or sets the metadata associated with the file.

Multipart property

Summary

Gets or sets a value indicating whether the file is multipart.

Path property

Summary

Gets or sets the path of the file.

PathTemplate property

Summary

Gets or sets the path template of the file.

Regions property

Summary

Gets or sets the regions associated with the file.

RestrictedAccess property

Summary

Gets or sets a value indicating whether the file has restricted access.

FileMalwareStatus type

Namespace

TrimbleCloud.DataOcean3.Model

CannotScan constants

Summary

File cannot be scanned automatically due to its size

Clean constants

Summary

File has been scanned and no issues were detected

Deleting constants

Summary

File has been scanned and has been found to contain malware

ScanFailed constants

Summary

File scan was attempted but could not be completed

Unscanned constants

Summary

File has not been scanned yet

FileNotReadyException type

Namespace

TrimbleCloud.DataOcean3.Exceptions

FileState property

Summary

Current state of file.

FileStatus type

Namespace

TrimbleCloud.DataOcean3.Model

ArchiveProcessing constants

Summary

Archive has been uploaded and is now being processed

ArchiveProcessingFailed constants

Summary

Archive processing failed, e.g. if it’s a bad zip file

Available constants

Summary

File is available

Deleting constants

Summary

File content is in the process of being deleted

Finalizing constants

Summary

File is completing a multi-part assemble request or is in the process of being copied

UploadFailed constants

Summary

File is not accessible due to a failure during upload

Uploadable constants

Summary

File is awaiting an upload

IDataOceanClient type

Namespace

TrimbleCloud.DataOcean3

Summary

Interface for the Trimble Cloud Platform Data Ocean

Directories property

Summary

Directories API

Returns

Files property

Summary

Files API

Returns

Jobs property

Summary

Jobs API

Returns

IDataOceanConfiguration type

Namespace

TrimbleCloud.DataOcean3.Utilities

ChunkSize property

Summary

Download and upload chunk size.

HttpTimeout property

Summary

Timeout used for Http calls.

MaxConcurrentRequests property

Summary

The maximum number of concurrent requests allowed.

PageLimit property

Summary

Page size to retrieve.

Retries property

Summary

Number of retries for HTTP calls with a retry-able response.

RetryInterval property

Summary

Time to wait between retries.

IDirectoriesAPI type

Namespace

TrimbleCloud.DataOcean3

Copy(id,directory) method

Summary

Copies a directory

Returns

A Task that resolves to a JobResponseBrief on completion

Parameters
NameTypeDescription
idSystem.GuidThe directory ID
directoryTrimbleCloud.DataOcean3.Model.DirectoryCreateThe directory information to copy

Copy(path,directory) method

Summary

Copies a file

Returns

A Task that resolves to a JobResponseBrief on completion

Parameters
NameTypeDescription
pathSystem.StringThe directory path
directoryTrimbleCloud.DataOcean3.Model.DirectoryCreateThe directory information to copy

Create(directory) method

Summary

Create a directory

Returns

A Task that resolves to the created Directory on completion

Parameters
NameTypeDescription
directoryTrimbleCloud.DataOcean3.Model.DirectoryCreateThe information of the directory to create

Delete(id,recursive) method

Summary

Delete a directory given the directory ID

Returns

A Task that resolves to completion

Parameters
NameTypeDescription
idSystem.GuidThe directory ID
recursiveSystem.BooleanDelete descendant files and directories
Remarks

This method has been deprecated. Use Delete(Guid id) or DeleteRecursively(Guid id) instead.

Delete(path,recursive) method

Summary

Delete a directory given the directory path

Returns

A Task that resolves to completion

Parameters
NameTypeDescription
pathSystem.StringThe directory path
recursiveSystem.BooleanDelete descendant files and directories
Remarks

This method has been deprecated. Use Delete(string path) or DeleteRecursively(string path) instead.

Delete(id) method

Summary

Delete an empty directory given the directory ID

Returns

A Task that resolves to completion

Parameters
NameTypeDescription
idSystem.GuidThe directory ID
Remarks

Use DeleteRecursively(Guid id) to delete a non-empty directory

Delete(path) method

Summary

Delete an empty directory given the directory path

Returns

A Task that resolves to completion

Parameters
NameTypeDescription
pathSystem.StringThe directory path
Remarks

Use DeleteRecursively(string path) to delete a non-empty directory

DeleteRecursively(id) method

Summary

Delete a directory given the directory ID

Returns

A Task that resolves to a JobResponseBrief on completion

Parameters
NameTypeDescription
idSystem.GuidThe directory ID

DeleteRecursively(path) method

Summary

Delete a directory given the directory path

Returns

A Task that resolves to a JobResponseBrief on completion

Parameters
NameTypeDescription
pathSystem.StringThe directory path

GetDirectoriesList(parentId) method

Summary

Get a list of directories in the given parent directory

Returns

An asynchronous list of directories

Parameters
NameTypeDescription
parentIdSystem.GuidThe ID of the parent directory

GetDirectoriesList(path) method

Summary

Get a list of directories in the given parent directory

Returns

An asynchronous list of directories

Parameters
NameTypeDescription
pathSystem.StringThe optional path of the parent directory, root directory is used if this parameter is omitted or null

GetFilesList(parentId,urlDuration) method

Summary

Get a list of directories in the given parent directory

Returns

An asynchronous list of directories

Parameters
NameTypeDescription
parentIdSystem.GuidThe ID of the parent directory
urlDurationSystem.Nullable{System.TimeSpan}The duration of time for which the file download/upload URL for the file will be valid if provided between 5 minutes and 30 days. Default is 1 hour.

GetFilesList(path,urlDuration) method

Summary

Get a list of directories in the given parent directory

Returns

An asynchronous list of directories

Parameters
NameTypeDescription
pathSystem.StringThe optional path of the parent directory, root directory is used if this parameter is omitted or null
urlDurationSystem.Nullable{System.TimeSpan}The duration of time for which the file download/upload URL for the file will be valid if provided between 5 minutes and 30 days. Default is 1 hour.

Read(id) method

Summary

Get a directory given the directory ID

Returns

A Task that resolves to the Directory on completion

Parameters
NameTypeDescription
idSystem.GuidThe directory ID

Read(path) method

Summary

Get a directory given the directory path

Returns

A Task that resolves to the Directory on completion

Parameters
NameTypeDescription
pathSystem.StringThe optional path of the directory, root directory is used if this parameter is omitted or null

Update(id,directory) method

Summary

Update a directory given the directory ID

Returns

A Task that resolves to a ValueTuple of Directory Directory and possible JobId Guid on completion

Parameters
NameTypeDescription
idSystem.GuidThe directory ID
directoryTrimbleCloud.DataOcean3.Model.DirectoryUpdateDirectoryUpdate

Update(path,directory) method

Summary

Update a directory given the directory path

Returns

A Task that resolves to the a Tuple of Directory and possible JobId Guid on completion

Parameters
NameTypeDescription
pathSystem.String
directoryTrimbleCloud.DataOcean3.Model.DirectoryUpdateDirectoryUpdate

IFilesAPI type

Namespace

TrimbleCloud.DataOcean3

Copy(id,file) method

Summary

Copies a file

Returns

A Task that resolves to the copied File on completion

Parameters
NameTypeDescription
idSystem.GuidThe file ID
fileTrimbleCloud.DataOcean3.Model.FileCopyThe file information to copy

Copy(path,file) method

Summary

Copies a file

Returns

A Task that resolves to the copied File on completion

Parameters
NameTypeDescription
pathSystem.StringThe file path
fileTrimbleCloud.DataOcean3.Model.FileCopyThe file information to copy

Create(file,urlDuration) method

Summary

Create a file or a new version of a file if it already exists

Returns

A Task that resolves to the created File on completion

Parameters
NameTypeDescription
fileTrimbleCloud.DataOcean3.Model.FileCreateThe information of the file to create
urlDurationSystem.Nullable{System.TimeSpan}The duration of time for which the file download/upload URL for the file will be valid if provided between 5 minutes and 30 days. Default is 1 hour.

Delete(id) method

Summary

Delete a file given the file ID

Returns

A Task that resolves to completion

Parameters
NameTypeDescription
idSystem.GuidThe file ID

Delete(path) method

Summary

Delete a file given the file path

Returns

A Task that resolves to completion

Parameters
NameTypeDescription
pathSystem.StringThe file path

Download(stream,id,version,region,concurrentRequests) method

Summary

Downloads a file given the file ID

Returns

A Task that resolves to completion

Parameters
NameTypeDescription
streamSystem.IO.StreamThe stream to write content to
idSystem.GuidThe file ID
versionSystem.Nullable{System.Int32}The file version if provided; otherwise the current version is used if null
regionSystem.StringThe specific region if provided; otherwise the default region will be used
concurrentRequestsSystem.Int32The number of concurrent download tasks if provided; otherwise 8 tasks are used
Exceptions
NameDescription
TrimbleCloud.DataOcean3.Exceptions.FileNotReadyExceptionThrown if the file is not in the Available state

Download(stream,path,version,region,concurrentRequests) method

Summary

Downloads a file given the file path

Returns

A Task that resolves to completion

Parameters
NameTypeDescription
streamSystem.IO.StreamThe stream to write content to
pathSystem.StringThe file path
versionSystem.Nullable{System.Int32}The file version if provided; otherwise the current version is used if null
regionSystem.StringThe specific region if provided; otherwise the default region will be used
concurrentRequestsSystem.Int32The number of concurrent download tasks if provided; otherwise 8 tasks are used
Exceptions
NameDescription
TrimbleCloud.DataOcean3.Exceptions.FileNotReadyExceptionThrown if the file is not in the Available state

GetFilesetManifest(id,version) method

Summary

Get a fileset manifest given the file ID

Returns

An asynchronous list of files in the fileset

Parameters
NameTypeDescription
idSystem.GuidThe file ID
versionSystem.Nullable{System.Int32}The file version if provided; otherwise the current version is used if null

GetFilesetManifest(path,version) method

Summary

Get a fileset manifest given the file path

Returns

An asynchronous list of files in the fileset

Parameters
NameTypeDescription
pathSystem.StringThe file path
versionSystem.Nullable{System.Int32}The file version if provided; otherwise the current version is used if null

GetVersionsList(id,urlDuration) method

Summary

Get a list of versions for a file given the file ID

Returns

An asynchronous list of files versions

Parameters
NameTypeDescription
idSystem.GuidThe file ID
urlDurationSystem.Nullable{System.TimeSpan}The duration of time for which the file download/upload URL for the file will be valid if provided between 5 minutes and 30 days. Default is 1 hour.

GetVersionsList(path,urlDuration) method

Summary

Get a list of versions for a file given the file path

Returns

An asynchronous list of files versions

Parameters
NameTypeDescription
pathSystem.StringThe file path
urlDurationSystem.Nullable{System.TimeSpan}The duration of time for which the file download/upload URL for the file will be valid if provided between 5 minutes and 30 days. Default is 1 hour.

Read(id,version,region,urlDuration) method

Summary

Get a file given the file ID

Returns

A Task that resolves to the file on completion or null if the file does not exist

Parameters
NameTypeDescription
idSystem.GuidThe file ID
versionSystem.Nullable{System.Int32}The file version if provided; otherwise the current version is used if null
regionSystem.StringThe specific region if provided; otherwise the default region will be used
urlDurationSystem.Nullable{System.TimeSpan}The duration of time for which the file download/upload URL for the file will be valid if provided between 5 minutes and 30 days. Default is 1 hour.

Read(path,version,region,urlDuration) method

Summary

Get a file given the file path

Returns

A Task that resolves to the file on completion or null if the file does not exist

Parameters
NameTypeDescription
pathSystem.StringThe path of the file
versionSystem.Nullable{System.Int32}The file version if provided; otherwise the current version is used if null
regionSystem.StringThe specific region if provided; otherwise the default region will be used
urlDurationSystem.Nullable{System.TimeSpan}The duration of time for which the file download/upload URL for the file will be valid if provided between 5 minutes and 30 days. Default is 1 hour.

RequestScan(id,version) method

Summary

Requests a file to be scanned

Returns

A Task that resolves to the File on completion

Parameters
NameTypeDescription
idSystem.GuidThe file ID
versionSystem.Nullable{System.Int32}The file version if provided; otherwise the current version is used if null

RequestScan(path,version) method

Summary

Requests a file to be scanned

Returns

A Task that resolves to the File on completion

Parameters
NameTypeDescription
pathSystem.StringThe file path
versionSystem.Nullable{System.Int32}The file version if provided; otherwise the current version is used if null

SearchFiles(query,next_page_token) method

Summary

Get a list of files found by next page token

Returns

A Task that resolves to completion

Parameters
NameTypeDescription
queryTrimbleCloud.DataOcean3.Model.SearchQueryThe information to search
next_page_tokenSystem.StringThe token provided by search

Update(id,file) method

Summary

Update a file given the file ID

Returns

A Task that resolves to the updated File on completion

Parameters
NameTypeDescription
idSystem.GuidThe file ID
fileTrimbleCloud.DataOcean3.Model.FileUpdateThe file information to update

Update(path,file) method

Summary

Update a file given the file path

Returns

A Task that resolves to the updated File on completion

Parameters
NameTypeDescription
pathSystem.StringThe file path
fileTrimbleCloud.DataOcean3.Model.FileUpdateThe file information to update

Upload(id,stream,version,concurrentRequests) method

Summary

Uploads a file given the file ID and Stream

Returns

A Task that resolves to completion

Parameters
NameTypeDescription
idSystem.GuidThe file ID
streamSystem.IO.StreamThe file Stream
versionSystem.Nullable{System.Int32}The file version if provided; otherwise the current version is used if null
concurrentRequestsSystem.Int32The number of concurrent upload tasks if provided; otherwise 8 tasks are used

Upload(path,stream,version,concurrentRequests) method

Summary

Uploads a file given the file path and Stream

Returns

A Task that resolves to completion

Parameters
NameTypeDescription
pathSystem.StringThe file path
streamSystem.IO.StreamThe file Stream
versionSystem.Nullable{System.Int32}The file version if provided; otherwise the current version is used if null
concurrentRequestsSystem.Int32The number of concurrent upload tasks if provided; otherwise 8 tasks are used

IJobsAPI type

Namespace

TrimbleCloud.DataOcean3

Read(id) method

Summary

Get a job given the job id

Returns

A Task that resolves to the job on completion or null if the job does not exist

Parameters
NameTypeDescription
idSystem.GuidThe id of the job

WaitForJob(id,timeout,timeDelay,callback) method

Summary

Waits for job to finish and returns job’s status

Returns

A Task that resolves to the job on completion or null if the job does not exist. TimeoutException after a set time of polling.

Parameters
NameTypeDescription
idSystem.GuidThe id of the job
timeoutSystem.Nullable{System.TimeSpan}Time limit for job to finish before Timeout Exception.
timeDelaySystem.Nullable{System.TimeSpan}Time delay before the function calls the Job api, timeDelay has a minimum of 1 second.
callbackSystem.Action{TrimbleCloud.DataOcean3.Model.Job}Callback function which is called after every Job api call, the function must be void

StatusCodeException type

Namespace

TrimbleCloud.DataOcean3.Exceptions

StatusCode property

Summary

Status code returned from Data Ocean