Java Code Examples for com.google.api.core.ApiFutures#transform()

The following examples show how to use com.google.api.core.ApiFutures#transform() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CampaignDraftServiceClient.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
public static ApiFuture<ListCampaignDraftAsyncErrorsPagedResponse> createAsync(
    PageContext<
            ListCampaignDraftAsyncErrorsRequest, ListCampaignDraftAsyncErrorsResponse, Status>
        context,
    ApiFuture<ListCampaignDraftAsyncErrorsResponse> futureResponse) {
  ApiFuture<ListCampaignDraftAsyncErrorsPage> futurePage =
      ListCampaignDraftAsyncErrorsPage.createEmptyPage()
          .createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<
          ListCampaignDraftAsyncErrorsPage, ListCampaignDraftAsyncErrorsPagedResponse>() {
        @Override
        public ListCampaignDraftAsyncErrorsPagedResponse apply(
            ListCampaignDraftAsyncErrorsPage input) {
          return new ListCampaignDraftAsyncErrorsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 2
Source File: CampaignExperimentServiceClient.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
public static ApiFuture<ListCampaignExperimentAsyncErrorsPagedResponse> createAsync(
    PageContext<
            ListCampaignExperimentAsyncErrorsRequest, ListCampaignExperimentAsyncErrorsResponse,
            Status>
        context,
    ApiFuture<ListCampaignExperimentAsyncErrorsResponse> futureResponse) {
  ApiFuture<ListCampaignExperimentAsyncErrorsPage> futurePage =
      ListCampaignExperimentAsyncErrorsPage.createEmptyPage()
          .createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<
          ListCampaignExperimentAsyncErrorsPage,
          ListCampaignExperimentAsyncErrorsPagedResponse>() {
        @Override
        public ListCampaignExperimentAsyncErrorsPagedResponse apply(
            ListCampaignExperimentAsyncErrorsPage input) {
          return new ListCampaignExperimentAsyncErrorsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 3
Source File: MutateJobServiceClient.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
public static ApiFuture<ListMutateJobResultsPagedResponse> createAsync(
    PageContext<ListMutateJobResultsRequest, ListMutateJobResultsResponse, MutateJobResult>
        context,
    ApiFuture<ListMutateJobResultsResponse> futureResponse) {
  ApiFuture<ListMutateJobResultsPage> futurePage =
      ListMutateJobResultsPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<ListMutateJobResultsPage, ListMutateJobResultsPagedResponse>() {
        @Override
        public ListMutateJobResultsPagedResponse apply(ListMutateJobResultsPage input) {
          return new ListMutateJobResultsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 4
Source File: CampaignDraftServiceClient.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
public static ApiFuture<ListCampaignDraftAsyncErrorsPagedResponse> createAsync(
    PageContext<
            ListCampaignDraftAsyncErrorsRequest, ListCampaignDraftAsyncErrorsResponse, Status>
        context,
    ApiFuture<ListCampaignDraftAsyncErrorsResponse> futureResponse) {
  ApiFuture<ListCampaignDraftAsyncErrorsPage> futurePage =
      ListCampaignDraftAsyncErrorsPage.createEmptyPage()
          .createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<
          ListCampaignDraftAsyncErrorsPage, ListCampaignDraftAsyncErrorsPagedResponse>() {
        @Override
        public ListCampaignDraftAsyncErrorsPagedResponse apply(
            ListCampaignDraftAsyncErrorsPage input) {
          return new ListCampaignDraftAsyncErrorsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 5
Source File: GoogleAdsFieldServiceClient.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
public static ApiFuture<SearchGoogleAdsFieldsPagedResponse> createAsync(
    PageContext<SearchGoogleAdsFieldsRequest, SearchGoogleAdsFieldsResponse, GoogleAdsField>
        context,
    ApiFuture<SearchGoogleAdsFieldsResponse> futureResponse) {
  ApiFuture<SearchGoogleAdsFieldsPage> futurePage =
      SearchGoogleAdsFieldsPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<SearchGoogleAdsFieldsPage, SearchGoogleAdsFieldsPagedResponse>() {
        @Override
        public SearchGoogleAdsFieldsPagedResponse apply(SearchGoogleAdsFieldsPage input) {
          return new SearchGoogleAdsFieldsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 6
Source File: CampaignExperimentServiceClient.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
public static ApiFuture<ListCampaignExperimentAsyncErrorsPagedResponse> createAsync(
    PageContext<
            ListCampaignExperimentAsyncErrorsRequest, ListCampaignExperimentAsyncErrorsResponse,
            Status>
        context,
    ApiFuture<ListCampaignExperimentAsyncErrorsResponse> futureResponse) {
  ApiFuture<ListCampaignExperimentAsyncErrorsPage> futurePage =
      ListCampaignExperimentAsyncErrorsPage.createEmptyPage()
          .createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<
          ListCampaignExperimentAsyncErrorsPage,
          ListCampaignExperimentAsyncErrorsPagedResponse>() {
        @Override
        public ListCampaignExperimentAsyncErrorsPagedResponse apply(
            ListCampaignExperimentAsyncErrorsPage input) {
          return new ListCampaignExperimentAsyncErrorsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 7
Source File: MutateJobServiceClient.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
public static ApiFuture<ListMutateJobResultsPagedResponse> createAsync(
    PageContext<ListMutateJobResultsRequest, ListMutateJobResultsResponse, MutateJobResult>
        context,
    ApiFuture<ListMutateJobResultsResponse> futureResponse) {
  ApiFuture<ListMutateJobResultsPage> futurePage =
      ListMutateJobResultsPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<ListMutateJobResultsPage, ListMutateJobResultsPagedResponse>() {
        @Override
        public ListMutateJobResultsPagedResponse apply(ListMutateJobResultsPage input) {
          return new ListMutateJobResultsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 8
Source File: CampaignDraftServiceClient.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
public static ApiFuture<ListCampaignDraftAsyncErrorsPagedResponse> createAsync(
    PageContext<
            ListCampaignDraftAsyncErrorsRequest, ListCampaignDraftAsyncErrorsResponse, Status>
        context,
    ApiFuture<ListCampaignDraftAsyncErrorsResponse> futureResponse) {
  ApiFuture<ListCampaignDraftAsyncErrorsPage> futurePage =
      ListCampaignDraftAsyncErrorsPage.createEmptyPage()
          .createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<
          ListCampaignDraftAsyncErrorsPage, ListCampaignDraftAsyncErrorsPagedResponse>() {
        @Override
        public ListCampaignDraftAsyncErrorsPagedResponse apply(
            ListCampaignDraftAsyncErrorsPage input) {
          return new ListCampaignDraftAsyncErrorsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 9
Source File: GoogleAdsFieldServiceClient.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
public static ApiFuture<SearchGoogleAdsFieldsPagedResponse> createAsync(
    PageContext<SearchGoogleAdsFieldsRequest, SearchGoogleAdsFieldsResponse, GoogleAdsField>
        context,
    ApiFuture<SearchGoogleAdsFieldsResponse> futureResponse) {
  ApiFuture<SearchGoogleAdsFieldsPage> futurePage =
      SearchGoogleAdsFieldsPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<SearchGoogleAdsFieldsPage, SearchGoogleAdsFieldsPagedResponse>() {
        @Override
        public SearchGoogleAdsFieldsPagedResponse apply(SearchGoogleAdsFieldsPage input) {
          return new SearchGoogleAdsFieldsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 10
Source File: CampaignExperimentServiceClient.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
public static ApiFuture<ListCampaignExperimentAsyncErrorsPagedResponse> createAsync(
    PageContext<
            ListCampaignExperimentAsyncErrorsRequest, ListCampaignExperimentAsyncErrorsResponse,
            Status>
        context,
    ApiFuture<ListCampaignExperimentAsyncErrorsResponse> futureResponse) {
  ApiFuture<ListCampaignExperimentAsyncErrorsPage> futurePage =
      ListCampaignExperimentAsyncErrorsPage.createEmptyPage()
          .createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<
          ListCampaignExperimentAsyncErrorsPage,
          ListCampaignExperimentAsyncErrorsPagedResponse>() {
        @Override
        public ListCampaignExperimentAsyncErrorsPagedResponse apply(
            ListCampaignExperimentAsyncErrorsPage input) {
          return new ListCampaignExperimentAsyncErrorsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 11
Source File: MutateJobServiceClient.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
public static ApiFuture<ListMutateJobResultsPagedResponse> createAsync(
    PageContext<ListMutateJobResultsRequest, ListMutateJobResultsResponse, MutateJobResult>
        context,
    ApiFuture<ListMutateJobResultsResponse> futureResponse) {
  ApiFuture<ListMutateJobResultsPage> futurePage =
      ListMutateJobResultsPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<ListMutateJobResultsPage, ListMutateJobResultsPagedResponse>() {
        @Override
        public ListMutateJobResultsPagedResponse apply(ListMutateJobResultsPage input) {
          return new ListMutateJobResultsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 12
Source File: ApiCommonOriginalFutureTestHelper.java    From future-converter with Apache License 2.0 5 votes vote down vote up
@Override
public ApiFuture<String> createRunningFuture() {
    return ApiFutures.transform(
        ApiFutures.immediateFuture(""),
        input -> {
            try {
                waitForSignal();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            return AbstractConverterTest.VALUE;
        },
        executorService);
}
 
Example 13
Source File: InternalPhotosLibraryClient.java    From java-photoslibrary with Apache License 2.0 5 votes vote down vote up
public static ApiFuture<ListSharedAlbumsPagedResponse> createAsync(
    PageContext<ListSharedAlbumsRequest, ListSharedAlbumsResponse, Album> context,
    ApiFuture<ListSharedAlbumsResponse> futureResponse) {
  ApiFuture<ListSharedAlbumsPage> futurePage =
      ListSharedAlbumsPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<ListSharedAlbumsPage, ListSharedAlbumsPagedResponse>() {
        @Override
        public ListSharedAlbumsPagedResponse apply(ListSharedAlbumsPage input) {
          return new ListSharedAlbumsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 14
Source File: InternalPhotosLibraryClient.java    From java-photoslibrary with Apache License 2.0 5 votes vote down vote up
public static ApiFuture<ListAlbumsPagedResponse> createAsync(
    PageContext<ListAlbumsRequest, ListAlbumsResponse, Album> context,
    ApiFuture<ListAlbumsResponse> futureResponse) {
  ApiFuture<ListAlbumsPage> futurePage =
      ListAlbumsPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<ListAlbumsPage, ListAlbumsPagedResponse>() {
        @Override
        public ListAlbumsPagedResponse apply(ListAlbumsPage input) {
          return new ListAlbumsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 15
Source File: InternalPhotosLibraryClient.java    From java-photoslibrary with Apache License 2.0 5 votes vote down vote up
public static ApiFuture<ListMediaItemsPagedResponse> createAsync(
    PageContext<ListMediaItemsRequest, ListMediaItemsResponse, MediaItem> context,
    ApiFuture<ListMediaItemsResponse> futureResponse) {
  ApiFuture<ListMediaItemsPage> futurePage =
      ListMediaItemsPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<ListMediaItemsPage, ListMediaItemsPagedResponse>() {
        @Override
        public ListMediaItemsPagedResponse apply(ListMediaItemsPage input) {
          return new ListMediaItemsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 16
Source File: InternalPhotosLibraryClient.java    From java-photoslibrary with Apache License 2.0 5 votes vote down vote up
public static ApiFuture<SearchMediaItemsPagedResponse> createAsync(
    PageContext<SearchMediaItemsRequest, SearchMediaItemsResponse, MediaItem> context,
    ApiFuture<SearchMediaItemsResponse> futureResponse) {
  ApiFuture<SearchMediaItemsPage> futurePage =
      SearchMediaItemsPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<SearchMediaItemsPage, SearchMediaItemsPagedResponse>() {
        @Override
        public SearchMediaItemsPagedResponse apply(SearchMediaItemsPage input) {
          return new SearchMediaItemsPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 17
Source File: GoogleAdsServiceClient.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
public static ApiFuture<SearchPagedResponse> createAsync(
    PageContext<SearchGoogleAdsRequest, SearchGoogleAdsResponse, GoogleAdsRow> context,
    ApiFuture<SearchGoogleAdsResponse> futureResponse) {
  ApiFuture<SearchPage> futurePage =
      SearchPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<SearchPage, SearchPagedResponse>() {
        @Override
        public SearchPagedResponse apply(SearchPage input) {
          return new SearchPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 18
Source File: GoogleAdsServiceClient.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
public static ApiFuture<SearchPagedResponse> createAsync(
    PageContext<SearchGoogleAdsRequest, SearchGoogleAdsResponse, GoogleAdsRow> context,
    ApiFuture<SearchGoogleAdsResponse> futureResponse) {
  ApiFuture<SearchPage> futurePage =
      SearchPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<SearchPage, SearchPagedResponse>() {
        @Override
        public SearchPagedResponse apply(SearchPage input) {
          return new SearchPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 19
Source File: GoogleAdsServiceClient.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
public static ApiFuture<SearchPagedResponse> createAsync(
    PageContext<SearchGoogleAdsRequest, SearchGoogleAdsResponse, GoogleAdsRow> context,
    ApiFuture<SearchGoogleAdsResponse> futureResponse) {
  ApiFuture<SearchPage> futurePage =
      SearchPage.createEmptyPage().createPageAsync(context, futureResponse);
  return ApiFutures.transform(
      futurePage,
      new ApiFunction<SearchPage, SearchPagedResponse>() {
        @Override
        public SearchPagedResponse apply(SearchPage input) {
          return new SearchPagedResponse(input);
        }
      },
      MoreExecutors.directExecutor());
}
 
Example 20
Source File: ImplFirebaseTrampolines.java    From firebase-admin-java with Apache License 2.0 4 votes vote down vote up
public static <V, X> ApiFuture<X> transform(
    ApiFuture<? extends V> input,
    final ApiFunction<? super V, ? extends X> function,
    @NonNull FirebaseApp app) {
  return ApiFutures.transform(input, function, app.getScheduledExecutorService());
}