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