Class SmartsheetBuilder


  • public class SmartsheetBuilder
    extends java.lang.Object

    A convenience class to help create a Smartsheet instance with the appropriate fields.

    Thread Safety: This class is not thread safe since it's mutable, one builder instance is NOT expected to be used in multiple threads.

    • Field Detail

      • US_BASE_URI

        public static final java.lang.String US_BASE_URI
        URI to prod-us API endpoints
        See Also:
        Constant Field Values
      • EU_BASE_URI

        public static final java.lang.String EU_BASE_URI
        URI to prod-eu API endpoints
        See Also:
        Constant Field Values
      • DEFAULT_BASE_URI

        public static final java.lang.String DEFAULT_BASE_URI

        Represents the default base URI of the Smartsheet REST API.

        It is a constant with value "https://api.smartsheet.com/2.0".

        See Also:
        Constant Field Values
      • GOV_BASE_URI

        public static final java.lang.String GOV_BASE_URI

        Represents the default base URI of the Smartsheetgov REST API.

        It is a constant with value "https://api.smartsheetgov.com/2.0".

        See Also:
        Constant Field Values
    • Constructor Detail

      • SmartsheetBuilder

        public SmartsheetBuilder()
        Constructor.
    • Method Detail

      • setHttpClient

        public SmartsheetBuilder setHttpClient​(com.smartsheet.api.internal.http.HttpClient httpClient)

        Set the HttpClient.

        Parameters:
        httpClient - the http client
        Returns:
        the smartsheet builder
      • setJsonSerializer

        public SmartsheetBuilder setJsonSerializer​(com.smartsheet.api.internal.json.JsonSerializer jsonSerializer)

        Set the JsonSerializer.

        Parameters:
        jsonSerializer - the JsonSerializer
        Returns:
        the SmartsheetBuilder
      • setBaseURI

        public SmartsheetBuilder setBaseURI​(java.lang.String baseURI)

        Set the base URI.

        Parameters:
        baseURI - the base uri
        Returns:
        the smartsheet builder
      • setAccessToken

        public SmartsheetBuilder setAccessToken​(java.lang.String accessToken)

        Set the access token.

        Parameters:
        accessToken - the access token
        Returns:
        the smartsheet builder
      • setMaxRetryTimeMillis

        public SmartsheetBuilder setMaxRetryTimeMillis​(long maxRetryTimeMillis)

        Store a user provided userCalcBackoff.

        This interface is only valid when the DefaultHttpClient is used.

        Returns:
        the smartsheet builder
      • setAssumedUser

        public SmartsheetBuilder setAssumedUser​(java.lang.String assumedUser)

        Set the assumed user.

        Parameters:
        assumedUser - the assumed user
        Returns:
        the smartsheet builder
      • setChangeAgent

        public SmartsheetBuilder setChangeAgent​(java.lang.String changeAgent)

        Set the assumed user.

        Parameters:
        changeAgent - the identifier to include in the webhooks that result from the changes made using the API
        Returns:
        the smartsheet builder
      • getHttpClient

        public com.smartsheet.api.internal.http.HttpClient getHttpClient()

        Gets the http client.

        Returns:
        the http client
      • getJsonSerializer

        public com.smartsheet.api.internal.json.JsonSerializer getJsonSerializer()

        Gets the json serializer.

        Returns:
        the json serializer
      • getBaseURI

        public java.lang.String getBaseURI()

        Gets the base uri.

        Returns:
        the base uri
      • getAccessToken

        public java.lang.String getAccessToken()

        Gets the access token.

        Returns:
        the access token
      • getAssumedUser

        public java.lang.String getAssumedUser()

        Gets the assumed user.

        Returns:
        the assumed user
      • getDefaultBaseUri

        public static java.lang.String getDefaultBaseUri()

        Gets the default base uri.

        Returns:
        the default base uri
      • getChangeAgent

        public java.lang.String getChangeAgent()

        Gets the Smartsheet Change-Agent

        Returns:
        the change agent
      • build

        public Smartsheet build()

        Build the Smartsheet instance.

        Returns:
        the Smartsheet instance
        Throws:
        java.lang.IllegalStateException - if accessToken isn't set yet.