1<?php 2/* 3 * Copyright 2014 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 * use this file except in compliance with the License. You may obtain a copy of 7 * the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations under 15 * the License. 16 */ 17 18namespace Google\Service\Bigquery\Resource; 19 20use Google\Service\Bigquery\TableDataInsertAllRequest; 21use Google\Service\Bigquery\TableDataInsertAllResponse; 22use Google\Service\Bigquery\TableDataList; 23 24/** 25 * The "tabledata" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $bigqueryService = new Google\Service\Bigquery(...); 29 * $tabledata = $bigqueryService->tabledata; 30 * </code> 31 */ 32class Tabledata extends \Google\Service\Resource 33{ 34 /** 35 * Streams data into BigQuery one record at a time without needing to run a load 36 * job. Requires the WRITER dataset role. (tabledata.insertAll) 37 * 38 * @param string $projectId Project ID of the destination table. 39 * @param string $datasetId Dataset ID of the destination table. 40 * @param string $tableId Table ID of the destination table. 41 * @param TableDataInsertAllRequest $postBody 42 * @param array $optParams Optional parameters. 43 * @return TableDataInsertAllResponse 44 */ 45 public function insertAll($projectId, $datasetId, $tableId, TableDataInsertAllRequest $postBody, $optParams = []) 46 { 47 $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId, 'postBody' => $postBody]; 48 $params = array_merge($params, $optParams); 49 return $this->call('insertAll', [$params], TableDataInsertAllResponse::class); 50 } 51 /** 52 * Retrieves table data from a specified set of rows. Requires the READER 53 * dataset role. (tabledata.listTabledata) 54 * 55 * @param string $projectId Project ID of the table to read 56 * @param string $datasetId Dataset ID of the table to read 57 * @param string $tableId Table ID of the table to read 58 * @param array $optParams Optional parameters. 59 * 60 * @opt_param string maxResults Maximum number of results to return 61 * @opt_param string pageToken Page token, returned by a previous call, 62 * identifying the result set 63 * @opt_param string selectedFields List of fields to return (comma-separated). 64 * If unspecified, all fields are returned 65 * @opt_param string startIndex Zero-based index of the starting row to read 66 * @return TableDataList 67 */ 68 public function listTabledata($projectId, $datasetId, $tableId, $optParams = []) 69 { 70 $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId]; 71 $params = array_merge($params, $optParams); 72 return $this->call('list', [$params], TableDataList::class); 73 } 74} 75 76// Adding a class alias for backwards compatibility with the previous class name. 77class_alias(Tabledata::class, 'Google_Service_Bigquery_Resource_Tabledata'); 78