/// <inheritdoc />
        public Task <UnplacedReplicaInformation> GetUnplacedReplicaInformationAsync(
            string serviceId,
            PartitionId partitionId             = default(PartitionId),
            bool?onlyQueryPrimaries             = false,
            long?serverTimeout                  = 60,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            serviceId.ThrowIfNull(nameof(serviceId));
            serverTimeout?.ThrowIfOutOfInclusiveRange("serverTimeout", 1, 4294967295);
            var requestId = Guid.NewGuid().ToString();
            var url       = "Services/{serviceId}/$/GetUnplacedReplicaInformation";

            url = url.Replace("{serviceId}", serviceId);
            var queryParams = new List <string>();

            // Append to queryParams if not null.
            partitionId?.AddToQueryParameters(queryParams, $"PartitionId={partitionId.ToString()}");
            onlyQueryPrimaries?.AddToQueryParameters(queryParams, $"OnlyQueryPrimaries={onlyQueryPrimaries}");
            serverTimeout?.AddToQueryParameters(queryParams, $"timeout={serverTimeout}");
            queryParams.Add("api-version=6.4");
            url += "?" + string.Join("&", queryParams);

            HttpRequestMessage RequestFunc()
            {
                var request = new HttpRequestMessage()
                {
                    Method = HttpMethod.Get,
                };

                return(request);
            }

            return(this.httpClient.SendAsyncGetResponse(RequestFunc, url, UnplacedReplicaInformationConverter.Deserialize, requestId, cancellationToken));
        }
        /// <inheritdoc />
        public Task <IEnumerable <DeployedServiceReplicaInfo> > GetDeployedServiceReplicaInfoListAsync(
            NodeName nodeName,
            string applicationId,
            PartitionId partitionId             = default(PartitionId),
            string serviceManifestName          = default(string),
            long?serverTimeout                  = 60,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            nodeName.ThrowIfNull(nameof(nodeName));
            applicationId.ThrowIfNull(nameof(applicationId));
            serverTimeout?.ThrowIfOutOfInclusiveRange("serverTimeout", 1, 4294967295);
            var requestId = Guid.NewGuid().ToString();
            var url       = "Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetReplicas";

            url = url.Replace("{nodeName}", Uri.EscapeDataString(nodeName.ToString()));
            url = url.Replace("{applicationId}", applicationId);
            var queryParams = new List <string>();

            // Append to queryParams if not null.
            partitionId?.AddToQueryParameters(queryParams, $"PartitionId={partitionId.ToString()}");
            serviceManifestName?.AddToQueryParameters(queryParams, $"ServiceManifestName={serviceManifestName}");
            serverTimeout?.AddToQueryParameters(queryParams, $"timeout={serverTimeout}");
            queryParams.Add("api-version=6.0");
            url += "?" + string.Join("&", queryParams);

            HttpRequestMessage RequestFunc()
            {
                var request = new HttpRequestMessage()
                {
                    Method = HttpMethod.Get,
                };

                return(request);
            }

            return(this.httpClient.SendAsyncGetResponseAsList(RequestFunc, url, DeployedServiceReplicaInfoConverter.Deserialize, requestId, cancellationToken));
        }