com.google.pubsub.v1.Subscription toPb(String projectId) {
   com.google.pubsub.v1.Subscription.Builder builder =
       com.google.pubsub.v1.Subscription.newBuilder();
   builder.setTopic(topic.toPb(projectId));
   builder.setName(SubscriberApi.formatSubscriptionName(projectId, name));
   builder.setAckDeadlineSeconds(ackDeadlineSeconds);
   if (pushConfig != null) {
     builder.setPushConfig(pushConfig.toPb());
   }
   return builder.build();
 }
 static SubscriptionInfo fromPb(com.google.pubsub.v1.Subscription subscription) {
   Builder builder =
       builder(
           TopicId.fromPb(subscription.getTopic()),
           SubscriberApi.parseSubscriptionFromSubscriptionName(subscription.getName()));
   builder.ackDeadLineSeconds(subscription.getAckDeadlineSeconds());
   // A subscription with an "empty" push config is a pull subscription
   if (subscription.hasPushConfig()
       && !subscription.getPushConfig().getPushEndpoint().equals("")) {
     builder.pushConfig(PushConfig.fromPb(subscription.getPushConfig()));
   }
   return builder.build();
 }
 /**
  * Creates a builder for {@code SubscriptionInfo} objects given the name of the topic and the name
  * of the subscription. The topic is assumed to reside in the {@link PubSubOptions#projectId()}
  * project.
  *
  * @param topic the name of the topic the subscription refers to
  * @param name the name of the subscription. The name must start with a letter, and contain only
  *     letters ({@code [A-Za-z]}), numbers ({@code [0-9]}), dashes ({@code -}), underscores
  *     ({@code _}), periods ({@code .}), tildes ({@code ~}), plus ({@code +}) or percent signs
  *     ({@code %}). It must be between 3 and 255 characters in length and cannot begin with the
  *     string {@code goog}.
  */
 public static Builder builder(String topic, String name) {
   return builder(TopicId.of(topic), name);
 }
 @Override
 public Builder topic(String topic) {
   return topic(TopicId.of(topic));
 }
 @Override
 public Builder topic(String project, String topic) {
   return topic(TopicId.of(checkNotNull(project), topic));
 }