Class BitbucketRequestExecutor


  • public class BitbucketRequestExecutor
    extends Object
    • Constructor Detail

    • Method Detail

      • getBaseUrl

        public okhttp3.HttpUrl getBaseUrl()
        Returns the root URL of Bitbucket server.
        Returns:
        the base url
      • getCoreRestPath

        public okhttp3.HttpUrl getCoreRestPath()
        Provide the base Rest path
        Returns:
        HttpUrl of the core rest path;
      • makeDeleteRequest

        public void makeDeleteRequest​(okhttp3.HttpUrl url)
        Make a DELETE request to given URL.
        Parameters:
        url - , the delete URL
      • makeGetRequest

        public <T> BitbucketResponse<T> makeGetRequest​(okhttp3.HttpUrl url,
                                                       com.fasterxml.jackson.core.type.TypeReference<T> returnType,
                                                       RequestConfiguration... additionalConfig)
        Make a GET request to the url given. This method will add authentication headers as needed. If the requested resource is paged, or the return type is generified use this method, otherwise the makeGetRequest(HttpUrl, Class, RequestConfiguration...) is most likely a better choice.
        Type Parameters:
        T - type to return
        Parameters:
        url - url to connect to
        returnType - type reference used when getting generified objects (such as pages)
        Returns:
        a deserialized object of type T
        See Also:
        makeGetRequest(HttpUrl, Class, RequestConfiguration...)
      • makeStreamingGetRequest

        public InputStream makeStreamingGetRequest​(okhttp3.HttpUrl url)
        Make a GET request to the url given. This method will add authentication headers as needed.
        Parameters:
        url - url to connect to
        Returns:
        a serialised input stream of bytes.
      • makePostRequest

        public <T,​R> BitbucketResponse<R> makePostRequest​(okhttp3.HttpUrl url,
                                                                T requestPayload,
                                                                Class<R> returnType,
                                                                RequestConfiguration... additionalConfig)
        Makes a POST request to the given URL with given request payload.
        Type Parameters:
        T - type of Request payload
        R - return type
        Parameters:
        url - the URL to make the request to
        requestPayload - , JSON payload which will be marshalled to send it with POST
        returnType - , class of expected return type
        Returns:
        the result
      • makePostRequest

        public <T> void makePostRequest​(okhttp3.HttpUrl url,
                                        T requestPayload,
                                        RequestConfiguration... additionalConfig)
        Makes a POST request to the given URL with given request payload.
        Type Parameters:
        T - Type of Request payload
        Parameters:
        url - the URL to make the request to
        requestPayload - JSON payload which will be marshalled to send it with POST
      • makePutRequest

        public <T,​R> BitbucketResponse<R> makePutRequest​(okhttp3.HttpUrl url,
                                                               T requestPayload,
                                                               Class<R> returnType,
                                                               RequestConfiguration... additionalConfig)
        Makes a PUT request to the the given URL with given request payload
        Type Parameters:
        T - Type of result
        R - Type of return
        Parameters:
        url - the URL to make the request to
        requestPayload - JSON payload which will be marshalled to send it with PUT
        returnType - , Class of expected return type
        Returns:
        the result