Interface OPConnectClient


  • public interface OPConnectClient
    The OPConnectClient provides access to the 1Password Connect API methods.
    • 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 vault
        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
      • 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 vault
        itemUUID - 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 vault
        item - 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 vault
        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

        @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 vault
        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
      • 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 vault
        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
      • 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 of APIRequest 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 retrieve
        offset - how far into the collection of API events the response should start
        Returns:
        a CompletableFuture is returned immediately and eventually completed with a list of APIRequest 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