> For the complete documentation index, see [llms.txt](https://trillo.gitbook.io/trillo-workbench-java-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trillo.gitbook.io/trillo-workbench-java-sdk/storageapi.md).

# StorageApi

## getFilePath

Description...

```
StorageApi.getFilePath(String fileId)
```

#### Parameters

```
fileId
```

#### Returns

```
The file path for the input File ID
```

## getFileIdByPath

Description...

```
StorageApi.getFileIdByPath(String absoluteFilePath)
```

#### Parameters

```
absoluteFilePath
```

#### Returns

```
The File ID using file path
```

## getFolderPath

This API provides the folder path

```
StorageApi.getFolderPath(String folderId)
```

#### Parameters

```
folderId
```

#### Returns

```
Folder path for the input folder ID
```

## getSignedUrl

Description...

```
StorageApi.getSignedUrl(String filePath)
or
StorageApi.getSignedUrl(String filePath, long duration, TimeUnit unit)
or
StorageApi.getSignedUrl(String bucketName, String filePath)
or
StorageApi.getSignedUrl(String bucketName, String filePath, long duration, TimeUnit unit)
```

#### Parameters

```
filePath
duration
unit
bucketName
```

#### Returns

```
String signed URL 
```

## copyFileToBucket

Copy file to bucket

```
StorageApi.copyFileToBucket(String sourceFilePath, String targetFilePath)
or
StorageApi.copyFileToBucket(String bucketName, String sourceFilePath, String targetFilePath)
or
StorageApi.copyFileToBucket(String bucketName, String serviceAccountPropName,
      String sourceFilePath, String targetFilePath)

```

#### Parameters

```
sourceFilePath
targetFilePath
bucketName
serviceAccountPropName
```

#### Returns

```
Result
```

## copyFileFromBucket

Copy file from bucket

```
StorageApi.copyFileFromBucket(String sourceFilePath, String targetFilePath)
or
Storageapi.copyFileFromBucket(String bucketName, String sourceFilePath, String targetFilePath)
or
Storageapi.copyFileFromBucket(String bucketName, String serviceAccountPropName,
      String sourceFilePath, String targetFilePath)
```

#### Parameters

```
sourceFilePath
targetFilePath
bucketName
serviceAccountPropName
```

#### Returns

```
Result
```

## copyFileWithinBucket

Copy file to new location within bucket

```
StorageApi.copyFileWithinBucket(String sourceFilePath, String targetFilePath)
or
StorageApi.copyFileWithinBucket(String sourceFilePath, String targetFilePath, boolean makeCopy)
or
StorageApi.copyFileWithinBucket(String bucketName, String sourceFilePath, String targetFilePath)
or
StorageApi.copyFileWithinBucket(String bucketName, String sourceFilePath, String targetFilePath, boolean makeCopy)
```

#### Parameters

```
sourceFilePath
targetFilePath
makeCopy
bucketName
```

#### Returns

```
Result
```

## writeToBucket

Write data to bucket

```
StorageApi.writeToBucket(byte[] bytes, String targetFilePath, String contentType)
or
StorageApi.writeToBucket(String bucketName, byte[] bytes, String targetFilePath, String contentType)
```

#### Parameters

```
bytes
targetFilePath
contentType
bucketName
```

#### Returns

```
Result
```

## readFromBucket

Read file from bucket

```
StorageApi.readFromBucket(String sourceFilePath)
or
StorageApi.readFromBucket(String bucketName, String sourceFilePath)
```

#### Parameters

```
sourceFilePath
bucketName
```

#### Returns

```
Result
```

## listFiles

Get list of file names for the bucket folder.

```
StorageApi.listFiles(String pathName, Boolean versioned)
or
StorageApi.listFiles(String bucketName, String pathName, Boolean versioned)
or
StorageApi.listFiles(String bucketName, String pathName,
      Boolean versioned, String pageToken, Integer pageSize)
```

#### Parameters

```
pathName
versioned
bucketName
pageToken
pageSize
```

#### Returns

```
Result
```

## saveFileObject

Save file object

```
StorageApi.saveFileObject(Map<String, Object> fileObject)
```

#### Parameters

```
fileObject
```

#### Returns

```
Object
```

## exists

Check if file exists.

```
StorageApi.exists(String filePath)
```

#### Parameters

```
filePath
```

#### Returns

```
Boolean
```

## getFileList

Get list of files in folder

```
StorageApi.getFileList(long folderId, String orderBy)
```

#### Parameters

```
folderId
orderBy
```

#### Returns

```
List<Map<String, Object>>
```

## getFilesPages

Get files pages

```
StorageApi.getFilesPage(String bucketName, String pathName,
      Boolean versioned)
or 
StorageApi.getFilesPage(String bucketName, String pathName,
                      Boolean versioned, String pageToken, Integer pageSize)
```

#### Parameters

```
bucketName
pathName
versioned
pageToken
pageSize
```

#### Returns

```
FilesPage
```

## getBucketName

Get default bucket name.

```
StorageApi.getBucketName()
```

#### Parameters

```
None
```

#### Returns

```
String
```

## shareWithTenants

Share with tenants

```
StorageApi.shareWithTenants(Map<String, Object> params)
```

#### Parameters

```
params
```

#### Returns

```
Object
```

## copyLargeFileToBucket

copy large file to bucket

```
StorageApi.copyLargeFileToBucket(String sourceFilePath, String targetFilePath)
or
StorageApi.copyLargeFileToBucket(String bucketName, String sourceFilePath,
      String targetFilePath)
or
StorageApi.copyLargeFileToBucket((String bucketName, String serviceAccountPropName,
      String sourceFilePath, String targetFilePath)
```

#### Parameters

```
sourceFilePath
targetFilePath
bucketName
serviceAccountPropName
```

#### Returns

```
Result
```

## makePublic

make a file public

```
StorageApi.makePublic(String bucketName, String filePath)
or 
StorageApi.makePublic(String bucketName, String serviceAccountPropName,
      String filePath)
```

#### Parameters

```
bucketName
filePath
serviceAccountPropName
```

#### Returns

```
Result
```

## getContent

Get content of a doc

```
StorageApi.getContent(Map<String, Object> doc)
```

#### Parameters

```
doc
```

#### Returns

```
Object
```

## getBucketPath

Get bucket path using file object

```
StorageApi.getBucketPath(Map<String, Object> fileObject)
```

#### Parameters

```
fileObject
```

#### Returns

```
String
```

## getBucketPath

Get path using fileId

```
StorageApi.getBucketPath(String fileId)
```

#### Parameters

```
fileId
```

#### Returns

```
String
```
