public PublisherClientImpl(Publisher.IPublisherClient grpcClient, PublisherSettings settings)
        {
            this.GrpcClient = grpcClient;
            PublisherSettings effectiveSettings = settings ?? PublisherSettings.GetDefault();

            _clientHelper = new ClientHelper(effectiveSettings);
        }
        public PublisherClientImpl(Publisher.IPublisherClient grpcClient, PublisherSettings settings)
        {
            this.GrpcClient = grpcClient;
            PublisherSettings effectiveSettings = settings ?? PublisherSettings.GetDefault();
            IClock            effectiveClock    = effectiveSettings.Clock ?? SystemClock.Instance;

            _clientHelper    = new ClientHelper(effectiveSettings);
            _callCreateTopic = _clientHelper.BuildApiCall <Topic, Topic>(GrpcClient.CreateTopicAsync, GrpcClient.CreateTopic)
                               .WithRetry(effectiveSettings.CreateTopicRetry, effectiveClock, null);
            _callPublish = _clientHelper.BuildApiCall <PublishRequest, PublishResponse>(GrpcClient.PublishAsync, GrpcClient.Publish)
                           .WithRetry(effectiveSettings.PublishRetry, effectiveClock, null);
            _callGetTopic = _clientHelper.BuildApiCall <GetTopicRequest, Topic>(GrpcClient.GetTopicAsync, GrpcClient.GetTopic)
                            .WithRetry(effectiveSettings.GetTopicRetry, effectiveClock, null);
            _callListTopics = _clientHelper.BuildApiCall <ListTopicsRequest, ListTopicsResponse>(GrpcClient.ListTopicsAsync, GrpcClient.ListTopics)
                              .WithRetry(effectiveSettings.ListTopicsRetry, effectiveClock, null);
            _callListTopicSubscriptions = _clientHelper.BuildApiCall <ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse>(GrpcClient.ListTopicSubscriptionsAsync, GrpcClient.ListTopicSubscriptions)
                                          .WithRetry(effectiveSettings.ListTopicSubscriptionsRetry, effectiveClock, null);
            _callDeleteTopic = _clientHelper.BuildApiCall <DeleteTopicRequest, Empty>(GrpcClient.DeleteTopicAsync, GrpcClient.DeleteTopic)
                               .WithRetry(effectiveSettings.DeleteTopicRetry, effectiveClock, null);
        }
 /// <summary>
 /// Wrap a GRPC Publisher client for more convenient use.
 /// </summary>
 /// <param name="grpcClient">A GRPC client to wrap.</param>
 /// <param name="settings">
 /// An optional <see cref="PublisherSettings"/> to configure this wrapper.
 /// If null or not specified, then the default settings are used.
 /// </param>
 /// <returns>A <see cref="PublisherClient"/> that wraps the specified GRPC client.</returns>
 public static PublisherClient ToClient(
     this Publisher.IPublisherClient grpcClient,
     PublisherSettings settings = null
     ) => new PublisherClientImpl(grpcClient, settings);