public virtual async Task<BulkResponse> BulkAsync(BulkCommand cmd) { Ensure.That(cmd, "cmd").IsNotNull(); var req = CreateRequest(cmd); var res = SendAsync(req); return await ProcessHttpBulkResponseAsync(res); }
protected virtual HttpRequestMessage CreateRequest(BulkCommand cmd) { var req = new HttpRequest(HttpMethod.Post, GenerateRequestUrl(cmd)); req.SetContent(cmd.ToJson()); return req; }
protected virtual string GenerateRequestUrl(BulkCommand cmd) { return string.Format("{0}/_bulk_docs", Client.Connection.Address); }
public virtual BulkResponse Bulk(BulkCommand cmd) { Ensure.That(cmd, "cmd").IsNotNull(); return BulkAsync(cmd).Result; }