Package org.bsc.confluence.rest
Class AbstractRESTConfluenceService
- java.lang.Object
-
- org.bsc.confluence.rest.AbstractRESTConfluenceService
-
- All Implemented Interfaces:
IdHelper
- Direct Known Subclasses:
RESTConfluenceService
public abstract class AbstractRESTConfluenceService extends Object implements IdHelper
AbstractRESTConfluenceService is an abstract class that implements the IdHelper interface. It provides common functionality for making REST API calls to Confluence Sub-classes need to implement getCredentials() and urlBuilder() to provide the necessary information for making API calls.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractRESTConfluenceService.ServiceException
-
Field Summary
Fields Modifier and Type Field Description protected HttpClientclient
-
Constructor Summary
Constructors Constructor Description AbstractRESTConfluenceService()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected CompletableFuture<List<javax.json.JsonObject>>addAttachment(String id, Attachment att, InputStream data)protected CompletableFuture<Void>addLabels(String id, String... labels)static URIbuildUrl(URI url, List<String> path, Map<String,String> query)protected CompletableFuture<List<javax.json.JsonObject>>childrenPages(String id)CompletableFuture<Optional<javax.json.JsonObject>>createPage(javax.json.JsonObject inputData)protected CompletableFuture<Boolean>deletePageById(String id)protected CompletableFuture<List<javax.json.JsonObject>>descendantPages(long id)CompletableFuture<Optional<javax.json.JsonObject>>findPage(String spaceKey, String title)protected CompletableFuture<Optional<javax.json.JsonObject>>findPageById(String id)protected CompletableFuture<List<javax.json.JsonObject>>findPages(String spaceKey, String title)protected voidfromRequest(HttpRequest.Builder reqBuilder, String description, Consumer<HttpResponse<String>> consumer)CompletableFuture<HttpResponse<String>>fromRequestAsync(HttpRequest.Builder reqBuilder)protected CompletableFuture<List<javax.json.JsonObject>>getAttachment(String id, String fileName)protected CompletableFuture<List<javax.json.JsonObject>>getAttachments(String id)abstract ConfluenceService.CredentialsgetCredentials()protected javax.json.JsonObjectmapToObject(HttpResponse<String> res)protected Stream<javax.json.JsonObject>mapToStream(HttpResponse<String> res)protected CompletableFuture<Optional<javax.json.JsonObject>>updatePage(String pageId, javax.json.JsonObject inputData)protected abstract URIurlBuilder()
-
-
-
Field Detail
-
client
protected HttpClient client
-
-
Method Detail
-
getCredentials
public abstract ConfluenceService.Credentials getCredentials()
-
urlBuilder
protected abstract URI urlBuilder() throws URISyntaxException
- Throws:
URISyntaxException
-
fromRequestAsync
public CompletableFuture<HttpResponse<String>> fromRequestAsync(HttpRequest.Builder reqBuilder)
- Parameters:
reqBuilder-- Returns:
-
fromRequest
protected void fromRequest(HttpRequest.Builder reqBuilder, String description, Consumer<HttpResponse<String>> consumer)
-
mapToStream
protected Stream<javax.json.JsonObject> mapToStream(HttpResponse<String> res)
-
mapToObject
protected javax.json.JsonObject mapToObject(HttpResponse<String> res)
-
buildUrl
public static URI buildUrl(URI url, List<String> path, Map<String,String> query) throws URISyntaxException
- Throws:
URISyntaxException
-
findPageById
protected CompletableFuture<Optional<javax.json.JsonObject>> findPageById(String id)
-
findPages
protected CompletableFuture<List<javax.json.JsonObject>> findPages(String spaceKey, String title)
-
descendantPages
protected CompletableFuture<List<javax.json.JsonObject>> descendantPages(long id)
-
childrenPages
protected CompletableFuture<List<javax.json.JsonObject>> childrenPages(String id)
-
findPage
public CompletableFuture<Optional<javax.json.JsonObject>> findPage(String spaceKey, String title)
- Parameters:
spaceKey-title-- Returns:
-
deletePageById
protected CompletableFuture<Boolean> deletePageById(String id)
-
createPage
public final CompletableFuture<Optional<javax.json.JsonObject>> createPage(javax.json.JsonObject inputData)
- Parameters:
inputData-- Returns:
-
updatePage
protected CompletableFuture<Optional<javax.json.JsonObject>> updatePage(String pageId, javax.json.JsonObject inputData)
-
addLabels
protected final CompletableFuture<Void> addLabels(String id, String... labels)
- Parameters:
id-labels-
-
getAttachments
protected CompletableFuture<List<javax.json.JsonObject>> getAttachments(String id)
-
getAttachment
protected CompletableFuture<List<javax.json.JsonObject>> getAttachment(String id, String fileName)
-
addAttachment
protected CompletableFuture<List<javax.json.JsonObject>> addAttachment(String id, Attachment att, InputStream data)
-
-