Class OPConnectVaultClient

java.lang.Object
com.sanctionco.opconnect.OPConnectVaultClient

public class OPConnectVaultClient extends Object
The OPConnectVaultClient is a convenient wrapper that provides access to 1Password Connect API methods that interact with a specific vault.
  • Constructor Details

    • OPConnectVaultClient

      public OPConnectVaultClient(OPConnectClient client, String vaultUUID)
      Creates a new instance of OPConnectVaultClient.
      Parameters:
      client - the underlying OPConnectClient to use for making requests
      vaultUUID - the id of the vault this client uses when making requests
  • Method Details

    • getVault

      public CompletableFuture<Vault> getVault()
      Get the details of this vault.
      Returns:
      a CompletableFuture is returned immediately and eventually completed with the vault object
    • listItems

      public CompletableFuture<List<Item>> 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

      public CompletableFuture<List<Item>> listItems(String filter)
      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

      public CompletableFuture<List<Item>> listItems(Filter filter)
      List the items from the given vault, filtering based on the filter.
      Parameters:
      filter - the 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
    • getItem

      public CompletableFuture<Item> getItem(String itemUUID)
      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

      public CompletableFuture<Item> createItem(Item item)
      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

      public CompletableFuture<Item> replaceItem(String itemUUID, Item item)
      Replace an entire item in the vault.
      Parameters:
      itemUUID - the id of the item to replace
      item - 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

      public CompletableFuture<Item> patchItem(String itemUUID, List<Patch> patches)
      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 patch
      patches - 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

      public CompletableFuture<Item> patchItem(String itemUUID, Patch patch)
      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 patch
      patch - a patch to apply to the item
      Returns:
      a CompletableFuture is returned immediately and eventually completed with the updated item
    • deleteItem

      public CompletableFuture<Void> deleteItem(String itemUUID)
      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

      public CompletableFuture<List<File>> listFiles(String itemUUID)
      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 of File objects
    • listFiles

      public CompletableFuture<List<File>> listFiles(String itemUUID, boolean inlineContent)
      List the files attached to the given item.
      Parameters:
      itemUUID - the id of the item to get files for
      inlineContent - 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 of File objects
    • getFile

      public CompletableFuture<File> getFile(String itemUUID, String fileUUID)
      Get the details of a file from the given item.
      Parameters:
      itemUUID - the id of the item that the file is attached to
      fileUUID - the id of the file
      Returns:
      a CompletableFuture is returned immediately and eventually completed with the File details
    • getFile

      public CompletableFuture<File> getFile(String itemUUID, String fileUUID, boolean inlineContent)
      Get the details of a file from the given item.
      Parameters:
      itemUUID - the id of the item that the file is attached to
      fileUUID - the id of the file
      inlineContent - 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 File details
    • getFileContent

      public CompletableFuture<String> getFileContent(String itemUUID, String fileUUID)
      Get the content of a file.
      Parameters:
      itemUUID - the id of the item that the file is attached to
      fileUUID - the id of the file
      Returns:
      a CompletableFuture is returned immediately and eventually completed with the file contents