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\Script\Resource; 19 20use Google\Service\Script\Deployment; 21use Google\Service\Script\DeploymentConfig; 22use Google\Service\Script\ListDeploymentsResponse; 23use Google\Service\Script\ScriptEmpty; 24use Google\Service\Script\UpdateDeploymentRequest; 25 26/** 27 * The "deployments" collection of methods. 28 * Typical usage is: 29 * <code> 30 * $scriptService = new Google\Service\Script(...); 31 * $deployments = $scriptService->deployments; 32 * </code> 33 */ 34class ProjectsDeployments extends \Google\Service\Resource 35{ 36 /** 37 * Creates a deployment of an Apps Script project. (deployments.create) 38 * 39 * @param string $scriptId The script project's Drive ID. 40 * @param DeploymentConfig $postBody 41 * @param array $optParams Optional parameters. 42 * @return Deployment 43 */ 44 public function create($scriptId, DeploymentConfig $postBody, $optParams = []) 45 { 46 $params = ['scriptId' => $scriptId, 'postBody' => $postBody]; 47 $params = array_merge($params, $optParams); 48 return $this->call('create', [$params], Deployment::class); 49 } 50 /** 51 * Deletes a deployment of an Apps Script project. (deployments.delete) 52 * 53 * @param string $scriptId The script project's Drive ID. 54 * @param string $deploymentId The deployment ID to be undeployed. 55 * @param array $optParams Optional parameters. 56 * @return ScriptEmpty 57 */ 58 public function delete($scriptId, $deploymentId, $optParams = []) 59 { 60 $params = ['scriptId' => $scriptId, 'deploymentId' => $deploymentId]; 61 $params = array_merge($params, $optParams); 62 return $this->call('delete', [$params], ScriptEmpty::class); 63 } 64 /** 65 * Gets a deployment of an Apps Script project. (deployments.get) 66 * 67 * @param string $scriptId The script project's Drive ID. 68 * @param string $deploymentId The deployment ID. 69 * @param array $optParams Optional parameters. 70 * @return Deployment 71 */ 72 public function get($scriptId, $deploymentId, $optParams = []) 73 { 74 $params = ['scriptId' => $scriptId, 'deploymentId' => $deploymentId]; 75 $params = array_merge($params, $optParams); 76 return $this->call('get', [$params], Deployment::class); 77 } 78 /** 79 * Lists the deployments of an Apps Script project. 80 * (deployments.listProjectsDeployments) 81 * 82 * @param string $scriptId The script project's Drive ID. 83 * @param array $optParams Optional parameters. 84 * 85 * @opt_param int pageSize The maximum number of deployments on each returned 86 * page. Defaults to 50. 87 * @opt_param string pageToken The token for continuing a previous list request 88 * on the next page. This should be set to the value of `nextPageToken` from a 89 * previous response. 90 * @return ListDeploymentsResponse 91 */ 92 public function listProjectsDeployments($scriptId, $optParams = []) 93 { 94 $params = ['scriptId' => $scriptId]; 95 $params = array_merge($params, $optParams); 96 return $this->call('list', [$params], ListDeploymentsResponse::class); 97 } 98 /** 99 * Updates a deployment of an Apps Script project. (deployments.update) 100 * 101 * @param string $scriptId The script project's Drive ID. 102 * @param string $deploymentId The deployment ID for this deployment. 103 * @param UpdateDeploymentRequest $postBody 104 * @param array $optParams Optional parameters. 105 * @return Deployment 106 */ 107 public function update($scriptId, $deploymentId, UpdateDeploymentRequest $postBody, $optParams = []) 108 { 109 $params = ['scriptId' => $scriptId, 'deploymentId' => $deploymentId, 'postBody' => $postBody]; 110 $params = array_merge($params, $optParams); 111 return $this->call('update', [$params], Deployment::class); 112 } 113} 114 115// Adding a class alias for backwards compatibility with the previous class name. 116class_alias(ProjectsDeployments::class, 'Google_Service_Script_Resource_ProjectsDeployments'); 117