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\CloudSupport\Resource; 19 20use Google\Service\CloudSupport\Attachment; 21use Google\Service\CloudSupport\CreateAttachmentRequest; 22use Google\Service\CloudSupport\Media as MediaModel; 23 24/** 25 * The "media" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $cloudsupportService = new Google\Service\CloudSupport(...); 29 * $media = $cloudsupportService->media; 30 * </code> 31 */ 32class Media extends \Google\Service\Resource 33{ 34 /** 35 * Download a file attachment on a case. Note: HTTP requests must append 36 * "?alt=media" to the URL. (media.download) 37 * 38 * @param string $name The resource name of the attachment to be downloaded. 39 * @param array $optParams Optional parameters. 40 * @return MediaModel 41 */ 42 public function download($name, $optParams = []) 43 { 44 $params = ['name' => $name]; 45 $params = array_merge($params, $optParams); 46 return $this->call('download', [$params], MediaModel::class); 47 } 48 /** 49 * Create a file attachment on a case or Cloud resource. (media.upload) 50 * 51 * @param string $parent Required. The resource name of the case to which 52 * attachment should be attached. 53 * @param CreateAttachmentRequest $postBody 54 * @param array $optParams Optional parameters. 55 * @return Attachment 56 */ 57 public function upload($parent, CreateAttachmentRequest $postBody, $optParams = []) 58 { 59 $params = ['parent' => $parent, 'postBody' => $postBody]; 60 $params = array_merge($params, $optParams); 61 return $this->call('upload', [$params], Attachment::class); 62 } 63} 64 65// Adding a class alias for backwards compatibility with the previous class name. 66class_alias(Media::class, 'Google_Service_CloudSupport_Resource_Media'); 67