[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\AppendValuesResponse;
|
---|
| 21 | use Google\Service\Sheets\BatchClearValuesByDataFilterRequest;
|
---|
| 22 | use Google\Service\Sheets\BatchClearValuesByDataFilterResponse;
|
---|
| 23 | use Google\Service\Sheets\BatchClearValuesRequest;
|
---|
| 24 | use Google\Service\Sheets\BatchClearValuesResponse;
|
---|
| 25 | use Google\Service\Sheets\BatchGetValuesByDataFilterRequest;
|
---|
| 26 | use Google\Service\Sheets\BatchGetValuesByDataFilterResponse;
|
---|
| 27 | use Google\Service\Sheets\BatchGetValuesResponse;
|
---|
| 28 | use Google\Service\Sheets\BatchUpdateValuesByDataFilterRequest;
|
---|
| 29 | use Google\Service\Sheets\BatchUpdateValuesByDataFilterResponse;
|
---|
| 30 | use Google\Service\Sheets\BatchUpdateValuesRequest;
|
---|
| 31 | use Google\Service\Sheets\BatchUpdateValuesResponse;
|
---|
| 32 | use Google\Service\Sheets\ClearValuesRequest;
|
---|
| 33 | use Google\Service\Sheets\ClearValuesResponse;
|
---|
| 34 | use Google\Service\Sheets\UpdateValuesResponse;
|
---|
| 35 | use Google\Service\Sheets\ValueRange;
|
---|
| 36 |
|
---|
| 37 | /**
|
---|
| 38 | * The "values" collection of methods.
|
---|
| 39 | * Typical usage is:
|
---|
| 40 | * <code>
|
---|
| 41 | * $sheetsService = new Google\Service\Sheets(...);
|
---|
| 42 | * $values = $sheetsService->spreadsheets_values;
|
---|
| 43 | * </code>
|
---|
| 44 | */
|
---|
| 45 | class SpreadsheetsValues extends \Google\Service\Resource
|
---|
| 46 | {
|
---|
| 47 | /**
|
---|
| 48 | * Appends values to a spreadsheet. The input range is used to search for
|
---|
| 49 | * existing data and find a "table" within that range. Values will be appended
|
---|
| 50 | * to the next row of the table, starting with the first column of the table.
|
---|
| 51 | * See the [guide](/sheets/api/guides/values#appending_values) and [sample
|
---|
| 52 | * code](/sheets/api/samples/writing#append_values) for specific details of how
|
---|
| 53 | * tables are detected and data is appended. The caller must specify the
|
---|
| 54 | * spreadsheet ID, range, and a valueInputOption. The `valueInputOption` only
|
---|
| 55 | * controls how the input data will be added to the sheet (column-wise or row-
|
---|
| 56 | * wise), it does not influence what cell the data starts being written to.
|
---|
| 57 | * (values.append)
|
---|
| 58 | *
|
---|
| 59 | * @param string $spreadsheetId The ID of the spreadsheet to update.
|
---|
| 60 | * @param string $range The [A1 notation](/sheets/api/guides/concepts#cell) of a
|
---|
| 61 | * range to search for a logical table of data. Values are appended after the
|
---|
| 62 | * last row of the table.
|
---|
| 63 | * @param ValueRange $postBody
|
---|
| 64 | * @param array $optParams Optional parameters.
|
---|
| 65 | *
|
---|
| 66 | * @opt_param bool includeValuesInResponse Determines if the update response
|
---|
| 67 | * should include the values of the cells that were appended. By default,
|
---|
| 68 | * responses do not include the updated values.
|
---|
| 69 | * @opt_param string insertDataOption How the input data should be inserted.
|
---|
| 70 | * @opt_param string responseDateTimeRenderOption Determines how dates, times,
|
---|
| 71 | * and durations in the response should be rendered. This is ignored if
|
---|
| 72 | * response_value_render_option is FORMATTED_VALUE. The default dateTime render
|
---|
| 73 | * option is SERIAL_NUMBER.
|
---|
| 74 | * @opt_param string responseValueRenderOption Determines how values in the
|
---|
| 75 | * response should be rendered. The default render option is FORMATTED_VALUE.
|
---|
| 76 | * @opt_param string valueInputOption How the input data should be interpreted.
|
---|
| 77 | * @return AppendValuesResponse
|
---|
| 78 | * @throws \Google\Service\Exception
|
---|
| 79 | */
|
---|
| 80 | public function append($spreadsheetId, $range, ValueRange $postBody, $optParams = [])
|
---|
| 81 | {
|
---|
| 82 | $params = ['spreadsheetId' => $spreadsheetId, 'range' => $range, 'postBody' => $postBody];
|
---|
| 83 | $params = array_merge($params, $optParams);
|
---|
| 84 | return $this->call('append', [$params], AppendValuesResponse::class);
|
---|
| 85 | }
|
---|
| 86 | /**
|
---|
| 87 | * Clears one or more ranges of values from a spreadsheet. The caller must
|
---|
| 88 | * specify the spreadsheet ID and one or more ranges. Only values are cleared --
|
---|
| 89 | * all other properties of the cell (such as formatting and data validation) are
|
---|
| 90 | * kept. (values.batchClear)
|
---|
| 91 | *
|
---|
| 92 | * @param string $spreadsheetId The ID of the spreadsheet to update.
|
---|
| 93 | * @param BatchClearValuesRequest $postBody
|
---|
| 94 | * @param array $optParams Optional parameters.
|
---|
| 95 | * @return BatchClearValuesResponse
|
---|
| 96 | * @throws \Google\Service\Exception
|
---|
| 97 | */
|
---|
| 98 | public function batchClear($spreadsheetId, BatchClearValuesRequest $postBody, $optParams = [])
|
---|
| 99 | {
|
---|
| 100 | $params = ['spreadsheetId' => $spreadsheetId, 'postBody' => $postBody];
|
---|
| 101 | $params = array_merge($params, $optParams);
|
---|
| 102 | return $this->call('batchClear', [$params], BatchClearValuesResponse::class);
|
---|
| 103 | }
|
---|
| 104 | /**
|
---|
| 105 | * Clears one or more ranges of values from a spreadsheet. The caller must
|
---|
| 106 | * specify the spreadsheet ID and one or more DataFilters. Ranges matching any
|
---|
| 107 | * of the specified data filters will be cleared. Only values are cleared -- all
|
---|
| 108 | * other properties of the cell (such as formatting, data validation, etc..) are
|
---|
| 109 | * kept. (values.batchClearByDataFilter)
|
---|
| 110 | *
|
---|
| 111 | * @param string $spreadsheetId The ID of the spreadsheet to update.
|
---|
| 112 | * @param BatchClearValuesByDataFilterRequest $postBody
|
---|
| 113 | * @param array $optParams Optional parameters.
|
---|
| 114 | * @return BatchClearValuesByDataFilterResponse
|
---|
| 115 | * @throws \Google\Service\Exception
|
---|
| 116 | */
|
---|
| 117 | public function batchClearByDataFilter($spreadsheetId, BatchClearValuesByDataFilterRequest $postBody, $optParams = [])
|
---|
| 118 | {
|
---|
| 119 | $params = ['spreadsheetId' => $spreadsheetId, 'postBody' => $postBody];
|
---|
| 120 | $params = array_merge($params, $optParams);
|
---|
| 121 | return $this->call('batchClearByDataFilter', [$params], BatchClearValuesByDataFilterResponse::class);
|
---|
| 122 | }
|
---|
| 123 | /**
|
---|
| 124 | * Returns one or more ranges of values from a spreadsheet. The caller must
|
---|
| 125 | * specify the spreadsheet ID and one or more ranges. (values.batchGet)
|
---|
| 126 | *
|
---|
| 127 | * @param string $spreadsheetId The ID of the spreadsheet to retrieve data from.
|
---|
| 128 | * @param array $optParams Optional parameters.
|
---|
| 129 | *
|
---|
| 130 | * @opt_param string dateTimeRenderOption How dates, times, and durations should
|
---|
| 131 | * be represented in the output. This is ignored if value_render_option is
|
---|
| 132 | * FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.
|
---|
| 133 | * @opt_param string majorDimension The major dimension that results should use.
|
---|
| 134 | * For example, if the spreadsheet data is: `A1=1,B1=2,A2=3,B2=4`, then
|
---|
| 135 | * requesting `ranges=["A1:B2"],majorDimension=ROWS` returns `[[1,2],[3,4]]`,
|
---|
| 136 | * whereas requesting `ranges=["A1:B2"],majorDimension=COLUMNS` returns
|
---|
| 137 | * `[[1,3],[2,4]]`.
|
---|
| 138 | * @opt_param string ranges The [A1 notation or R1C1
|
---|
| 139 | * notation](/sheets/api/guides/concepts#cell) of the range to retrieve values
|
---|
| 140 | * from.
|
---|
| 141 | * @opt_param string valueRenderOption How values should be represented in the
|
---|
| 142 | * output. The default render option is ValueRenderOption.FORMATTED_VALUE.
|
---|
| 143 | * @return BatchGetValuesResponse
|
---|
| 144 | * @throws \Google\Service\Exception
|
---|
| 145 | */
|
---|
| 146 | public function batchGet($spreadsheetId, $optParams = [])
|
---|
| 147 | {
|
---|
| 148 | $params = ['spreadsheetId' => $spreadsheetId];
|
---|
| 149 | $params = array_merge($params, $optParams);
|
---|
| 150 | return $this->call('batchGet', [$params], BatchGetValuesResponse::class);
|
---|
| 151 | }
|
---|
| 152 | /**
|
---|
| 153 | * Returns one or more ranges of values that match the specified data filters.
|
---|
| 154 | * The caller must specify the spreadsheet ID and one or more DataFilters.
|
---|
| 155 | * Ranges that match any of the data filters in the request will be returned.
|
---|
| 156 | * (values.batchGetByDataFilter)
|
---|
| 157 | *
|
---|
| 158 | * @param string $spreadsheetId The ID of the spreadsheet to retrieve data from.
|
---|
| 159 | * @param BatchGetValuesByDataFilterRequest $postBody
|
---|
| 160 | * @param array $optParams Optional parameters.
|
---|
| 161 | * @return BatchGetValuesByDataFilterResponse
|
---|
| 162 | * @throws \Google\Service\Exception
|
---|
| 163 | */
|
---|
| 164 | public function batchGetByDataFilter($spreadsheetId, BatchGetValuesByDataFilterRequest $postBody, $optParams = [])
|
---|
| 165 | {
|
---|
| 166 | $params = ['spreadsheetId' => $spreadsheetId, 'postBody' => $postBody];
|
---|
| 167 | $params = array_merge($params, $optParams);
|
---|
| 168 | return $this->call('batchGetByDataFilter', [$params], BatchGetValuesByDataFilterResponse::class);
|
---|
| 169 | }
|
---|
| 170 | /**
|
---|
| 171 | * Sets values in one or more ranges of a spreadsheet. The caller must specify
|
---|
| 172 | * the spreadsheet ID, a valueInputOption, and one or more ValueRanges.
|
---|
| 173 | * (values.batchUpdate)
|
---|
| 174 | *
|
---|
| 175 | * @param string $spreadsheetId The ID of the spreadsheet to update.
|
---|
| 176 | * @param BatchUpdateValuesRequest $postBody
|
---|
| 177 | * @param array $optParams Optional parameters.
|
---|
| 178 | * @return BatchUpdateValuesResponse
|
---|
| 179 | * @throws \Google\Service\Exception
|
---|
| 180 | */
|
---|
| 181 | public function batchUpdate($spreadsheetId, BatchUpdateValuesRequest $postBody, $optParams = [])
|
---|
| 182 | {
|
---|
| 183 | $params = ['spreadsheetId' => $spreadsheetId, 'postBody' => $postBody];
|
---|
| 184 | $params = array_merge($params, $optParams);
|
---|
| 185 | return $this->call('batchUpdate', [$params], BatchUpdateValuesResponse::class);
|
---|
| 186 | }
|
---|
| 187 | /**
|
---|
| 188 | * Sets values in one or more ranges of a spreadsheet. The caller must specify
|
---|
| 189 | * the spreadsheet ID, a valueInputOption, and one or more
|
---|
| 190 | * DataFilterValueRanges. (values.batchUpdateByDataFilter)
|
---|
| 191 | *
|
---|
| 192 | * @param string $spreadsheetId The ID of the spreadsheet to update.
|
---|
| 193 | * @param BatchUpdateValuesByDataFilterRequest $postBody
|
---|
| 194 | * @param array $optParams Optional parameters.
|
---|
| 195 | * @return BatchUpdateValuesByDataFilterResponse
|
---|
| 196 | * @throws \Google\Service\Exception
|
---|
| 197 | */
|
---|
| 198 | public function batchUpdateByDataFilter($spreadsheetId, BatchUpdateValuesByDataFilterRequest $postBody, $optParams = [])
|
---|
| 199 | {
|
---|
| 200 | $params = ['spreadsheetId' => $spreadsheetId, 'postBody' => $postBody];
|
---|
| 201 | $params = array_merge($params, $optParams);
|
---|
| 202 | return $this->call('batchUpdateByDataFilter', [$params], BatchUpdateValuesByDataFilterResponse::class);
|
---|
| 203 | }
|
---|
| 204 | /**
|
---|
| 205 | * Clears values from a spreadsheet. The caller must specify the spreadsheet ID
|
---|
| 206 | * and range. Only values are cleared -- all other properties of the cell (such
|
---|
| 207 | * as formatting, data validation, etc..) are kept. (values.clear)
|
---|
| 208 | *
|
---|
| 209 | * @param string $spreadsheetId The ID of the spreadsheet to update.
|
---|
| 210 | * @param string $range The [A1 notation or R1C1
|
---|
| 211 | * notation](/sheets/api/guides/concepts#cell) of the values to clear.
|
---|
| 212 | * @param ClearValuesRequest $postBody
|
---|
| 213 | * @param array $optParams Optional parameters.
|
---|
| 214 | * @return ClearValuesResponse
|
---|
| 215 | * @throws \Google\Service\Exception
|
---|
| 216 | */
|
---|
| 217 | public function clear($spreadsheetId, $range, ClearValuesRequest $postBody, $optParams = [])
|
---|
| 218 | {
|
---|
| 219 | $params = ['spreadsheetId' => $spreadsheetId, 'range' => $range, 'postBody' => $postBody];
|
---|
| 220 | $params = array_merge($params, $optParams);
|
---|
| 221 | return $this->call('clear', [$params], ClearValuesResponse::class);
|
---|
| 222 | }
|
---|
| 223 | /**
|
---|
| 224 | * Returns a range of values from a spreadsheet. The caller must specify the
|
---|
| 225 | * spreadsheet ID and a range. (values.get)
|
---|
| 226 | *
|
---|
| 227 | * @param string $spreadsheetId The ID of the spreadsheet to retrieve data from.
|
---|
| 228 | * @param string $range The [A1 notation or R1C1
|
---|
| 229 | * notation](/sheets/api/guides/concepts#cell) of the range to retrieve values
|
---|
| 230 | * from.
|
---|
| 231 | * @param array $optParams Optional parameters.
|
---|
| 232 | *
|
---|
| 233 | * @opt_param string dateTimeRenderOption How dates, times, and durations should
|
---|
| 234 | * be represented in the output. This is ignored if value_render_option is
|
---|
| 235 | * FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.
|
---|
| 236 | * @opt_param string majorDimension The major dimension that results should use.
|
---|
| 237 | * For example, if the spreadsheet data in Sheet1 is: `A1=1,B1=2,A2=3,B2=4`,
|
---|
| 238 | * then requesting `range=Sheet1!A1:B2?majorDimension=ROWS` returns
|
---|
| 239 | * `[[1,2],[3,4]]`, whereas requesting
|
---|
| 240 | * `range=Sheet1!A1:B2?majorDimension=COLUMNS` returns `[[1,3],[2,4]]`.
|
---|
| 241 | * @opt_param string valueRenderOption How values should be represented in the
|
---|
| 242 | * output. The default render option is FORMATTED_VALUE.
|
---|
| 243 | * @return ValueRange
|
---|
| 244 | * @throws \Google\Service\Exception
|
---|
| 245 | */
|
---|
| 246 | public function get($spreadsheetId, $range, $optParams = [])
|
---|
| 247 | {
|
---|
| 248 | $params = ['spreadsheetId' => $spreadsheetId, 'range' => $range];
|
---|
| 249 | $params = array_merge($params, $optParams);
|
---|
| 250 | return $this->call('get', [$params], ValueRange::class);
|
---|
| 251 | }
|
---|
| 252 | /**
|
---|
| 253 | * Sets values in a range of a spreadsheet. The caller must specify the
|
---|
| 254 | * spreadsheet ID, range, and a valueInputOption. (values.update)
|
---|
| 255 | *
|
---|
| 256 | * @param string $spreadsheetId The ID of the spreadsheet to update.
|
---|
| 257 | * @param string $range The [A1 notation](/sheets/api/guides/concepts#cell) of
|
---|
| 258 | * the values to update.
|
---|
| 259 | * @param ValueRange $postBody
|
---|
| 260 | * @param array $optParams Optional parameters.
|
---|
| 261 | *
|
---|
| 262 | * @opt_param bool includeValuesInResponse Determines if the update response
|
---|
| 263 | * should include the values of the cells that were updated. By default,
|
---|
| 264 | * responses do not include the updated values. If the range to write was larger
|
---|
| 265 | * than the range actually written, the response includes all values in the
|
---|
| 266 | * requested range (excluding trailing empty rows and columns).
|
---|
| 267 | * @opt_param string responseDateTimeRenderOption Determines how dates, times,
|
---|
| 268 | * and durations in the response should be rendered. This is ignored if
|
---|
| 269 | * response_value_render_option is FORMATTED_VALUE. The default dateTime render
|
---|
| 270 | * option is SERIAL_NUMBER.
|
---|
| 271 | * @opt_param string responseValueRenderOption Determines how values in the
|
---|
| 272 | * response should be rendered. The default render option is FORMATTED_VALUE.
|
---|
| 273 | * @opt_param string valueInputOption How the input data should be interpreted.
|
---|
| 274 | * @return UpdateValuesResponse
|
---|
| 275 | * @throws \Google\Service\Exception
|
---|
| 276 | */
|
---|
| 277 | public function update($spreadsheetId, $range, ValueRange $postBody, $optParams = [])
|
---|
| 278 | {
|
---|
| 279 | $params = ['spreadsheetId' => $spreadsheetId, 'range' => $range, 'postBody' => $postBody];
|
---|
| 280 | $params = array_merge($params, $optParams);
|
---|
| 281 | return $this->call('update', [$params], UpdateValuesResponse::class);
|
---|
| 282 | }
|
---|
| 283 | }
|
---|
| 284 |
|
---|
| 285 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 286 | class_alias(SpreadsheetsValues::class, 'Google_Service_Sheets_Resource_SpreadsheetsValues');
|
---|