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\Dfareporting\Resource;
19
20use Google\Service\Dfareporting\DfareportingFile;
21use Google\Service\Dfareporting\Report;
22use Google\Service\Dfareporting\ReportList;
23
24/**
25 * The "reports" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $dfareportingService = new Google\Service\Dfareporting(...);
29 *   $reports = $dfareportingService->reports;
30 *  </code>
31 */
32class Reports extends \Google\Service\Resource
33{
34  /**
35   * Deletes a report by its ID. (reports.delete)
36   *
37   * @param string $profileId The Campaign Manager 360 user profile ID.
38   * @param string $reportId The ID of the report.
39   * @param array $optParams Optional parameters.
40   */
41  public function delete($profileId, $reportId, $optParams = [])
42  {
43    $params = ['profileId' => $profileId, 'reportId' => $reportId];
44    $params = array_merge($params, $optParams);
45    return $this->call('delete', [$params]);
46  }
47  /**
48   * Retrieves a report by its ID. (reports.get)
49   *
50   * @param string $profileId The Campaign Manager 360 user profile ID.
51   * @param string $reportId The ID of the report.
52   * @param array $optParams Optional parameters.
53   * @return Report
54   */
55  public function get($profileId, $reportId, $optParams = [])
56  {
57    $params = ['profileId' => $profileId, 'reportId' => $reportId];
58    $params = array_merge($params, $optParams);
59    return $this->call('get', [$params], Report::class);
60  }
61  /**
62   * Creates a report. (reports.insert)
63   *
64   * @param string $profileId The Campaign Manager 360 user profile ID.
65   * @param Report $postBody
66   * @param array $optParams Optional parameters.
67   * @return Report
68   */
69  public function insert($profileId, Report $postBody, $optParams = [])
70  {
71    $params = ['profileId' => $profileId, 'postBody' => $postBody];
72    $params = array_merge($params, $optParams);
73    return $this->call('insert', [$params], Report::class);
74  }
75  /**
76   * Retrieves list of reports. (reports.listReports)
77   *
78   * @param string $profileId The Campaign Manager 360 user profile ID.
79   * @param array $optParams Optional parameters.
80   *
81   * @opt_param int maxResults Maximum number of results to return.
82   * @opt_param string pageToken The value of the nextToken from the previous
83   * result page.
84   * @opt_param string scope The scope that defines which results are returned.
85   * @opt_param string sortField The field by which to sort the list.
86   * @opt_param string sortOrder Order of sorted results.
87   * @return ReportList
88   */
89  public function listReports($profileId, $optParams = [])
90  {
91    $params = ['profileId' => $profileId];
92    $params = array_merge($params, $optParams);
93    return $this->call('list', [$params], ReportList::class);
94  }
95  /**
96   * Updates an existing report. This method supports patch semantics.
97   * (reports.patch)
98   *
99   * @param string $profileId The DFA user profile ID.
100   * @param string $reportId The ID of the report.
101   * @param Report $postBody
102   * @param array $optParams Optional parameters.
103   * @return Report
104   */
105  public function patch($profileId, $reportId, Report $postBody, $optParams = [])
106  {
107    $params = ['profileId' => $profileId, 'reportId' => $reportId, 'postBody' => $postBody];
108    $params = array_merge($params, $optParams);
109    return $this->call('patch', [$params], Report::class);
110  }
111  /**
112   * Runs a report. (reports.run)
113   *
114   * @param string $profileId The Campaign Manager 360 user profile ID.
115   * @param string $reportId The ID of the report.
116   * @param array $optParams Optional parameters.
117   *
118   * @opt_param bool synchronous If set and true, tries to run the report
119   * synchronously.
120   * @return DfareportingFile
121   */
122  public function run($profileId, $reportId, $optParams = [])
123  {
124    $params = ['profileId' => $profileId, 'reportId' => $reportId];
125    $params = array_merge($params, $optParams);
126    return $this->call('run', [$params], DfareportingFile::class);
127  }
128  /**
129   * Updates a report. (reports.update)
130   *
131   * @param string $profileId The Campaign Manager 360 user profile ID.
132   * @param string $reportId The ID of the report.
133   * @param Report $postBody
134   * @param array $optParams Optional parameters.
135   * @return Report
136   */
137  public function update($profileId, $reportId, Report $postBody, $optParams = [])
138  {
139    $params = ['profileId' => $profileId, 'reportId' => $reportId, 'postBody' => $postBody];
140    $params = array_merge($params, $optParams);
141    return $this->call('update', [$params], Report::class);
142  }
143}
144
145// Adding a class alias for backwards compatibility with the previous class name.
146class_alias(Reports::class, 'Google_Service_Dfareporting_Resource_Reports');
147