Package com.sanctionco.opconnect
Interface OPConnectClient
-
public interface OPConnectClient
TheOPConnectClient
provides access to the 1Password Connect API methods.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CompletableFuture<Item>
createItem(String vaultUUID, Item item)
Create a new item in the given vault.CompletableFuture<Void>
deleteItem(String vaultUUID, String itemUUID)
Moves an item to the trash in the given vault.CompletableFuture<Item>
getItem(String vaultUUID, String itemUUID)
Get a full item from the given vault.CompletableFuture<Vault>
getVault(String vaultUUID)
Get the details of a specific vault.default OPConnectVaultClient
getVaultClient(String vaultUUID)
Provides a convenient wrapper client that interacts with a specific vault.CompletableFuture<List<APIRequest>>
listAPIActivity()
Provides a list of recent API activity.CompletableFuture<List<APIRequest>>
listAPIActivity(Integer limit)
Provides a list of recent API activity, limiting the results based on the given limit.CompletableFuture<List<APIRequest>>
listAPIActivity(Integer limit, Integer offset)
Provides a list of recent API activity, starting at the given offset and limiting the results based on the given limit.CompletableFuture<List<Item>>
listItems(String vaultUUID)
List the items from the given vault.CompletableFuture<List<Item>>
listItems(String vaultUUID, String filter)
List the items from the given vault, filtering based on the filter.CompletableFuture<List<Vault>>
listVaults()
List the available vaults in 1Password.CompletableFuture<Item>
patchItem(String vaultUUID, String itemUUID, List<Patch> patches)
Applies an add, remove, or replace operation on an item or the fields of an item.CompletableFuture<Item>
replaceItem(String vaultUUID, String itemUUID, Item item)
Replace an entire item in the given vault.
-
-
-
Method Detail
-
listVaults
@GET("/v1/vaults") CompletableFuture<List<Vault>> listVaults()
List the available vaults in 1Password.- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the list of available vault objects
-
getVault
@GET("/v1/vaults/{id}") CompletableFuture<Vault> getVault(@Path("id") String vaultUUID)
Get the details of a specific vault.- Parameters:
vaultUUID
- the id of the vault to retrieve- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the vault object
-
listItems
@GET("/v1/vaults/{id}/items") CompletableFuture<List<Item>> listItems(@Path("id") String vaultUUID)
List the items from the given vault.- Parameters:
vaultUUID
- the id of 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
@GET("/v1/vaults/{id}/items") CompletableFuture<List<Item>> listItems(@Path("id") String vaultUUID, @Query("filter") String filter)
List the items from the given vault, filtering based on the filter.- Parameters:
vaultUUID
- the id of the vaultfilter
- 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
-
getItem
@GET("/v1/vaults/{vaultId}/items/{itemId}") CompletableFuture<Item> getItem(@Path("vaultId") String vaultUUID, @Path("itemId") String itemUUID)
Get a full item from the given vault.- Parameters:
vaultUUID
- the id of the vaultitemUUID
- the id of the item- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the item
-
createItem
@POST("/v1/vaults/{vaultId}/items") CompletableFuture<Item> createItem(@Path("vaultId") String vaultUUID, @Body Item item)
Create a new item in the given vault.- Parameters:
vaultUUID
- the id of the vaultitem
- the full item object to create- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with the newly created item
-
replaceItem
@PUT("/v1/vaults/{vaultId}/items/{itemId}") CompletableFuture<Item> replaceItem(@Path("vaultId") String vaultUUID, @Path("itemId") String itemUUID, @Body Item item)
Replace an entire item in the given vault.- Parameters:
vaultUUID
- the id of the vaultitemUUID
- 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
@PATCH("/v1/vaults/{vaultId}/items/{itemId}") CompletableFuture<Item> patchItem(@Path("vaultId") String vaultUUID, @Path("itemId") String itemUUID, @Body List<Patch> patches)
Applies an add, remove, or replace operation on an item or the fields of an item. Uses the RFC6902 JSON Patch document standard.- Parameters:
vaultUUID
- the id of the vaultitemUUID
- 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
-
deleteItem
@DELETE("/v1/vaults/{vaultId}/items/{itemId}") CompletableFuture<Void> deleteItem(@Path("vaultId") String vaultUUID, @Path("itemId") String itemUUID)
Moves an item to the trash in the given vault.- Parameters:
vaultUUID
- the id of the vaultitemUUID
- the id of the item to move to the trash- Returns:
- a
CompletableFuture
is returned immediately and eventually completed when the operation is complete
-
listAPIActivity
@GET("/v1/activity") CompletableFuture<List<APIRequest>> listAPIActivity()
Provides a list of recent API activity.- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with a list ofAPIRequest
objects that describe activity
-
listAPIActivity
@GET("/v1/activity") CompletableFuture<List<APIRequest>> listAPIActivity(@Query("limit") Integer limit)
Provides a list of recent API activity, limiting the results based on the given limit.- Parameters:
limit
- the maximum number of activity instances to retrieve- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with a list ofAPIRequest
objects that describe activity
-
listAPIActivity
@GET("/v1/activity") CompletableFuture<List<APIRequest>> listAPIActivity(@Query("limit") Integer limit, @Query("offset") Integer offset)
Provides a list of recent API activity, starting at the given offset and limiting the results based on the given limit.- Parameters:
limit
- the maximum number of activity instances to retrieveoffset
- how far into the collection of API events the response should start- Returns:
- a
CompletableFuture
is returned immediately and eventually completed with a list ofAPIRequest
objects that describe activity
-
getVaultClient
default OPConnectVaultClient getVaultClient(String vaultUUID)
Provides a convenient wrapper client that interacts with a specific vault.- Parameters:
vaultUUID
- the id of the vault to interact with- Returns:
- a new
OPConnectVaultClient
instance
-
-