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\Drive\Resource; 19 20use Google\Service\Drive\Comment; 21use Google\Service\Drive\CommentList; 22 23/** 24 * The "comments" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $driveService = new Google\Service\Drive(...); 28 * $comments = $driveService->comments; 29 * </code> 30 */ 31class Comments extends \Google\Service\Resource 32{ 33 /** 34 * Creates a new comment on a file. (comments.create) 35 * 36 * @param string $fileId The ID of the file. 37 * @param Comment $postBody 38 * @param array $optParams Optional parameters. 39 * @return Comment 40 */ 41 public function create($fileId, Comment $postBody, $optParams = []) 42 { 43 $params = ['fileId' => $fileId, 'postBody' => $postBody]; 44 $params = array_merge($params, $optParams); 45 return $this->call('create', [$params], Comment::class); 46 } 47 /** 48 * Deletes a comment. (comments.delete) 49 * 50 * @param string $fileId The ID of the file. 51 * @param string $commentId The ID of the comment. 52 * @param array $optParams Optional parameters. 53 */ 54 public function delete($fileId, $commentId, $optParams = []) 55 { 56 $params = ['fileId' => $fileId, 'commentId' => $commentId]; 57 $params = array_merge($params, $optParams); 58 return $this->call('delete', [$params]); 59 } 60 /** 61 * Gets a comment by ID. (comments.get) 62 * 63 * @param string $fileId The ID of the file. 64 * @param string $commentId The ID of the comment. 65 * @param array $optParams Optional parameters. 66 * 67 * @opt_param bool includeDeleted Whether to return deleted comments. Deleted 68 * comments will not include their original content. 69 * @return Comment 70 */ 71 public function get($fileId, $commentId, $optParams = []) 72 { 73 $params = ['fileId' => $fileId, 'commentId' => $commentId]; 74 $params = array_merge($params, $optParams); 75 return $this->call('get', [$params], Comment::class); 76 } 77 /** 78 * Lists a file's comments. (comments.listComments) 79 * 80 * @param string $fileId The ID of the file. 81 * @param array $optParams Optional parameters. 82 * 83 * @opt_param bool includeDeleted Whether to include deleted comments. Deleted 84 * comments will not include their original content. 85 * @opt_param int pageSize The maximum number of comments to return per page. 86 * @opt_param string pageToken The token for continuing a previous list request 87 * on the next page. This should be set to the value of 'nextPageToken' from the 88 * previous response. 89 * @opt_param string startModifiedTime The minimum value of 'modifiedTime' for 90 * the result comments (RFC 3339 date-time). 91 * @return CommentList 92 */ 93 public function listComments($fileId, $optParams = []) 94 { 95 $params = ['fileId' => $fileId]; 96 $params = array_merge($params, $optParams); 97 return $this->call('list', [$params], CommentList::class); 98 } 99 /** 100 * Updates a comment with patch semantics. (comments.update) 101 * 102 * @param string $fileId The ID of the file. 103 * @param string $commentId The ID of the comment. 104 * @param Comment $postBody 105 * @param array $optParams Optional parameters. 106 * @return Comment 107 */ 108 public function update($fileId, $commentId, Comment $postBody, $optParams = []) 109 { 110 $params = ['fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody]; 111 $params = array_merge($params, $optParams); 112 return $this->call('update', [$params], Comment::class); 113 } 114} 115 116// Adding a class alias for backwards compatibility with the previous class name. 117class_alias(Comments::class, 'Google_Service_Drive_Resource_Comments'); 118