private Task ReadIndexes(int totalCount) { var url = ("/indexes/?start=" + totalCount + "&pageSize=" + BatchSize).NoCache(); var request = asyncDatabaseCommands.CreateRequest(url, "GET"); return(request.ReadResponseStringAsync() .ContinueOnSuccess(documents => { var array = JArray.Parse(documents); if (array.Count == 0) { output(string.Format("Done with reading indexes, total: {0}", totalCount)); jsonWriter.WriteEndArray(); jsonWriter.WritePropertyName("Docs"); jsonWriter.WriteStartArray(); return ReadDocuments(Guid.Empty, 0); } else { totalCount += array.Count; output(string.Format("Reading batch of {0,3} indexes, read so far: {1,10:#,#}", array.Count, totalCount)); foreach (JToken item in array) { item.WriteTo(jsonWriter); } return ReadIndexes(totalCount); } })); }
protected override async Task <RavenJArray> GetIndexes(int totalCount) { var url = ("/indexes?pageSize=" + SmugglerOptions.BatchSize + "&start=" + totalCount).NoCache(); var request = commands.CreateRequest(url, "GET"); return((RavenJArray)await request.ReadResponseJsonAsync()); }
private static async Task SendOpenSubscriptionRequest(IAsyncDatabaseCommands commands, long id, SubscriptionConnectionOptions options) { using (var request = commands.CreateRequest(string.Format("/subscriptions/open?id={0}&connection={1}", id, options.ConnectionId), "POST")) { try { await request.WriteAsync(RavenJObject.FromObject(options)).ConfigureAwait(false); await request.ExecuteRequestAsync().ConfigureAwait(false); } catch (ErrorResponseException e) { SubscriptionException subscriptionException; if (TryGetSubscriptionException(e, out subscriptionException)) { throw subscriptionException; } throw; } } }
private HttpJsonRequest CreateAcknowledgmentRequest(Etag lastProcessedEtag) { return(commands.CreateRequest(string.Format("/subscriptions/acknowledgeBatch?id={0}&lastEtag={1}&connection={2}", id, lastProcessedEtag, options.ConnectionId), "POST")); }
public static Task EnsureSilverlightStartUpAsync(this IAsyncDatabaseCommands self) { return(self.CreateRequest("/silverlight/ensureStartup", "GET") .ExecuteRequestAsync()); }