Skip to content

TrimbleCloud.DataOcean3

TrimbleCloud.DataOcean3.Model

Creates an application identity.

Name Type Description
applicationId System.Guid The application id.

TrimbleCloud.DataOcean3.Model

Creates a device identity.

Name Type Description
deviceId System.Guid The device id; otherwise, AclIdentity.ALL to represent any device.
applicationId System.Guid The application id; otherwise AclIdentity.ALL to represent any application.

TrimbleCloud.DataOcean3.Model

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.

TrimbleCloud.DataOcean3.Model

Read-only permission

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

Read, write, and delete permission.

TrimbleCloud.DataOcean3.Model

Creates a user identity.

Name Type Description
userId System.Guid The user id; otherwise, AclIdentity.ALL to represent any user.
applicationId System.Guid The application id; otherwise AclIdentity.ALL to represent any application.

TrimbleCloud.DataOcean3

A client for the Trimble Cloud Platform Data Ocean

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

Section titled “#ctor(clientProvider,productName) constructor”

Public constructor for a Data Ocean client

Name Type Description
clientProvider Trimble.ID.IHttpClientProvider A provider of a pre-configured HttpClient used for API calls made by this client
productName System.String The product name of the consuming application

Directories API

Files API

Jobs API

Inherit from parent.

This method has no parameters.

TrimbleCloud.DataOcean3

A client for the Trimble Cloud Platform Data Ocean

// 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

Section titled “AddDataOcean(services,tokenProvider,baseAddress,configuration,logger,productName) method”

Adds Data Ocean services.

Name Type Description
services Microsoft.Extensions.DependencyInjection.IServiceCollection The service collection to add Data Ocean to.
tokenProvider Trimble.ID.ITokenProvider The token provider.
baseAddress System.Uri The base address for the service.
configuration TrimbleCloud.DataOcean3.Utilities.IDataOceanConfiguration The optional Data Ocean configuration.
logger TrimbleCloud.Common.Logging.ILogger The optional Data Ocean logger.
productName System.String The product name of the consuming application

ReformatApiCloudv1Address(baseAddress) method

Section titled “ReformatApiCloudv1Address(baseAddress) method”

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

The unmodified or modified uri.

Name Type Description
baseAddress System.Uri The base address.

TrimbleCloud.DataOcean3.Model

Represents a directory in the data ocean.

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

Gets or sets the application identifier associated with the directory.

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

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

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

Gets or sets the unique identifier of the directory.

Gets or sets the metadata associated with the directory.

Gets or sets the owner identifier of the directory.

Gets or sets the path of the directory.

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

TrimbleCloud.DataOcean3.Model

Represents a directory creation request.

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

Gets or sets the metadata associated with the directory.

Gets or sets the path of the directory.

TrimbleCloud.DataOcean3.Model

Represents a page of directories.

Gets or sets the list of directories.

Gets or sets the token for the next page.

TrimbleCloud.DataOcean3.Model

Represents a response containing directory information.

Gets or sets the directory information.

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

TrimbleCloud.DataOcean3.Model

Represents a directory update in the data ocean.

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

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

Gets or sets the path of the directory update.

TrimbleCloud.DataOcean3.Model

Represents a file.

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

Gets or sets the application identifier associated with the file.

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

Gets or sets the download information of the file.

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

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

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

Gets or sets the unique identifier of the file.

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

Gets or sets the malware status of the file.

Gets or sets the master identifier of the file.

Gets or sets the MD5 hash of the file.

Gets or sets the metadata of the file.

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

Gets or sets the owner identifier of the file.

Gets or sets the path of the file.

Gets or sets the path template of the file.

Gets or sets the region preferences for the file.

Gets or sets the regions associated with the file.

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

Gets or sets the size of the file in bytes.

Gets or sets the status of the file.

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

Gets or sets the upload information of the file.

Gets or sets the version of the file.

TrimbleCloud.DataOcean3.Model

Represents a file copy operation.

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

Gets or sets the metadata associated with the file.

Gets or sets the path of the file.

Gets or sets the regions where the file is available.

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

TrimbleCloud.DataOcean3.Model

Represents the information required to create a file.

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

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

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

Gets or sets the master ID of the file.

Gets or sets the metadata associated with the file.

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

Gets or sets the path of the file.

Gets or sets the path template of the file.

Gets or sets the regions associated with the file.

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

TrimbleCloud.DataOcean3.Model

File cannot be scanned automatically due to its size

File has been scanned and no issues were detected

File has been scanned and has been found to contain malware

File scan was attempted but could not be completed

