Skip to content
This repository has been archived by the owner on Sep 9, 2023. It is now read-only.

feat: added ListAccountSummaries method #74

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,80 @@ public final ProvisionAccountTicketResponse provisionAccountTicket(
return stub.provisionAccountTicketCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns summaries of all accounts accessible by the caller.
*
* <p>Sample code:
*
* <pre><code>
* try (AnalyticsAdminServiceClient analyticsAdminServiceClient = AnalyticsAdminServiceClient.create()) {
* ListAccountSummariesRequest request = ListAccountSummariesRequest.newBuilder().build();
* for (AccountSummary element : analyticsAdminServiceClient.listAccountSummaries(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* </code></pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListAccountSummariesPagedResponse listAccountSummaries(
ListAccountSummariesRequest request) {
return listAccountSummariesPagedCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns summaries of all accounts accessible by the caller.
*
* <p>Sample code:
*
* <pre><code>
* try (AnalyticsAdminServiceClient analyticsAdminServiceClient = AnalyticsAdminServiceClient.create()) {
* ListAccountSummariesRequest request = ListAccountSummariesRequest.newBuilder().build();
* ApiFuture&lt;ListAccountSummariesPagedResponse&gt; future = analyticsAdminServiceClient.listAccountSummariesPagedCallable().futureCall(request);
* // Do something
* for (AccountSummary element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* </code></pre>
*/
public final UnaryCallable<ListAccountSummariesRequest, ListAccountSummariesPagedResponse>
listAccountSummariesPagedCallable() {
return stub.listAccountSummariesPagedCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns summaries of all accounts accessible by the caller.
*
* <p>Sample code:
*
* <pre><code>
* try (AnalyticsAdminServiceClient analyticsAdminServiceClient = AnalyticsAdminServiceClient.create()) {
* ListAccountSummariesRequest request = ListAccountSummariesRequest.newBuilder().build();
* while (true) {
* ListAccountSummariesResponse response = analyticsAdminServiceClient.listAccountSummariesCallable().call(request);
* for (AccountSummary element : response.getAccountSummariesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* </code></pre>
*/
public final UnaryCallable<ListAccountSummariesRequest, ListAccountSummariesResponse>
listAccountSummariesCallable() {
return stub.listAccountSummariesCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Lookup for a single "App+Web" Property.
Expand Down Expand Up @@ -4724,6 +4798,95 @@ protected ListAccountsFixedSizeCollection createCollection(
}
}

public static class ListAccountSummariesPagedResponse
extends AbstractPagedListResponse<
ListAccountSummariesRequest,
ListAccountSummariesResponse,
AccountSummary,
ListAccountSummariesPage,
ListAccountSummariesFixedSizeCollection> {

public static ApiFuture<ListAccountSummariesPagedResponse> createAsync(
PageContext<ListAccountSummariesRequest, ListAccountSummariesResponse, AccountSummary>
context,
ApiFuture<ListAccountSummariesResponse> futureResponse) {
ApiFuture<ListAccountSummariesPage> futurePage =
ListAccountSummariesPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
new ApiFunction<ListAccountSummariesPage, ListAccountSummariesPagedResponse>() {
@Override
public ListAccountSummariesPagedResponse apply(ListAccountSummariesPage input) {
return new ListAccountSummariesPagedResponse(input);
}
},
MoreExecutors.directExecutor());
}

private ListAccountSummariesPagedResponse(ListAccountSummariesPage page) {
super(page, ListAccountSummariesFixedSizeCollection.createEmptyCollection());
}
}

public static class ListAccountSummariesPage
extends AbstractPage<
ListAccountSummariesRequest,
ListAccountSummariesResponse,
AccountSummary,
ListAccountSummariesPage> {

private ListAccountSummariesPage(
PageContext<ListAccountSummariesRequest, ListAccountSummariesResponse, AccountSummary>
context,
ListAccountSummariesResponse response) {
super(context, response);
}

private static ListAccountSummariesPage createEmptyPage() {
return new ListAccountSummariesPage(null, null);
}

@Override
protected ListAccountSummariesPage createPage(
PageContext<ListAccountSummariesRequest, ListAccountSummariesResponse, AccountSummary>
context,
ListAccountSummariesResponse response) {
return new ListAccountSummariesPage(context, response);
}

@Override
public ApiFuture<ListAccountSummariesPage> createPageAsync(
PageContext<ListAccountSummariesRequest, ListAccountSummariesResponse, AccountSummary>
context,
ApiFuture<ListAccountSummariesResponse> futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}

public static class ListAccountSummariesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListAccountSummariesRequest,
ListAccountSummariesResponse,
AccountSummary,
ListAccountSummariesPage,
ListAccountSummariesFixedSizeCollection> {

private ListAccountSummariesFixedSizeCollection(
List<ListAccountSummariesPage> pages, int collectionSize) {
super(pages, collectionSize);
}

private static ListAccountSummariesFixedSizeCollection createEmptyCollection() {
return new ListAccountSummariesFixedSizeCollection(null, 0);
}

@Override
protected ListAccountSummariesFixedSizeCollection createCollection(
List<ListAccountSummariesPage> pages, int collectionSize) {
return new ListAccountSummariesFixedSizeCollection(pages, collectionSize);
}
}

public static class ListPropertiesPagedResponse
extends AbstractPagedListResponse<
ListPropertiesRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.google.analytics.admin.v1alpha;

import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.AuditUserLinksPagedResponse;
import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListAccountSummariesPagedResponse;
import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListAccountsPagedResponse;
import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListAndroidAppDataStreamsPagedResponse;
import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListGoogleAdsLinksPagedResponse;
Expand Down Expand Up @@ -103,6 +104,15 @@ public UnaryCallSettings<UpdateAccountRequest, Account> updateAccountSettings()
return ((AnalyticsAdminServiceStubSettings) getStubSettings()).provisionAccountTicketSettings();
}

/** Returns the object with the settings used for calls to listAccountSummaries. */
public PagedCallSettings<
ListAccountSummariesRequest,
ListAccountSummariesResponse,
ListAccountSummariesPagedResponse>
listAccountSummariesSettings() {
return ((AnalyticsAdminServiceStubSettings) getStubSettings()).listAccountSummariesSettings();
}

/** Returns the object with the settings used for calls to getProperty. */
public UnaryCallSettings<GetPropertyRequest, Property> getPropertySettings() {
return ((AnalyticsAdminServiceStubSettings) getStubSettings()).getPropertySettings();
Expand Down Expand Up @@ -481,6 +491,15 @@ public UnaryCallSettings.Builder<UpdateAccountRequest, Account> updateAccountSet
return getStubSettingsBuilder().provisionAccountTicketSettings();
}

/** Returns the builder for the settings used for calls to listAccountSummaries. */
public PagedCallSettings.Builder<
ListAccountSummariesRequest,
ListAccountSummariesResponse,
ListAccountSummariesPagedResponse>
listAccountSummariesSettings() {
return getStubSettingsBuilder().listAccountSummariesSettings();
}

/** Returns the builder for the settings used for calls to getProperty. */
public UnaryCallSettings.Builder<GetPropertyRequest, Property> getPropertySettings() {
return getStubSettingsBuilder().getPropertySettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/**
* A client to Analytics Admin API.
* A client to Google Analytics Admin API.
*
* <p>The interfaces provided are listed below, along with usage samples.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.google.analytics.admin.v1alpha.stub;

import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.AuditUserLinksPagedResponse;
import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListAccountSummariesPagedResponse;
import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListAccountsPagedResponse;
import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListAndroidAppDataStreamsPagedResponse;
import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListGoogleAdsLinksPagedResponse;
Expand Down Expand Up @@ -65,6 +66,8 @@
import com.google.analytics.admin.v1alpha.GlobalSiteTag;
import com.google.analytics.admin.v1alpha.GoogleAdsLink;
import com.google.analytics.admin.v1alpha.IosAppDataStream;
import com.google.analytics.admin.v1alpha.ListAccountSummariesRequest;
import com.google.analytics.admin.v1alpha.ListAccountSummariesResponse;
import com.google.analytics.admin.v1alpha.ListAccountsRequest;
import com.google.analytics.admin.v1alpha.ListAccountsResponse;
import com.google.analytics.admin.v1alpha.ListAndroidAppDataStreamsRequest;
Expand Down Expand Up @@ -103,7 +106,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* Base stub class for Analytics Admin API.
* Base stub class for Google Analytics Admin API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
Expand Down Expand Up @@ -136,6 +139,16 @@ public UnaryCallable<UpdateAccountRequest, Account> updateAccountCallable() {
throw new UnsupportedOperationException("Not implemented: provisionAccountTicketCallable()");
}

public UnaryCallable<ListAccountSummariesRequest, ListAccountSummariesPagedResponse>
listAccountSummariesPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listAccountSummariesPagedCallable()");
}

public UnaryCallable<ListAccountSummariesRequest, ListAccountSummariesResponse>
listAccountSummariesCallable() {
throw new UnsupportedOperationException("Not implemented: listAccountSummariesCallable()");
}

public UnaryCallable<GetPropertyRequest, Property> getPropertyCallable() {
throw new UnsupportedOperationException("Not implemented: getPropertyCallable()");
}
Expand Down
Loading