Class OkHttpShapeTreeClient
java.lang.Object
com.janeirodigital.shapetrees.client.okhttp.OkHttpShapeTreeClient
-
Method Summary
Modifier and TypeMethodDescriptionstatic ShapeTreeManager
discover
(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl) Discover the ShapeTreeManager associated with a given target resource.static okhttp3.Response
patch
(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl, List<URL> focusNodes, String body) static okhttp3.Response
plant
(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl, URL shapeTreeUrl, URL focusNodeUrl) Shape Trees, §4.2: This operation marks an existing resource as being managed by one or more shape trees, by associating a shape tree manager with the resource, and turning it into a managed resource.static okhttp3.Response
post
(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL parentContainer, List<URL> focusNodes, List<URL> targetShapeTrees, String slug, boolean isContainer, String body, ContentType contentType) static okhttp3.Response
put
(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl, List<URL> focusNodes, String body, ContentType contentType) static okhttp3.Response
put
(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl, List<URL> focusNodes, List<URL> targetShapeTrees, Boolean isContainer, String body, ContentType contentType) static okhttp3.Response
unplant
(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl, URL shapeTreeUrl)
-
Method Details
-
discover
public static ShapeTreeManager discover(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl) throws ShapeTreeException Discover the ShapeTreeManager associated with a given target resource.- Parameters:
okHttpClient
- OkHttp client to use for requestscontext
- ShapeTreeContext used for authorizationresourceUrl
- URL of the target resource for shape tree discovery- Returns:
- ShapeTreeManager if it is a managed resource, or null if it is not managed
- Throws:
ShapeTreeException
-
plant
public static okhttp3.Response plant(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl, URL shapeTreeUrl, URL focusNodeUrl) throws ShapeTreeException Shape Trees, §4.2: This operation marks an existing resource as being managed by one or more shape trees, by associating a shape tree manager with the resource, and turning it into a managed resource. If the resource is already managed, the associated shape tree manager will be updated with another shape tree assignment for the planted shape tree. If the resource is a container that already contains existing resources, and a recursive plant is requested, this operation will perform a depth first traversal through the containment hierarchy, validating and assigning as it works its way back up to the target root resource of this operation. https://shapetrees.org/TR/specification/#plant-shapetree- Parameters:
okHttpClient
- OkHttp client to use for requestscontext
- ShapeTreeContext used for authorizationresourceUrl
- URL of the target resource to assign a shape tree toshapeTreeUrl
- URL of the shape tree to assignfocusNodeUrl
- Optional URL of the focus node for shape validation- Returns:
- OkHttp Response
- Throws:
ShapeTreeException
-
unplant
public static okhttp3.Response unplant(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl, URL shapeTreeUrl) throws ShapeTreeException - Throws:
ShapeTreeException
-
post
public static okhttp3.Response post(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL parentContainer, List<URL> focusNodes, List<URL> targetShapeTrees, String slug, boolean isContainer, String body, ContentType contentType) throws ShapeTreeException - Throws:
ShapeTreeException
-
put
public static okhttp3.Response put(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl, List<URL> focusNodes, List<URL> targetShapeTrees, Boolean isContainer, String body, ContentType contentType) throws ShapeTreeException - Throws:
ShapeTreeException
-
put
public static okhttp3.Response put(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl, List<URL> focusNodes, String body, ContentType contentType) throws ShapeTreeException - Throws:
ShapeTreeException
-
patch
public static okhttp3.Response patch(okhttp3.OkHttpClient okHttpClient, ShapeTreeContext context, URL resourceUrl, List<URL> focusNodes, String body) throws ShapeTreeException - Throws:
ShapeTreeException
-