/// <inheritdoc /> public override void Insert(TableReference tableReference, IEnumerable <InsertRow> rows, InsertOptions options = null) { GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference)); GaxPreconditions.CheckNotNull(rows, nameof(rows)); var body = new TableDataInsertAllRequest { Rows = rows.Select(row => { GaxPreconditions.CheckArgument(row != null, nameof(rows), "Entries must not be null"); return(row.ToRowsData()); }).ToList() }; options?.ModifyRequest(body); var request = Service.Tabledata.InsertAll(body, tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId); var response = request.Execute(); HandleInsertAllResponse(response); }
/// <inheritdoc /> public override async Task InsertAsync(TableReference tableReference, IEnumerable <InsertRow> rows, InsertOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) { GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference)); GaxPreconditions.CheckNotNull(rows, nameof(rows)); var body = new TableDataInsertAllRequest { Rows = rows.Select(row => { GaxPreconditions.CheckArgument(row != null, nameof(rows), "Entries must not be null"); return(row.ToRowsData()); }).ToList() }; options?.ModifyRequest(body); var request = Service.Tabledata.InsertAll(body, tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId); var response = await request.ExecuteAsync(cancellationToken).ConfigureAwait(false); HandleInsertAllResponse(response); }