Package com.sanctionco.opconnect
Class OPConnectVaultClient
java.lang.Object
com.sanctionco.opconnect.OPConnectVaultClient
The
OPConnectVaultClient
is a convenient wrapper that provides access to
1Password Connect API methods that interact with a specific vault.-
Constructor Summary
ConstructorDescriptionOPConnectVaultClient(OPConnectClient client, String vaultUUID)
Creates a new instance ofOPConnectVaultClient
. -
Method Summary
Modifier and TypeMethodDescriptioncreateItem(Item item)
Create a new item in the vault.deleteItem(String itemUUID)
Moves an item to the trash in the vault.Get the details of a file from the given item.Get the details of a file from the given item.getFileContent(String itemUUID, String fileUUID)
Get the content of a file.Get a full item from the vault.getVault()
Get the details of this vault.List the files attached to the given item.List the files attached to the given item.List the items from the vault.List the items from the given vault, filtering based on the filter.List the items from the vault, filtering based on the filter.Applies an add, remove, or replace operation on an item or the fields of an item.Applies a list of add, remove, or replace operations on an item or the fields of an item.replaceItem(String itemUUID, Item item)
Replace an entire item in the vault.
-
Constructor Details
-
OPConnectVaultClient
Creates a new instance ofOPConnectVaultClient
.- Parameters:
client
- the underlyingOPConnectClient
to use for making requestsvaultUUID
- the id of the vault this client uses when making requests
-
-
Method Details
-
getVault
Get the details of this vault.- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the vault object
-
listItems
List the items from the vault.- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with a list of items that exist in the vault, without sections or fields
-
listItems
List the items from the vault, filtering based on the filter.- Parameters:
filter
- an SCM-style filter to filter the results server-side- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with a list of items that exist in the vault and match the filter, without sections or fields
-
listItems
List the items from the given vault, filtering based on the filter.- Parameters:
filter
- theFilter
to filter the results server-side- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with a list of items that exist in the vault and match the filter, without sections or fields
-
getItem
Get a full item from the vault.- Parameters:
itemUUID
- the id of the item- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the item
-
createItem
Create a new item in the vault.- Parameters:
item
- the full item object to create- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the newly created item
-
replaceItem
Replace an entire item in the vault.- Parameters:
itemUUID
- the id of the item to replaceitem
- the full item object that will replace the old item- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the newly replaced item
-
patchItem
Applies a list of add, remove, or replace operations on an item or the fields of an item. Uses the RFC6902 JSON Patch document standard.- Parameters:
itemUUID
- the id of the item to patchpatches
- a list of patches to apply to the item in order- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the updated item
-
patchItem
Applies an add, remove, or replace operation on an item or the fields of an item. Uses the RFC6902 JSON Patch document standard.- Parameters:
itemUUID
- the id of the item to patchpatch
- a patch to apply to the item- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the updated item
-
deleteItem
Moves an item to the trash in the vault.- Parameters:
itemUUID
- the id of the item to move to the trash- Returns:
- a
CompletableFuture
is returned immediately and eventually completed when the operation is complete
-
listFiles
List the files attached to the given item.- Parameters:
itemUUID
- the id of the item to get files for- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the list ofFile
objects
-
listFiles
List the files attached to the given item.- Parameters:
itemUUID
- the id of the item to get files forinlineContent
- whether to include the base64 encoded file contents. The file size must be less than OP_MAX_INLINE_FILE_SIZE_KB, or 100 kilobytes if the file size isn't defined.- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the list ofFile
objects
-
getFile
Get the details of a file from the given item.- Parameters:
itemUUID
- the id of the item that the file is attached tofileUUID
- the id of the file- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with theFile
details
-
getFile
Get the details of a file from the given item.- Parameters:
itemUUID
- the id of the item that the file is attached tofileUUID
- the id of the fileinlineContent
- whether to include the base64 encoded file contents. The file size must be less than OP_MAX_INLINE_FILE_SIZE_KB, or 100 kilobytes if the file size isn't defined.- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with theFile
details
-
getFileContent
Get the content of a file.- Parameters:
itemUUID
- the id of the item that the file is attached tofileUUID
- the id of the file- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the file contents
-