public static class AdWordsSession.Builder extends Object implements Builder<AdWordsSession>
Implementation is not thread-safe.
DEFAULT_CONFIGURATION_FILENAME
Constructor and Description |
---|
Builder()
Constructs an empty builder.
|
Modifier and Type | Method and Description |
---|---|
AdWordsSession |
build()
Builds the
AdWordsSession . |
AdWordsSession.ImmutableAdWordsSession |
buildImmutable()
Builds a thread-safe
AdWordsSession.ImmutableAdWordsSession . |
AdWordsSession.Builder |
enablePartialFailure()
Enables partial failure.
|
AdWordsSession.Builder |
enableValidateOnly()
Enables validate only.
|
AdWordsSession.Builder |
from(org.apache.commons.configuration.Configuration config)
Reads properties from the provided
Configuration object.Known properties: api.adwords.clientCustomerId api.adwords.userAgent api.adwords.developerToken api.adwords.isPartialFailure api.adwords.endpoint api.adwords.reporting.skipHeader api.adwords.reporting.skipColumnHeader api.adwords.reporting.skipSummary |
AdWordsSession.Builder |
fromFile()
Loads credentials from the "ads.properties" file in one of the
following locations according to the following order: in the current directory, in
the user home directory, in the classpath
|
AdWordsSession.Builder |
fromFile(File path)
Populates this builder from a properties file from a specified path.
|
AdWordsSession.Builder |
fromFile(String path)
Populates this builder from a properties file from a specified path.
|
AdWordsSession.Builder |
fromFile(URL path)
Populates this builder from a properties file from a specified path.
|
AdWordsSession.Builder |
withClientCustomerId(String clientCustomerId)
Includes a clientCustomerId.
|
AdWordsSession.Builder |
withDeveloperToken(String developerToken)
Includes a developer token.
|
AdWordsSession.Builder |
withEndpoint(String endpoint)
Override the endpoint server.
|
AdWordsSession.Builder |
withOAuth2Credential(com.google.api.client.auth.oauth2.Credential oAuth2Credential)
Includes OAuth2 credential to be used for OAuth2 authentication.
|
AdWordsSession.Builder |
withReportingConfiguration(ReportingConfiguration reportingConfiguration) |
AdWordsSession.Builder |
withUserAgent(String userAgent)
Includes user agent.
|
public Builder()
AdWordsSession
, use AdWordsSession.newBuilder()
instead.public AdWordsSession.Builder fromFile() throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<AdWordsSession>
com.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.public AdWordsSession.Builder fromFile(String path) throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<AdWordsSession>
path
- the path to try first as a resource, then as a filecom.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.public AdWordsSession.Builder fromFile(File path) throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<AdWordsSession>
path
- the path to load properties fromcom.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.public AdWordsSession.Builder fromFile(URL path) throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<AdWordsSession>
path
- the path to try first as a resource, then as a filecom.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.@CanIgnoreReturnValue public AdWordsSession.Builder from(org.apache.commons.configuration.Configuration config)
Configuration
object.from
in interface Builder<AdWordsSession>
config
- @CanIgnoreReturnValue public AdWordsSession.Builder withOAuth2Credential(com.google.api.client.auth.oauth2.Credential oAuth2Credential)
@CanIgnoreReturnValue public AdWordsSession.Builder withReportingConfiguration(ReportingConfiguration reportingConfiguration)
@CanIgnoreReturnValue public AdWordsSession.Builder withDeveloperToken(String developerToken)
@CanIgnoreReturnValue public AdWordsSession.Builder withUserAgent(String userAgent)
@CanIgnoreReturnValue public AdWordsSession.Builder withEndpoint(String endpoint)
@CanIgnoreReturnValue public AdWordsSession.Builder withClientCustomerId(String clientCustomerId)
@CanIgnoreReturnValue public AdWordsSession.Builder enablePartialFailure()
@CanIgnoreReturnValue public AdWordsSession.Builder enableValidateOnly()
public AdWordsSession build() throws ValidationException
AdWordsSession
.build
in interface Builder<AdWordsSession>
AdWordsSession
ValidationException
- if the attributes of this builder fail validationpublic AdWordsSession.ImmutableAdWordsSession buildImmutable() throws ValidationException
AdWordsSession.ImmutableAdWordsSession
.ImmutableAdWordsSession
ValidationException
- if the attributes of this builder fail validationCopyright © 2022. All Rights Reserved.