[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\Sheets\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Sheets\BatchUpdateSpreadsheetRequest;
|
---|
| 21 | use Google\Service\Sheets\BatchUpdateSpreadsheetResponse;
|
---|
| 22 | use Google\Service\Sheets\GetSpreadsheetByDataFilterRequest;
|
---|
| 23 | use 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 | */
|
---|
| 33 | class 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 | * @throws \Google\Service\Exception
|
---|
| 54 | */
|
---|
| 55 | public function batchUpdate($spreadsheetId, BatchUpdateSpreadsheetRequest $postBody, $optParams = [])
|
---|
| 56 | {
|
---|
| 57 | $params = ['spreadsheetId' => $spreadsheetId, 'postBody' => $postBody];
|
---|
| 58 | $params = array_merge($params, $optParams);
|
---|
| 59 | return $this->call('batchUpdate', [$params], BatchUpdateSpreadsheetResponse::class);
|
---|
| 60 | }
|
---|
| 61 | /**
|
---|
| 62 | * Creates a spreadsheet, returning the newly created spreadsheet.
|
---|
| 63 | * (spreadsheets.create)
|
---|
| 64 | *
|
---|
| 65 | * @param Spreadsheet $postBody
|
---|
| 66 | * @param array $optParams Optional parameters.
|
---|
| 67 | * @return Spreadsheet
|
---|
| 68 | * @throws \Google\Service\Exception
|
---|
| 69 | */
|
---|
| 70 | public function create(Spreadsheet $postBody, $optParams = [])
|
---|
| 71 | {
|
---|
| 72 | $params = ['postBody' => $postBody];
|
---|
| 73 | $params = array_merge($params, $optParams);
|
---|
| 74 | return $this->call('create', [$params], Spreadsheet::class);
|
---|
| 75 | }
|
---|
| 76 | /**
|
---|
| 77 | * Returns the spreadsheet at the given ID. The caller must specify the
|
---|
| 78 | * spreadsheet ID. By default, data within grids is not returned. You can
|
---|
| 79 | * include grid data in one of 2 ways: * Specify a [field
|
---|
| 80 | * mask](https://developers.google.com/sheets/api/guides/field-masks) listing
|
---|
| 81 | * your desired fields using the `fields` URL parameter in HTTP * Set the
|
---|
| 82 | * includeGridData URL parameter to true. If a field mask is set, the
|
---|
| 83 | * `includeGridData` parameter is ignored For large spreadsheets, as a best
|
---|
| 84 | * practice, retrieve only the specific spreadsheet fields that you want. To
|
---|
| 85 | * retrieve only subsets of spreadsheet data, use the ranges URL parameter.
|
---|
| 86 | * Ranges are specified using [A1 notation](/sheets/api/guides/concepts#cell).
|
---|
| 87 | * You can define a single cell (for example, `A1`) or multiple cells (for
|
---|
| 88 | * example, `A1:D5`). You can also get cells from other sheets within the same
|
---|
| 89 | * spreadsheet (for example, `Sheet2!A1:C4`) or retrieve multiple ranges at once
|
---|
| 90 | * (for example, `?ranges=A1:D5&ranges=Sheet2!A1:C4`). Limiting the range
|
---|
| 91 | * returns only the portions of the spreadsheet that intersect the requested
|
---|
| 92 | * ranges. (spreadsheets.get)
|
---|
| 93 | *
|
---|
| 94 | * @param string $spreadsheetId The spreadsheet to request.
|
---|
| 95 | * @param array $optParams Optional parameters.
|
---|
| 96 | *
|
---|
| 97 | * @opt_param bool includeGridData True if grid data should be returned. This
|
---|
| 98 | * parameter is ignored if a field mask was set in the request.
|
---|
| 99 | * @opt_param string ranges The ranges to retrieve from the spreadsheet.
|
---|
| 100 | * @return Spreadsheet
|
---|
| 101 | * @throws \Google\Service\Exception
|
---|
| 102 | */
|
---|
| 103 | public function get($spreadsheetId, $optParams = [])
|
---|
| 104 | {
|
---|
| 105 | $params = ['spreadsheetId' => $spreadsheetId];
|
---|
| 106 | $params = array_merge($params, $optParams);
|
---|
| 107 | return $this->call('get', [$params], Spreadsheet::class);
|
---|
| 108 | }
|
---|
| 109 | /**
|
---|
| 110 | * Returns the spreadsheet at the given ID. The caller must specify the
|
---|
| 111 | * spreadsheet ID. This method differs from GetSpreadsheet in that it allows
|
---|
| 112 | * selecting which subsets of spreadsheet data to return by specifying a
|
---|
| 113 | * dataFilters parameter. Multiple DataFilters can be specified. Specifying one
|
---|
| 114 | * or more data filters returns the portions of the spreadsheet that intersect
|
---|
| 115 | * ranges matched by any of the filters. By default, data within grids is not
|
---|
| 116 | * returned. You can include grid data one of 2 ways: * Specify a [field
|
---|
| 117 | * mask](https://developers.google.com/sheets/api/guides/field-masks) listing
|
---|
| 118 | * your desired fields using the `fields` URL parameter in HTTP * Set the
|
---|
| 119 | * includeGridData parameter to true. If a field mask is set, the
|
---|
| 120 | * `includeGridData` parameter is ignored For large spreadsheets, as a best
|
---|
| 121 | * practice, retrieve only the specific spreadsheet fields that you want.
|
---|
| 122 | * (spreadsheets.getByDataFilter)
|
---|
| 123 | *
|
---|
| 124 | * @param string $spreadsheetId The spreadsheet to request.
|
---|
| 125 | * @param GetSpreadsheetByDataFilterRequest $postBody
|
---|
| 126 | * @param array $optParams Optional parameters.
|
---|
| 127 | * @return Spreadsheet
|
---|
| 128 | * @throws \Google\Service\Exception
|
---|
| 129 | */
|
---|
| 130 | public function getByDataFilter($spreadsheetId, GetSpreadsheetByDataFilterRequest $postBody, $optParams = [])
|
---|
| 131 | {
|
---|
| 132 | $params = ['spreadsheetId' => $spreadsheetId, 'postBody' => $postBody];
|
---|
| 133 | $params = array_merge($params, $optParams);
|
---|
| 134 | return $this->call('getByDataFilter', [$params], Spreadsheet::class);
|
---|
| 135 | }
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 139 | class_alias(Spreadsheets::class, 'Google_Service_Sheets_Resource_Spreadsheets');
|
---|