File has not been scanned yet

TrimbleCloud.DataOcean3.Exceptions

Current state of file.

TrimbleCloud.DataOcean3.Model

Archive has been uploaded and is now being processed

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

File is available

File content is in the process of being deleted

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

File is not accessible due to a failure during upload

File is awaiting an upload

TrimbleCloud.DataOcean3

Interface for the Trimble Cloud Platform Data Ocean

Directories API

Files API

Jobs API

TrimbleCloud.DataOcean3.Utilities

Download and upload chunk size.

Timeout used for Http calls.

The maximum number of concurrent requests allowed.

Page size to retrieve.

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

Time to wait between retries.

TrimbleCloud.DataOcean3

Copies a directory

A Task that resolves to a JobResponseBrief on completion

Name Type Description
id System.Guid The directory ID
directory TrimbleCloud.DataOcean3.Model.DirectoryCreate The directory information to copy

Copies a file

A Task that resolves to a JobResponseBrief on completion

Name Type Description
path System.String The directory path
directory TrimbleCloud.DataOcean3.Model.DirectoryCreate The directory information to copy

Create a directory

A Task that resolves to the created Directory on completion

Name Type Description
directory TrimbleCloud.DataOcean3.Model.DirectoryCreate The information of the directory to create

Delete a directory given the directory ID

A Task that resolves to completion

Name Type Description
id System.Guid The directory ID
recursive System.Boolean Delete descendant files and directories

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

Delete a directory given the directory path

A Task that resolves to completion

Name Type Description
path System.String The directory path
recursive System.Boolean Delete descendant files and directories

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

Delete an empty directory given the directory ID

A Task that resolves to completion

Name Type Description
id System.Guid The directory ID

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

Delete an empty directory given the directory path

A Task that resolves to completion

Name Type Description
path System.String The directory path

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

Delete a directory given the directory ID

A Task that resolves to a JobResponseBrief on completion

Name Type Description
id System.Guid The directory ID

Delete a directory given the directory path

A Task that resolves to a JobResponseBrief on completion

Name Type Description
path System.String The directory path

Get a list of directories in the given parent directory

An asynchronous list of directories

Name Type Description
parentId System.Guid The ID of the parent directory

Get a list of directories in the given parent directory

An asynchronous list of directories

Name Type Description
path System.String The optional path of the parent directory, root directory is used if this parameter is omitted or null

Get a list of directories in the given parent directory

An asynchronous list of directories

Name Type Description
parentId System.Guid The ID of the parent directory
urlDuration System.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.

Get a list of directories in the given parent directory

An asynchronous list of directories

Name Type Description
path System.String The optional path of the parent directory, root directory is used if this parameter is omitted or null
urlDuration System.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.

Get a directory given the directory ID

A Task that resolves to the Directory on completion

Name Type Description
id System.Guid The directory ID

Get a directory given the directory path

A Task that resolves to the Directory on completion

Name Type Description
path System.String The optional path of the directory, root directory is used if this parameter is omitted or null

Update a directory given the directory ID

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

Name Type Description
id System.Guid The directory ID
directory TrimbleCloud.DataOcean3.Model.DirectoryUpdate DirectoryUpdate

Update a directory given the directory path

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

Name Type Description
path System.String
directory TrimbleCloud.DataOcean3.Model.DirectoryUpdate DirectoryUpdate

TrimbleCloud.DataOcean3

Copies a file

A Task that resolves to the copied File on completion

Name Type Description
id System.Guid The file ID
file TrimbleCloud.DataOcean3.Model.FileCopy The file information to copy

Copies a file

A Task that resolves to the copied File on completion

Name Type Description
path System.String The file path
file TrimbleCloud.DataOcean3.Model.FileCopy The file information to copy

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

A Task that resolves to the created File on completion

Name Type Description
file TrimbleCloud.DataOcean3.Model.FileCreate The information of the file to create
urlDuration System.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 a file given the file ID

A Task that resolves to completion

Name Type Description
id System.Guid The file ID

Delete a file given the file path

A Task that resolves to completion

Name Type Description
path System.String The file path

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

Section titled “Download(stream,id,version,region,concurrentRequests) method”

Downloads a file given the file ID

A Task that resolves to completion

Name Type Description
stream System.IO.Stream The stream to write content to
id System.Guid The file ID
version System.Nullable{System.Int32} The file version if provided; otherwise the current version is used if null
region System.String The specific region if provided; otherwise the default region will be used
concurrentRequests System.Int32 The number of concurrent download tasks if provided; otherwise 8 tasks are used
Name Description
TrimbleCloud.DataOcean3.Exceptions.FileNotReadyException Thrown if the file is not in the Available state

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

