Class ApiClientBuilder

java.lang.Object
com.commercetools.api.models.api_client.ApiClientBuilder
All Implemented Interfaces:
Builder<ApiClient>

public class ApiClientBuilder extends Object implements Builder<ApiClient>
ApiClientBuilder
Example to create an instance using the builder pattern

     ApiClient apiClient = ApiClient.builder()
             .id("{id}")
             .name("{name}")
             .scope("{scope}")
             .build()
 
  • Constructor Details

    • ApiClientBuilder

      public ApiClientBuilder()
  • Method Details

    • id

      public ApiClientBuilder id(String id)

      The OAuth2 client_id that can be used to obtain an access token.

      Parameters:
      id - value to be set
      Returns:
      Builder
    • name

      public ApiClientBuilder name(String name)

      Name of the APIClient.

      Parameters:
      name - value to be set
      Returns:
      Builder
    • scope

      public ApiClientBuilder scope(String scope)

      Whitespace-separated list of OAuth scopes that can be used when obtaining an access token.

      Parameters:
      scope - value to be set
      Returns:
      Builder
    • secret

      public ApiClientBuilder secret(@Nullable String secret)

      Only shown once in the response of creating the APIClient. This is the OAuth2 client_secret that can be used to obtain an access token.

      Parameters:
      secret - value to be set
      Returns:
      Builder
    • lastUsedAt

      public ApiClientBuilder lastUsedAt(@Nullable LocalDate lastUsedAt)

      Date of the last day this APIClient was used to obtain an access token.

      Parameters:
      lastUsedAt - value to be set
      Returns:
      Builder
    • deleteAt

      public ApiClientBuilder deleteAt(@Nullable ZonedDateTime deleteAt)

      If set, the Client will be deleted on (or shortly after) this point in time.

      Parameters:
      deleteAt - value to be set
      Returns:
      Builder
    • createdAt

      public ApiClientBuilder createdAt(@Nullable ZonedDateTime createdAt)

      Date and time (UTC) the APIClient was initially created.

      Parameters:
      createdAt - value to be set
      Returns:
      Builder
    • accessTokenValiditySeconds

      public ApiClientBuilder accessTokenValiditySeconds(@Nullable Integer accessTokenValiditySeconds)

      Expiration time in seconds for each access token obtained by the APIClient. Only present when set with the APIClientDraft. If not present the default value applies.

      Parameters:
      accessTokenValiditySeconds - value to be set
      Returns:
      Builder
    • refreshTokenValiditySeconds

      public ApiClientBuilder refreshTokenValiditySeconds(@Nullable Integer refreshTokenValiditySeconds)

      Inactivity expiration time in seconds for each refresh token obtained by the APIClient. Only present when set with the APIClientDraft. If not present the default value applies.

      Parameters:
      refreshTokenValiditySeconds - value to be set
      Returns:
      Builder
    • getId

      public String getId()

      The OAuth2 client_id that can be used to obtain an access token.

      Returns:
      id
    • getName

      public String getName()

      Name of the APIClient.

      Returns:
      name
    • getScope

      public String getScope()

      Whitespace-separated list of OAuth scopes that can be used when obtaining an access token.

      Returns:
      scope
    • getSecret

      @Nullable public String getSecret()

      Only shown once in the response of creating the APIClient. This is the OAuth2 client_secret that can be used to obtain an access token.

      Returns:
      secret
    • getLastUsedAt

      @Nullable public LocalDate getLastUsedAt()

      Date of the last day this APIClient was used to obtain an access token.

      Returns:
      lastUsedAt
    • getDeleteAt

      @Nullable public ZonedDateTime getDeleteAt()

      If set, the Client will be deleted on (or shortly after) this point in time.

      Returns:
      deleteAt
    • getCreatedAt

      @Nullable public ZonedDateTime getCreatedAt()

      Date and time (UTC) the APIClient was initially created.

      Returns:
      createdAt
    • getAccessTokenValiditySeconds

      @Nullable public Integer getAccessTokenValiditySeconds()

      Expiration time in seconds for each access token obtained by the APIClient. Only present when set with the APIClientDraft. If not present the default value applies.

      Returns:
      accessTokenValiditySeconds
    • getRefreshTokenValiditySeconds

      @Nullable public Integer getRefreshTokenValiditySeconds()

      Inactivity expiration time in seconds for each refresh token obtained by the APIClient. Only present when set with the APIClientDraft. If not present the default value applies.

      Returns:
      refreshTokenValiditySeconds
    • build

      public ApiClient build()
      builds ApiClient with checking for non-null required values
      Specified by:
      build in interface Builder<ApiClient>
      Returns:
      ApiClient
    • buildUnchecked

      public ApiClient buildUnchecked()
      builds ApiClient without checking for non-null required values
      Returns:
      ApiClient
    • of

      public static ApiClientBuilder of()
      factory method for an instance of ApiClientBuilder
      Returns:
      builder
    • of

      public static ApiClientBuilder of(ApiClient template)
      create builder for ApiClient instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder