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\DoubleClickBidManager\Resource; 19 20use Google\Service\DoubleClickBidManager\ListQueriesResponse; 21use Google\Service\DoubleClickBidManager\Query; 22use Google\Service\DoubleClickBidManager\RunQueryRequest; 23 24/** 25 * The "queries" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $doubleclickbidmanagerService = new Google\Service\DoubleClickBidManager(...); 29 * $queries = $doubleclickbidmanagerService->queries; 30 * </code> 31 */ 32class Queries extends \Google\Service\Resource 33{ 34 /** 35 * Creates a query. (queries.createquery) 36 * 37 * @param Query $postBody 38 * @param array $optParams Optional parameters. 39 * 40 * @opt_param bool asynchronous If true, tries to run the query asynchronously. 41 * Only applicable when the frequency is ONE_TIME. 42 * @return Query 43 */ 44 public function createquery(Query $postBody, $optParams = []) 45 { 46 $params = ['postBody' => $postBody]; 47 $params = array_merge($params, $optParams); 48 return $this->call('createquery', [$params], Query::class); 49 } 50 /** 51 * Deletes a stored query as well as the associated stored reports. 52 * (queries.deletequery) 53 * 54 * @param string $queryId Query ID to delete. 55 * @param array $optParams Optional parameters. 56 */ 57 public function deletequery($queryId, $optParams = []) 58 { 59 $params = ['queryId' => $queryId]; 60 $params = array_merge($params, $optParams); 61 return $this->call('deletequery', [$params]); 62 } 63 /** 64 * Retrieves a stored query. (queries.getquery) 65 * 66 * @param string $queryId Query ID to retrieve. 67 * @param array $optParams Optional parameters. 68 * @return Query 69 */ 70 public function getquery($queryId, $optParams = []) 71 { 72 $params = ['queryId' => $queryId]; 73 $params = array_merge($params, $optParams); 74 return $this->call('getquery', [$params], Query::class); 75 } 76 /** 77 * Retrieves stored queries. (queries.listqueries) 78 * 79 * @param array $optParams Optional parameters. 80 * 81 * @opt_param int pageSize Maximum number of results per page. Must be between 1 82 * and 100. Defaults to 100 if unspecified. 83 * @opt_param string pageToken Optional pagination token. 84 * @return ListQueriesResponse 85 */ 86 public function listqueries($optParams = []) 87 { 88 $params = []; 89 $params = array_merge($params, $optParams); 90 return $this->call('listqueries', [$params], ListQueriesResponse::class); 91 } 92 /** 93 * Runs a stored query to generate a report. (queries.runquery) 94 * 95 * @param string $queryId Query ID to run. 96 * @param RunQueryRequest $postBody 97 * @param array $optParams Optional parameters. 98 * 99 * @opt_param bool asynchronous If true, tries to run the query asynchronously. 100 */ 101 public function runquery($queryId, RunQueryRequest $postBody, $optParams = []) 102 { 103 $params = ['queryId' => $queryId, 'postBody' => $postBody]; 104 $params = array_merge($params, $optParams); 105 return $this->call('runquery', [$params]); 106 } 107} 108 109// Adding a class alias for backwards compatibility with the previous class name. 110class_alias(Queries::class, 'Google_Service_DoubleClickBidManager_Resource_Queries'); 111