Section titled “Download(stream,path,version,region,concurrentRequests) method”

Downloads a file given the file path

A Task that resolves to completion

Name Type Description
stream System.IO.Stream The stream to write content to
path System.String The file path
version System.Nullable{System.Int32} The file version if provided; otherwise the current version is used if null
region System.String The specific region if provided; otherwise the default region will be used
concurrentRequests System.Int32 The number of concurrent download tasks if provided; otherwise 8 tasks are used
Name Description
TrimbleCloud.DataOcean3.Exceptions.FileNotReadyException Thrown if the file is not in the Available state

Get a fileset manifest given the file ID

An asynchronous list of files in the fileset

Name Type Description
id System.Guid The file ID
version System.Nullable{System.Int32} The file version if provided; otherwise the current version is used if null

Get a fileset manifest given the file path

An asynchronous list of files in the fileset

Name Type Description
path System.String The file path
version System.Nullable{System.Int32} The file version if provided; otherwise the current version is used if null

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

An asynchronous list of files versions

Name Type Description
id System.Guid The file ID
urlDuration System.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.

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

An asynchronous list of files versions

Name Type Description
path System.String The file path
urlDuration System.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

Section titled “Read(id,version,region,urlDuration) method”

Get a file given the file ID

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

Name Type Description
id System.Guid The file ID
version System.Nullable{System.Int32} The file version if provided; otherwise the current version is used if null
region System.String The specific region if provided; otherwise the default region will be used
urlDuration System.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

Section titled “Read(path,version,region,urlDuration) method”

Get a file given the file path

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

Name Type Description
path System.String The path of the file
version System.Nullable{System.Int32} The file version if provided; otherwise the current version is used if null
region System.String The specific region if provided; otherwise the default region will be used
urlDuration System.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.

Requests a file to be scanned

A Task that resolves to the File on completion

Name Type Description
id System.Guid The file ID
version System.Nullable{System.Int32} The file version if provided; otherwise the current version is used if null

Requests a file to be scanned

A Task that resolves to the File on completion

Name Type Description
path System.String The file path
version System.Nullable{System.Int32} The file version if provided; otherwise the current version is used if null

Get a list of files found by next page token

A Task that resolves to completion

Name Type Description
query TrimbleCloud.DataOcean3.Model.SearchQuery The information to search
next_page_token System.String The token provided by search

Update a file given the file ID

A Task that resolves to the updated File on completion

Name Type Description
id System.Guid The file ID
file TrimbleCloud.DataOcean3.Model.FileUpdate The file information to update

Update a file given the file path

A Task that resolves to the updated File on completion

Name Type Description
path System.String The file path
file TrimbleCloud.DataOcean3.Model.FileUpdate The file information to update

Upload(id,stream,version,concurrentRequests) method

Section titled “Upload(id,stream,version,concurrentRequests) method”

Uploads a file given the file ID and Stream

A Task that resolves to completion

Name Type Description
id System.Guid The file ID
stream System.IO.Stream The file Stream
version System.Nullable{System.Int32} The file version if provided; otherwise the current version is used if null
concurrentRequests System.Int32 The number of concurrent upload tasks if provided; otherwise 8 tasks are used

Upload(path,stream,version,concurrentRequests) method

Section titled “Upload(path,stream,version,concurrentRequests) method”

Uploads a file given the file path and Stream

A Task that resolves to completion

Name Type Description
path System.String The file path
stream System.IO.Stream The file Stream
version System.Nullable{System.Int32} The file version if provided; otherwise the current version is used if null
concurrentRequests System.Int32 The number of concurrent upload tasks if provided; otherwise 8 tasks are used

TrimbleCloud.DataOcean3

Get a job given the job id

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

Name Type Description
id System.Guid The id of the job

WaitForJob(id,timeout,timeDelay,callback) method

Section titled “WaitForJob(id,timeout,timeDelay,callback) method”

Waits for job to finish and returns job’s status

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

Name Type Description
id System.Guid The id of the job
timeout System.Nullable{System.TimeSpan} Time limit for job to finish before Timeout Exception.
timeDelay System.Nullable{System.TimeSpan} Time delay before the function calls the Job api, timeDelay has a minimum of 1 second.
callback System.Action{TrimbleCloud.DataOcean3.Model.Job} Callback function which is called after every Job api call, the function must be void

TrimbleCloud.DataOcean3.Exceptions

Status code returned from Data Ocean