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\Keep\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Keep\KeepEmpty;
|
---|
21 | use Google\Service\Keep\ListNotesResponse;
|
---|
22 | use Google\Service\Keep\Note;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "notes" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $keepService = new Google\Service\Keep(...);
|
---|
29 | * $notes = $keepService->notes;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class Notes extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Creates a new note. (notes.create)
|
---|
36 | *
|
---|
37 | * @param Note $postBody
|
---|
38 | * @param array $optParams Optional parameters.
|
---|
39 | * @return Note
|
---|
40 | * @throws \Google\Service\Exception
|
---|
41 | */
|
---|
42 | public function create(Note $postBody, $optParams = [])
|
---|
43 | {
|
---|
44 | $params = ['postBody' => $postBody];
|
---|
45 | $params = array_merge($params, $optParams);
|
---|
46 | return $this->call('create', [$params], Note::class);
|
---|
47 | }
|
---|
48 | /**
|
---|
49 | * Deletes a note. Caller must have the `OWNER` role on the note to delete.
|
---|
50 | * Deleting a note removes the resource immediately and cannot be undone. Any
|
---|
51 | * collaborators will lose access to the note. (notes.delete)
|
---|
52 | *
|
---|
53 | * @param string $name Required. Name of the note to delete.
|
---|
54 | * @param array $optParams Optional parameters.
|
---|
55 | * @return KeepEmpty
|
---|
56 | * @throws \Google\Service\Exception
|
---|
57 | */
|
---|
58 | public function delete($name, $optParams = [])
|
---|
59 | {
|
---|
60 | $params = ['name' => $name];
|
---|
61 | $params = array_merge($params, $optParams);
|
---|
62 | return $this->call('delete', [$params], KeepEmpty::class);
|
---|
63 | }
|
---|
64 | /**
|
---|
65 | * Gets a note. (notes.get)
|
---|
66 | *
|
---|
67 | * @param string $name Required. Name of the resource.
|
---|
68 | * @param array $optParams Optional parameters.
|
---|
69 | * @return Note
|
---|
70 | * @throws \Google\Service\Exception
|
---|
71 | */
|
---|
72 | public function get($name, $optParams = [])
|
---|
73 | {
|
---|
74 | $params = ['name' => $name];
|
---|
75 | $params = array_merge($params, $optParams);
|
---|
76 | return $this->call('get', [$params], Note::class);
|
---|
77 | }
|
---|
78 | /**
|
---|
79 | * Lists notes. Every list call returns a page of results with `page_size` as
|
---|
80 | * the upper bound of returned items. A `page_size` of zero allows the server to
|
---|
81 | * choose the upper bound. The ListNotesResponse contains at most `page_size`
|
---|
82 | * entries. If there are more things left to list, it provides a
|
---|
83 | * `next_page_token` value. (Page tokens are opaque values.) To get the next
|
---|
84 | * page of results, copy the result's `next_page_token` into the next request's
|
---|
85 | * `page_token`. Repeat until the `next_page_token` returned with a page of
|
---|
86 | * results is empty. ListNotes return consistent results in the face of
|
---|
87 | * concurrent changes, or signals that it cannot with an ABORTED error.
|
---|
88 | * (notes.listNotes)
|
---|
89 | *
|
---|
90 | * @param array $optParams Optional parameters.
|
---|
91 | *
|
---|
92 | * @opt_param string filter Filter for list results. If no filter is supplied,
|
---|
93 | * the `trashed` filter is applied by default. Valid fields to filter by are:
|
---|
94 | * `create_time`, `update_time`, `trash_time`, and `trashed`. Filter syntax
|
---|
95 | * follows the [Google AIP filtering spec](https://aip.dev/160).
|
---|
96 | * @opt_param int pageSize The maximum number of results to return.
|
---|
97 | * @opt_param string pageToken The previous page's `next_page_token` field.
|
---|
98 | * @return ListNotesResponse
|
---|
99 | * @throws \Google\Service\Exception
|
---|
100 | */
|
---|
101 | public function listNotes($optParams = [])
|
---|
102 | {
|
---|
103 | $params = [];
|
---|
104 | $params = array_merge($params, $optParams);
|
---|
105 | return $this->call('list', [$params], ListNotesResponse::class);
|
---|
106 | }
|
---|
107 | }
|
---|
108 |
|
---|
109 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
110 | class_alias(Notes::class, 'Google_Service_Keep_Resource_Notes');
|
---|