private java.util.function.Supplier<Map<String, String>> allDestinationLabelsSupplier(
      TokensAndUrlAuthData authData) {
    return () -> {
      ListLabelsResponse response;
      try {
        response = getOrCreateGmail(authData).users().labels().list(USER).execute();
      } catch (IOException e) {
        throw new RuntimeException("Unable to list labels for user", e);
      }
      ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();

      for (Label label : response.getLabels()) {
        // TODO: remove system labels
        builder.put(label.getName(), label.getId());
      }
      return builder.build();
    };
  }
Supplies a mapping of Label Name -> Label Id (in the import account).
extensions/data-transfer/portability-data-transfer-google/src/main/java/org/datatransferproject/datatransfer/google/mail/GoogleMailImporter.java