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\Sheets\Resource; 19 20use Google\Service\Sheets\BatchUpdateSpreadsheetRequest; 21use Google\Service\Sheets\BatchUpdateSpreadsheetResponse; 22use Google\Service\Sheets\GetSpreadsheetByDataFilterRequest; 23use Google\Service\Sheets\Spreadsheet; 24 25/** 26 * The "spreadsheets" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $sheetsService = new Google\Service\Sheets(...); 30 * $spreadsheets = $sheetsService->spreadsheets; 31 * </code> 32 */ 33class Spreadsheets extends \Google\Service\Resource 34{ 35 /** 36 * Applies one or more updates to the spreadsheet. Each request is validated 37 * before being applied. If any request is not valid then the entire request 38 * will fail and nothing will be applied. Some requests have replies to give you 39 * some information about how they are applied. The replies will mirror the 40 * requests. For example, if you applied 4 updates and the 3rd one had a reply, 41 * then the response will have 2 empty replies, the actual reply, and another 42 * empty reply, in that order. Due to the collaborative nature of spreadsheets, 43 * it is not guaranteed that the spreadsheet will reflect exactly your changes 44 * after this completes, however it is guaranteed that the updates in the 45 * request will be applied together atomically. Your changes may be altered with 46 * respect to collaborator changes. If there are no collaborators, the 47 * spreadsheet should reflect your changes. (spreadsheets.batchUpdate) 48 * 49 * @param string $spreadsheetId The spreadsheet to apply the updates to. 50 * @param BatchUpdateSpreadsheetRequest $postBody 51 * @param array $optParams Optional parameters. 52 * @return BatchUpdateSpreadsheetResponse 53 */ 54 public function batchUpdate($spreadsheetId, BatchUpdateSpreadsheetRequest $postBody, $optParams = []) 55 { 56 $params = ['spreadsheetId' => $spreadsheetId, 'postBody' => $postBody]; 57 $params = array_merge($params, $optParams); 58 return $this->call('batchUpdate', [$params], BatchUpdateSpreadsheetResponse::class); 59 } 60 /** 61 * Creates a spreadsheet, returning the newly created spreadsheet. 62 * (spreadsheets.create) 63 * 64 * @param Spreadsheet $postBody 65 * @param array $optParams Optional parameters. 66 * @return Spreadsheet 67 */ 68 public function create(Spreadsheet $postBody, $optParams = []) 69 { 70 $params = ['postBody' => $postBody]; 71 $params = array_merge($params, $optParams); 72 return $this->call('create', [$params], Spreadsheet::class); 73 } 74 /** 75 * Returns the spreadsheet at the given ID. The caller must specify the 76 * spreadsheet ID. By default, data within grids is not returned. You can 77 * include grid data in one of 2 ways: * Specify a field mask listing your 78 * desired fields using the `fields` URL parameter in HTTP * Set the 79 * includeGridData URL parameter to true. If a field mask is set, the 80 * `includeGridData` parameter is ignored For large spreadsheets, as a best 81 * practice, retrieve only the specific spreadsheet fields that you want. To 82 * retrieve only subsets of spreadsheet data, use the ranges URL parameter. 83 * Ranges are specified using [A1 notation](/sheets/api/guides/concepts#cell). 84 * You can define a single cell (for example, `A1`) or multiple cells (for 85 * example, `A1:D5`). You can also get cells from other sheets within the same 86 * spreadsheet (for example, `Sheet2!A1:C4`) or retrieve multiple ranges at once 87 * (for example, `?ranges=A1:D5=Sheet2!A1:C4`). Limiting the range returns only 88 * the portions of the spreadsheet that intersect the requested ranges. 89 * (spreadsheets.get) 90 * 91 * @param string $spreadsheetId The spreadsheet to request. 92 * @param array $optParams Optional parameters. 93 * 94 * @opt_param bool includeGridData True if grid data should be returned. This 95 * parameter is ignored if a field mask was set in the request. 96 * @opt_param string ranges The ranges to retrieve from the spreadsheet. 97 * @return Spreadsheet 98 */ 99 public function get($spreadsheetId, $optParams = []) 100 { 101 $params = ['spreadsheetId' => $spreadsheetId]; 102 $params = array_merge($params, $optParams); 103 return $this->call('get', [$params], Spreadsheet::class); 104 } 105 /** 106 * Returns the spreadsheet at the given ID. The caller must specify the 107 * spreadsheet ID. This method differs from GetSpreadsheet in that it allows 108 * selecting which subsets of spreadsheet data to return by specifying a 109 * dataFilters parameter. Multiple DataFilters can be specified. Specifying one 110 * or more data filters returns the portions of the spreadsheet that intersect 111 * ranges matched by any of the filters. By default, data within grids is not 112 * returned. You can include grid data one of 2 ways: * Specify a field mask 113 * listing your desired fields using the `fields` URL parameter in HTTP * Set 114 * the includeGridData parameter to true. If a field mask is set, the 115 * `includeGridData` parameter is ignored For large spreadsheets, as a best 116 * practice, retrieve only the specific spreadsheet fields that you want. 117 * (spreadsheets.getByDataFilter) 118 * 119 * @param string $spreadsheetId The spreadsheet to request. 120 * @param GetSpreadsheetByDataFilterRequest $postBody 121 * @param array $optParams Optional parameters. 122 * @return Spreadsheet 123 */ 124 public function getByDataFilter($spreadsheetId, GetSpreadsheetByDataFilterRequest $postBody, $optParams = []) 125 { 126 $params = ['spreadsheetId' => $spreadsheetId, 'postBody' => $postBody]; 127 $params = array_merge($params, $optParams); 128 return $this->call('getByDataFilter', [$params], Spreadsheet::class); 129 } 130} 131 132// Adding a class alias for backwards compatibility with the previous class name. 133class_alias(Spreadsheets::class, 'Google_Service_Sheets_Resource_Spreadsheets'); 134