
com.google.api.services.analytics.Analytics Maven / Gradle / Ivy
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://code.google.com/p/google-apis-client-generator/
* (build: 2014-07-22 21:53:01 UTC)
* on 2014-10-16 at 20:27:00 UTC
* Modify at your own risk.
*/
package com.google.api.services.analytics;
/**
* Service definition for Analytics (v2.4).
*
*
* View and manage your Google Analytics data
*
*
*
* For more information about this service, see the
* API Documentation
*
*
*
* This service uses {@link AnalyticsRequestInitializer} to initialize global parameters via its
* {@link Builder}.
*
*
* @since 1.3
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public class Analytics extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient {
// Note: Leave this static initializer at the top of the file.
static {
com.google.api.client.util.Preconditions.checkState(
com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 &&
com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 15,
"You are currently running with version %s of google-api-client. " +
"You need at least version 1.15 of google-api-client to run version " +
"1.15.0-rc of the Google Analytics API library.", com.google.api.client.googleapis.GoogleUtils.VERSION);
}
/**
* The default encoded root URL of the service. This is determined when the library is generated
* and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_ROOT_URL = "https://www.googleapis.com/";
/**
* The default encoded service path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_SERVICE_PATH = "analytics/v2.4/";
/**
* The default encoded base URL of the service. This is determined when the library is generated
* and normally should not be changed.
*/
public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;
/**
* Constructor.
*
*
* Use {@link Builder} if you need to specify any of the optional parameters.
*
*
* @param transport HTTP transport, which should normally be:
*
* - Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}
* - Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}
* - Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
*
*
* @param jsonFactory JSON factory, which may be:
*
* - Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}
* - Google GSON: {@code com.google.api.client.json.gson.GsonFactory}
* - Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}
*
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Analytics(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
this(new Builder(transport, jsonFactory, httpRequestInitializer));
}
/**
* @param builder builder
*/
Analytics(Builder builder) {
super(builder);
}
@Override
protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest> httpClientRequest) throws java.io.IOException {
super.initialize(httpClientRequest);
}
/**
* An accessor for creating requests from the Data collection.
*
* The typical use is:
*
* {@code Analytics analytics = new Analytics(...);}
* {@code Analytics.Data.List request = analytics.data().list(parameters ...)}
*
*
* @return the resource collection
*/
public Data data() {
return new Data();
}
/**
* The "data" collection of methods.
*/
public class Data {
/**
* Returns Analytics report data for a view (profile).
*
* Create a request for the method "data.get".
*
* This request holds the parameters needed by the the analytics server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param ids Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is the
* Analytics view (profile) ID.
* @param startDate Start date for fetching report data. All requests should specify a start date formatted as YYYY-MM-
* DD.
* @param endDate End date for fetching report data. All requests should specify an end date formatted as YYYY-MM-DD.
* @param metrics A comma-separated list of Analytics metrics. E.g., 'ga:sessions,ga:pageviews'. At least one metric
* must be specified to retrieve a valid Analytics report.
* @return the request
*/
public Get get(java.lang.String ids, java.lang.String startDate, java.lang.String endDate, java.lang.String metrics) throws java.io.IOException {
Get result = new Get(ids, startDate, endDate, metrics);
initialize(result);
return result;
}
public class Get extends AnalyticsRequest {
private static final String REST_PATH = "data";
private final java.util.regex.Pattern IDS_PATTERN =
java.util.regex.Pattern.compile("ga:[0-9]+");
private final java.util.regex.Pattern STARTDATE_PATTERN =
java.util.regex.Pattern.compile("[0-9]{4}-[0-9]{2}-[0-9]{2}");
private final java.util.regex.Pattern ENDDATE_PATTERN =
java.util.regex.Pattern.compile("[0-9]{4}-[0-9]{2}-[0-9]{2}");
private final java.util.regex.Pattern METRICS_PATTERN =
java.util.regex.Pattern.compile("ga:.+");
private final java.util.regex.Pattern SORT_PATTERN =
java.util.regex.Pattern.compile("(-)?ga:.+");
private final java.util.regex.Pattern DIMENSIONS_PATTERN =
java.util.regex.Pattern.compile("(ga:.+)?");
private final java.util.regex.Pattern FILTERS_PATTERN =
java.util.regex.Pattern.compile("ga:.+");
/**
* Returns Analytics report data for a view (profile).
*
* Create a request for the method "data.get".
*
* This request holds the parameters needed by the the analytics server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation.
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @param ids Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is the
* Analytics view (profile) ID.
* @param startDate Start date for fetching report data. All requests should specify a start date formatted as YYYY-MM-
* DD.
* @param endDate End date for fetching report data. All requests should specify an end date formatted as YYYY-MM-DD.
* @param metrics A comma-separated list of Analytics metrics. E.g., 'ga:sessions,ga:pageviews'. At least one metric
* must be specified to retrieve a valid Analytics report.
* @since 1.13
*/
protected Get(java.lang.String ids, java.lang.String startDate, java.lang.String endDate, java.lang.String metrics) {
super(Analytics.this, "GET", REST_PATH, null, Void.class);
this.ids = com.google.api.client.util.Preconditions.checkNotNull(ids, "Required parameter ids must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(IDS_PATTERN.matcher(ids).matches(),
"Parameter ids must conform to the pattern " +
"ga:[0-9]+");
}
this.startDate = com.google.api.client.util.Preconditions.checkNotNull(startDate, "Required parameter startDate must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(STARTDATE_PATTERN.matcher(startDate).matches(),
"Parameter startDate must conform to the pattern " +
"[0-9]{4}-[0-9]{2}-[0-9]{2}");
}
this.endDate = com.google.api.client.util.Preconditions.checkNotNull(endDate, "Required parameter endDate must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(ENDDATE_PATTERN.matcher(endDate).matches(),
"Parameter endDate must conform to the pattern " +
"[0-9]{4}-[0-9]{2}-[0-9]{2}");
}
this.metrics = com.google.api.client.util.Preconditions.checkNotNull(metrics, "Required parameter metrics must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(METRICS_PATTERN.matcher(metrics).matches(),
"Parameter metrics must conform to the pattern " +
"ga:.+");
}
set("alt", "json");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/**
* Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is
* the Analytics view (profile) ID.
*/
@com.google.api.client.util.Key
private java.lang.String ids;
/** Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is the
Analytics view (profile) ID.
*/
public java.lang.String getIds() {
return ids;
}
/**
* Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is
* the Analytics view (profile) ID.
*/
public Get setIds(java.lang.String ids) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(IDS_PATTERN.matcher(ids).matches(),
"Parameter ids must conform to the pattern " +
"ga:[0-9]+");
}
this.ids = ids;
return this;
}
/**
* Start date for fetching report data. All requests should specify a start date formatted as
* YYYY-MM-DD.
*/
@com.google.api.client.util.Key("start-date")
private java.lang.String startDate;
/** Start date for fetching report data. All requests should specify a start date formatted as YYYY-MM-
DD.
*/
public java.lang.String getStartDate() {
return startDate;
}
/**
* Start date for fetching report data. All requests should specify a start date formatted as
* YYYY-MM-DD.
*/
public Get setStartDate(java.lang.String startDate) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(STARTDATE_PATTERN.matcher(startDate).matches(),
"Parameter startDate must conform to the pattern " +
"[0-9]{4}-[0-9]{2}-[0-9]{2}");
}
this.startDate = startDate;
return this;
}
/**
* End date for fetching report data. All requests should specify an end date formatted as
* YYYY-MM-DD.
*/
@com.google.api.client.util.Key("end-date")
private java.lang.String endDate;
/** End date for fetching report data. All requests should specify an end date formatted as YYYY-MM-DD.
*/
public java.lang.String getEndDate() {
return endDate;
}
/**
* End date for fetching report data. All requests should specify an end date formatted as
* YYYY-MM-DD.
*/
public Get setEndDate(java.lang.String endDate) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(ENDDATE_PATTERN.matcher(endDate).matches(),
"Parameter endDate must conform to the pattern " +
"[0-9]{4}-[0-9]{2}-[0-9]{2}");
}
this.endDate = endDate;
return this;
}
/**
* A comma-separated list of Analytics metrics. E.g., 'ga:sessions,ga:pageviews'. At least one
* metric must be specified to retrieve a valid Analytics report.
*/
@com.google.api.client.util.Key
private java.lang.String metrics;
/** A comma-separated list of Analytics metrics. E.g., 'ga:sessions,ga:pageviews'. At least one metric
must be specified to retrieve a valid Analytics report.
*/
public java.lang.String getMetrics() {
return metrics;
}
/**
* A comma-separated list of Analytics metrics. E.g., 'ga:sessions,ga:pageviews'. At least one
* metric must be specified to retrieve a valid Analytics report.
*/
public Get setMetrics(java.lang.String metrics) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(METRICS_PATTERN.matcher(metrics).matches(),
"Parameter metrics must conform to the pattern " +
"ga:.+");
}
this.metrics = metrics;
return this;
}
/** The maximum number of entries to include in this feed. */
@com.google.api.client.util.Key("max-results")
private java.lang.Integer maxResults;
/** The maximum number of entries to include in this feed.
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/** The maximum number of entries to include in this feed. */
public Get setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* A comma-separated list of dimensions or metrics that determine the sort order for the
* report data.
*/
@com.google.api.client.util.Key
private java.lang.String sort;
/** A comma-separated list of dimensions or metrics that determine the sort order for the report data.
*/
public java.lang.String getSort() {
return sort;
}
/**
* A comma-separated list of dimensions or metrics that determine the sort order for the
* report data.
*/
public Get setSort(java.lang.String sort) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(SORT_PATTERN.matcher(sort).matches(),
"Parameter sort must conform to the pattern " +
"(-)?ga:.+");
}
this.sort = sort;
return this;
}
/** A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'. */
@com.google.api.client.util.Key
private java.lang.String dimensions;
/** A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'.
*/
public java.lang.String getDimensions() {
return dimensions;
}
/** A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'. */
public Get setDimensions(java.lang.String dimensions) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(DIMENSIONS_PATTERN.matcher(dimensions).matches(),
"Parameter dimensions must conform to the pattern " +
"(ga:.+)?");
}
this.dimensions = dimensions;
return this;
}
/**
* An index of the first entity to retrieve. Use this parameter as a pagination mechanism
* along with the max-results parameter.
*/
@com.google.api.client.util.Key("start-index")
private java.lang.Integer startIndex;
/** An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with
the max-results parameter.
[minimum: 1]
*/
public java.lang.Integer getStartIndex() {
return startIndex;
}
/**
* An index of the first entity to retrieve. Use this parameter as a pagination mechanism
* along with the max-results parameter.
*/
public Get setStartIndex(java.lang.Integer startIndex) {
this.startIndex = startIndex;
return this;
}
/** An Analytics advanced segment to be applied to the report data. */
@com.google.api.client.util.Key
private java.lang.String segment;
/** An Analytics advanced segment to be applied to the report data.
*/
public java.lang.String getSegment() {
return segment;
}
/** An Analytics advanced segment to be applied to the report data. */
public Get setSegment(java.lang.String segment) {
this.segment = segment;
return this;
}
/**
* A comma-separated list of dimension or metric filters to be applied to the report data.
*/
@com.google.api.client.util.Key
private java.lang.String filters;
/** A comma-separated list of dimension or metric filters to be applied to the report data.
*/
public java.lang.String getFilters() {
return filters;
}
/**
* A comma-separated list of dimension or metric filters to be applied to the report data.
*/
public Get setFilters(java.lang.String filters) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(FILTERS_PATTERN.matcher(filters).matches(),
"Parameter filters must conform to the pattern " +
"ga:.+");
}
this.filters = filters;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Management collection.
*
* The typical use is:
*
* {@code Analytics analytics = new Analytics(...);}
* {@code Analytics.Management.List request = analytics.management().list(parameters ...)}
*
*
* @return the resource collection
*/
public Management management() {
return new Management();
}
/**
* The "management" collection of methods.
*/
public class Management {
/**
* An accessor for creating requests from the Accounts collection.
*
* The typical use is:
*
* {@code Analytics analytics = new Analytics(...);}
* {@code Analytics.Accounts.List request = analytics.accounts().list(parameters ...)}
*
*
* @return the resource collection
*/
public Accounts accounts() {
return new Accounts();
}
/**
* The "accounts" collection of methods.
*/
public class Accounts {
/**
* Lists all accounts to which the user has access.
*
* Create a request for the method "accounts.list".
*
* This request holds the parameters needed by the the analytics server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @return the request
*/
public List list() throws java.io.IOException {
List result = new List();
initialize(result);
return result;
}
public class List extends AnalyticsRequest {
private static final String REST_PATH = "management/accounts";
/**
* Lists all accounts to which the user has access.
*
* Create a request for the method "accounts.list".
*
* This request holds the parameters needed by the the analytics server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @since 1.13
*/
protected List() {
super(Analytics.this, "GET", REST_PATH, null, Void.class);
set("alt", "json");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/** The maximum number of accounts to include in this response. */
@com.google.api.client.util.Key("max-results")
private java.lang.Integer maxResults;
/** The maximum number of accounts to include in this response.
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/** The maximum number of accounts to include in this response. */
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* An index of the first account to retrieve. Use this parameter as a pagination mechanism
* along with the max-results parameter.
*/
@com.google.api.client.util.Key("start-index")
private java.lang.Integer startIndex;
/** An index of the first account to retrieve. Use this parameter as a pagination mechanism along with
the max-results parameter.
[minimum: 1]
*/
public java.lang.Integer getStartIndex() {
return startIndex;
}
/**
* An index of the first account to retrieve. Use this parameter as a pagination mechanism
* along with the max-results parameter.
*/
public List setStartIndex(java.lang.Integer startIndex) {
this.startIndex = startIndex;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Goals collection.
*
* The typical use is:
*
* {@code Analytics analytics = new Analytics(...);}
* {@code Analytics.Goals.List request = analytics.goals().list(parameters ...)}
*
*
* @return the resource collection
*/
public Goals goals() {
return new Goals();
}
/**
* The "goals" collection of methods.
*/
public class Goals {
/**
* Lists goals to which the user has access.
*
* Create a request for the method "goals.list".
*
* This request holds the parameters needed by the the analytics server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param accountId Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to all
* the accounts that user has access to.
* @param webPropertyId Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which
* refers to all the web properties that user has access to.
* @param profileId View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or '~all', which
* refers to all the views (profiles) that user has access to.
* @return the request
*/
public List list(java.lang.String accountId, java.lang.String webPropertyId, java.lang.String profileId) throws java.io.IOException {
List result = new List(accountId, webPropertyId, profileId);
initialize(result);
return result;
}
public class List extends AnalyticsRequest {
private static final String REST_PATH = "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals";
/**
* Lists goals to which the user has access.
*
* Create a request for the method "goals.list".
*
* This request holds the parameters needed by the the analytics server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @param accountId Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to all
* the accounts that user has access to.
* @param webPropertyId Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which
* refers to all the web properties that user has access to.
* @param profileId View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or '~all', which
* refers to all the views (profiles) that user has access to.
* @since 1.13
*/
protected List(java.lang.String accountId, java.lang.String webPropertyId, java.lang.String profileId) {
super(Analytics.this, "GET", REST_PATH, null, Void.class);
this.accountId = com.google.api.client.util.Preconditions.checkNotNull(accountId, "Required parameter accountId must be specified.");
this.webPropertyId = com.google.api.client.util.Preconditions.checkNotNull(webPropertyId, "Required parameter webPropertyId must be specified.");
this.profileId = com.google.api.client.util.Preconditions.checkNotNull(profileId, "Required parameter profileId must be specified.");
set("alt", "json");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* Account ID to retrieve goals for. Can either be a specific account ID or '~all', which
* refers to all the accounts that user has access to.
*/
@com.google.api.client.util.Key
private java.lang.String accountId;
/** Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to
all the accounts that user has access to.
*/
public java.lang.String getAccountId() {
return accountId;
}
/**
* Account ID to retrieve goals for. Can either be a specific account ID or '~all', which
* refers to all the accounts that user has access to.
*/
public List setAccountId(java.lang.String accountId) {
this.accountId = accountId;
return this;
}
/**
* Web property ID to retrieve goals for. Can either be a specific web property ID or
* '~all', which refers to all the web properties that user has access to.
*/
@com.google.api.client.util.Key
private java.lang.String webPropertyId;
/** Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which
refers to all the web properties that user has access to.
*/
public java.lang.String getWebPropertyId() {
return webPropertyId;
}
/**
* Web property ID to retrieve goals for. Can either be a specific web property ID or
* '~all', which refers to all the web properties that user has access to.
*/
public List setWebPropertyId(java.lang.String webPropertyId) {
this.webPropertyId = webPropertyId;
return this;
}
/**
* View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or
* '~all', which refers to all the views (profiles) that user has access to.
*/
@com.google.api.client.util.Key
private java.lang.String profileId;
/** View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or '~all',
which refers to all the views (profiles) that user has access to.
*/
public java.lang.String getProfileId() {
return profileId;
}
/**
* View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or
* '~all', which refers to all the views (profiles) that user has access to.
*/
public List setProfileId(java.lang.String profileId) {
this.profileId = profileId;
return this;
}
/** The maximum number of goals to include in this response. */
@com.google.api.client.util.Key("max-results")
private java.lang.Integer maxResults;
/** The maximum number of goals to include in this response.
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/** The maximum number of goals to include in this response. */
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* An index of the first goal to retrieve. Use this parameter as a pagination mechanism
* along with the max-results parameter.
*/
@com.google.api.client.util.Key("start-index")
private java.lang.Integer startIndex;
/** An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the
max-results parameter.
[minimum: 1]
*/
public java.lang.Integer getStartIndex() {
return startIndex;
}
/**
* An index of the first goal to retrieve. Use this parameter as a pagination mechanism
* along with the max-results parameter.
*/
public List setStartIndex(java.lang.Integer startIndex) {
this.startIndex = startIndex;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Profiles collection.
*
* The typical use is:
*
* {@code Analytics analytics = new Analytics(...);}
* {@code Analytics.Profiles.List request = analytics.profiles().list(parameters ...)}
*
*
* @return the resource collection
*/
public Profiles profiles() {
return new Profiles();
}
/**
* The "profiles" collection of methods.
*/
public class Profiles {
/**
* Lists views (profiles) to which the user has access.
*
* Create a request for the method "profiles.list".
*
* This request holds the parameters needed by the the analytics server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param accountId Account ID for the views (profiles) to retrieve. Can either be a specific account ID or '~all',
* which refers to all the accounts to which the user has access.
* @param webPropertyId Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or
* '~all', which refers to all the web properties to which the user has access.
* @return the request
*/
public List list(java.lang.String accountId, java.lang.String webPropertyId) throws java.io.IOException {
List result = new List(accountId, webPropertyId);
initialize(result);
return result;
}
public class List extends AnalyticsRequest {
private static final String REST_PATH = "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles";
/**
* Lists views (profiles) to which the user has access.
*
* Create a request for the method "profiles.list".
*
* This request holds the parameters needed by the the analytics server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @param accountId Account ID for the views (profiles) to retrieve. Can either be a specific account ID or '~all',
* which refers to all the accounts to which the user has access.
* @param webPropertyId Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or
* '~all', which refers to all the web properties to which the user has access.
* @since 1.13
*/
protected List(java.lang.String accountId, java.lang.String webPropertyId) {
super(Analytics.this, "GET", REST_PATH, null, Void.class);
this.accountId = com.google.api.client.util.Preconditions.checkNotNull(accountId, "Required parameter accountId must be specified.");
this.webPropertyId = com.google.api.client.util.Preconditions.checkNotNull(webPropertyId, "Required parameter webPropertyId must be specified.");
set("alt", "json");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* Account ID for the views (profiles) to retrieve. Can either be a specific account ID or
* '~all', which refers to all the accounts to which the user has access.
*/
@com.google.api.client.util.Key
private java.lang.String accountId;
/** Account ID for the views (profiles) to retrieve. Can either be a specific account ID or '~all',
which refers to all the accounts to which the user has access.
*/
public java.lang.String getAccountId() {
return accountId;
}
/**
* Account ID for the views (profiles) to retrieve. Can either be a specific account ID or
* '~all', which refers to all the accounts to which the user has access.
*/
public List setAccountId(java.lang.String accountId) {
this.accountId = accountId;
return this;
}
/**
* Web property ID for the views (profiles) to retrieve. Can either be a specific web
* property ID or '~all', which refers to all the web properties to which the user has
* access.
*/
@com.google.api.client.util.Key
private java.lang.String webPropertyId;
/** Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or
'~all', which refers to all the web properties to which the user has access.
*/
public java.lang.String getWebPropertyId() {
return webPropertyId;
}
/**
* Web property ID for the views (profiles) to retrieve. Can either be a specific web
* property ID or '~all', which refers to all the web properties to which the user has
* access.
*/
public List setWebPropertyId(java.lang.String webPropertyId) {
this.webPropertyId = webPropertyId;
return this;
}
/** The maximum number of views (profiles) to include in this response. */
@com.google.api.client.util.Key("max-results")
private java.lang.Integer maxResults;
/** The maximum number of views (profiles) to include in this response.
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/** The maximum number of views (profiles) to include in this response. */
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* An index of the first entity to retrieve. Use this parameter as a pagination mechanism
* along with the max-results parameter.
*/
@com.google.api.client.util.Key("start-index")
private java.lang.Integer startIndex;
/** An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with
the max-results parameter.
[minimum: 1]
*/
public java.lang.Integer getStartIndex() {
return startIndex;
}
/**
* An index of the first entity to retrieve. Use this parameter as a pagination mechanism
* along with the max-results parameter.
*/
public List setStartIndex(java.lang.Integer startIndex) {
this.startIndex = startIndex;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Segments collection.
*
* The typical use is:
*
* {@code Analytics analytics = new Analytics(...);}
* {@code Analytics.Segments.List request = analytics.segments().list(parameters ...)}
*
*
* @return the resource collection
*/
public Segments segments() {
return new Segments();
}
/**
* The "segments" collection of methods.
*/
public class Segments {
/**
* Lists advanced segments to which the user has access.
*
* Create a request for the method "segments.list".
*
* This request holds the parameters needed by the the analytics server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @return the request
*/
public List list() throws java.io.IOException {
List result = new List();
initialize(result);
return result;
}
public class List extends AnalyticsRequest {
private static final String REST_PATH = "management/segments";
/**
* Lists advanced segments to which the user has access.
*
* Create a request for the method "segments.list".
*
* This request holds the parameters needed by the the analytics server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @since 1.13
*/
protected List() {
super(Analytics.this, "GET", REST_PATH, null, Void.class);
set("alt", "json");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/** The maximum number of advanced segments to include in this response. */
@com.google.api.client.util.Key("max-results")
private java.lang.Integer maxResults;
/** The maximum number of advanced segments to include in this response.
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/** The maximum number of advanced segments to include in this response. */
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* An index of the first advanced segment to retrieve. Use this parameter as a pagination
* mechanism along with the max-results parameter.
*/
@com.google.api.client.util.Key("start-index")
private java.lang.Integer startIndex;
/** An index of the first advanced segment to retrieve. Use this parameter as a pagination mechanism
along with the max-results parameter.
[minimum: 1]
*/
public java.lang.Integer getStartIndex() {
return startIndex;
}
/**
* An index of the first advanced segment to retrieve. Use this parameter as a pagination
* mechanism along with the max-results parameter.
*/
public List setStartIndex(java.lang.Integer startIndex) {
this.startIndex = startIndex;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Webproperties collection.
*
* The typical use is:
*
* {@code Analytics analytics = new Analytics(...);}
* {@code Analytics.Webproperties.List request = analytics.webproperties().list(parameters ...)}
*
*
* @return the resource collection
*/
public Webproperties webproperties() {
return new Webproperties();
}
/**
* The "webproperties" collection of methods.
*/
public class Webproperties {
/**
* Lists web properties to which the user has access.
*
* Create a request for the method "webproperties.list".
*
* This request holds the parameters needed by the the analytics server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param accountId Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which
* refers to all the accounts that user has access to.
* @return the request
*/
public List list(java.lang.String accountId) throws java.io.IOException {
List result = new List(accountId);
initialize(result);
return result;
}
public class List extends AnalyticsRequest {
private static final String REST_PATH = "management/accounts/{accountId}/webproperties";
/**
* Lists web properties to which the user has access.
*
* Create a request for the method "webproperties.list".
*
* This request holds the parameters needed by the the analytics server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @param accountId Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which
* refers to all the accounts that user has access to.
* @since 1.13
*/
protected List(java.lang.String accountId) {
super(Analytics.this, "GET", REST_PATH, null, Void.class);
this.accountId = com.google.api.client.util.Preconditions.checkNotNull(accountId, "Required parameter accountId must be specified.");
set("alt", "json");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* Account ID to retrieve web properties for. Can either be a specific account ID or '~all',
* which refers to all the accounts that user has access to.
*/
@com.google.api.client.util.Key
private java.lang.String accountId;
/** Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which
refers to all the accounts that user has access to.
*/
public java.lang.String getAccountId() {
return accountId;
}
/**
* Account ID to retrieve web properties for. Can either be a specific account ID or '~all',
* which refers to all the accounts that user has access to.
*/
public List setAccountId(java.lang.String accountId) {
this.accountId = accountId;
return this;
}
/** The maximum number of web properties to include in this response. */
@com.google.api.client.util.Key("max-results")
private java.lang.Integer maxResults;
/** The maximum number of web properties to include in this response.
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/** The maximum number of web properties to include in this response. */
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* An index of the first entity to retrieve. Use this parameter as a pagination mechanism
* along with the max-results parameter.
*/
@com.google.api.client.util.Key("start-index")
private java.lang.Integer startIndex;
/** An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with
the max-results parameter.
[minimum: 1]
*/
public java.lang.Integer getStartIndex() {
return startIndex;
}
/**
* An index of the first entity to retrieve. Use this parameter as a pagination mechanism
* along with the max-results parameter.
*/
public List setStartIndex(java.lang.Integer startIndex) {
this.startIndex = startIndex;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
}
}
/**
* Builder for {@link Analytics}.
*
*
* Implementation is not thread-safe.
*
*
* @since 1.3.0
*/
public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder {
/**
* Returns an instance of a new builder.
*
* @param transport HTTP transport, which should normally be:
*
* - Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}
* - Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}
* - Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
*
*
* @param jsonFactory JSON factory, which may be:
*
* - Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}
* - Google GSON: {@code com.google.api.client.json.gson.GsonFactory}
* - Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}
*
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
super(
transport,
jsonFactory,
DEFAULT_ROOT_URL,
DEFAULT_SERVICE_PATH,
httpRequestInitializer,
false);
}
/** Builds a new instance of {@link Analytics}. */
@Override
public Analytics build() {
return new Analytics(this);
}
@Override
public Builder setRootUrl(String rootUrl) {
return (Builder) super.setRootUrl(rootUrl);
}
@Override
public Builder setServicePath(String servicePath) {
return (Builder) super.setServicePath(servicePath);
}
@Override
public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
return (Builder) super.setHttpRequestInitializer(httpRequestInitializer);
}
@Override
public Builder setApplicationName(String applicationName) {
return (Builder) super.setApplicationName(applicationName);
}
@Override
public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
return (Builder) super.setSuppressPatternChecks(suppressPatternChecks);
}
@Override
public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) {
return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks);
}
@Override
public Builder setSuppressAllChecks(boolean suppressAllChecks) {
return (Builder) super.setSuppressAllChecks(suppressAllChecks);
}
/**
* Set the {@link AnalyticsRequestInitializer}.
*
* @since 1.12
*/
public Builder setAnalyticsRequestInitializer(
AnalyticsRequestInitializer analyticsRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(analyticsRequestInitializer);
}
@Override
public Builder setGoogleClientRequestInitializer(
com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
}
}
}