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\Docs\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Docs\BatchUpdateDocumentRequest;
|
---|
21 | use Google\Service\Docs\BatchUpdateDocumentResponse;
|
---|
22 | use Google\Service\Docs\Document;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "documents" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $docsService = new Google\Service\Docs(...);
|
---|
29 | * $documents = $docsService->documents;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class Documents extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Applies one or more updates to the document. Each request is validated before
|
---|
36 | * being applied. If any request is not valid, then the entire request will fail
|
---|
37 | * and nothing will be applied. Some requests have replies to give you some
|
---|
38 | * information about how they are applied. Other requests do not need to return
|
---|
39 | * information; these each return an empty reply. The order of replies matches
|
---|
40 | * that of the requests. For example, suppose you call batchUpdate with four
|
---|
41 | * updates, and only the third one returns information. The response would have
|
---|
42 | * two empty replies, the reply to the third request, and another empty reply,
|
---|
43 | * in that order. Because other users may be editing the document, the document
|
---|
44 | * might not exactly reflect your changes: your changes may be altered with
|
---|
45 | * respect to collaborator changes. If there are no collaborators, the document
|
---|
46 | * should reflect your changes. In any case, the updates in your request are
|
---|
47 | * guaranteed to be applied together atomically. (documents.batchUpdate)
|
---|
48 | *
|
---|
49 | * @param string $documentId The ID of the document to update.
|
---|
50 | * @param BatchUpdateDocumentRequest $postBody
|
---|
51 | * @param array $optParams Optional parameters.
|
---|
52 | * @return BatchUpdateDocumentResponse
|
---|
53 | * @throws \Google\Service\Exception
|
---|
54 | */
|
---|
55 | public function batchUpdate($documentId, BatchUpdateDocumentRequest $postBody, $optParams = [])
|
---|
56 | {
|
---|
57 | $params = ['documentId' => $documentId, 'postBody' => $postBody];
|
---|
58 | $params = array_merge($params, $optParams);
|
---|
59 | return $this->call('batchUpdate', [$params], BatchUpdateDocumentResponse::class);
|
---|
60 | }
|
---|
61 | /**
|
---|
62 | * Creates a blank document using the title given in the request. Other fields
|
---|
63 | * in the request, including any provided content, are ignored. Returns the
|
---|
64 | * created document. (documents.create)
|
---|
65 | *
|
---|
66 | * @param Document $postBody
|
---|
67 | * @param array $optParams Optional parameters.
|
---|
68 | * @return Document
|
---|
69 | * @throws \Google\Service\Exception
|
---|
70 | */
|
---|
71 | public function create(Document $postBody, $optParams = [])
|
---|
72 | {
|
---|
73 | $params = ['postBody' => $postBody];
|
---|
74 | $params = array_merge($params, $optParams);
|
---|
75 | return $this->call('create', [$params], Document::class);
|
---|
76 | }
|
---|
77 | /**
|
---|
78 | * Gets the latest version of the specified document. (documents.get)
|
---|
79 | *
|
---|
80 | * @param string $documentId The ID of the document to retrieve.
|
---|
81 | * @param array $optParams Optional parameters.
|
---|
82 | *
|
---|
83 | * @opt_param bool includeTabsContent Whether to populate the Document.tabs
|
---|
84 | * field instead of the text content fields like `body` and `documentStyle` on
|
---|
85 | * Document. - When `True`: Document content populates in the Document.tabs
|
---|
86 | * field instead of the text content fields in Document. - When `False`: The
|
---|
87 | * content of the document's first tab populates the content fields in Document
|
---|
88 | * excluding Document.tabs. If a document has only one tab, then that tab is
|
---|
89 | * used to populate the document content. Document.tabs will be empty.
|
---|
90 | * @opt_param string suggestionsViewMode The suggestions view mode to apply to
|
---|
91 | * the document. This allows viewing the document with all suggestions inline,
|
---|
92 | * accepted or rejected. If one is not specified, DEFAULT_FOR_CURRENT_ACCESS is
|
---|
93 | * used.
|
---|
94 | * @return Document
|
---|
95 | * @throws \Google\Service\Exception
|
---|
96 | */
|
---|
97 | public function get($documentId, $optParams = [])
|
---|
98 | {
|
---|
99 | $params = ['documentId' => $documentId];
|
---|
100 | $params = array_merge($params, $optParams);
|
---|
101 | return $this->call('get', [$params], Document::class);
|
---|
102 | }
|
---|
103 | }
|
---|
104 |
|
---|
105 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
106 | class_alias(Documents::class, 'Google_Service_Docs_Resource_Documents');
|
---|