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\Adsense\Resource;
19
20use Google\Service\Adsense\HttpBody;
21use Google\Service\Adsense\ListSavedReportsResponse;
22use Google\Service\Adsense\ReportResult;
23
24/**
25 * The "saved" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $adsenseService = new Google\Service\Adsense(...);
29 *   $saved = $adsenseService->saved;
30 *  </code>
31 */
32class AccountsReportsSaved extends \Google\Service\Resource
33{
34  /**
35   * Generates a saved report. (saved.generate)
36   *
37   * @param string $name Required. Name of the saved report. Format:
38   * accounts/{account}/reports/{report}
39   * @param array $optParams Optional parameters.
40   *
41   * @opt_param string currencyCode The [ISO-4217 currency
42   * code](https://en.wikipedia.org/wiki/ISO_4217) to use when reporting on
43   * monetary metrics. Defaults to the account's currency if not set.
44   * @opt_param string dateRange Date range of the report, if unset the range will
45   * be considered CUSTOM.
46   * @opt_param int endDate.day Day of a month. Must be from 1 to 31 and valid for
47   * the year and month, or 0 to specify a year by itself or a year and month
48   * where the day isn't significant.
49   * @opt_param int endDate.month Month of a year. Must be from 1 to 12, or 0 to
50   * specify a year without a month and day.
51   * @opt_param int endDate.year Year of the date. Must be from 1 to 9999, or 0 to
52   * specify a date without a year.
53   * @opt_param string languageCode The language to use for translating report
54   * output. If unspecified, this defaults to English ("en"). If the given
55   * language is not supported, report output will be returned in English. The
56   * language is specified as an [IETF BCP-47 language
57   * code](https://en.wikipedia.org/wiki/IETF_language_tag).
58   * @opt_param string reportingTimeZone Timezone in which to generate the report.
59   * If unspecified, this defaults to the account timezone. For more information,
60   * see [changing the time zone of your
61   * reports](https://support.google.com/adsense/answer/9830725).
62   * @opt_param int startDate.day Day of a month. Must be from 1 to 31 and valid
63   * for the year and month, or 0 to specify a year by itself or a year and month
64   * where the day isn't significant.
65   * @opt_param int startDate.month Month of a year. Must be from 1 to 12, or 0 to
66   * specify a year without a month and day.
67   * @opt_param int startDate.year Year of the date. Must be from 1 to 9999, or 0
68   * to specify a date without a year.
69   * @return ReportResult
70   */
71  public function generate($name, $optParams = [])
72  {
73    $params = ['name' => $name];
74    $params = array_merge($params, $optParams);
75    return $this->call('generate', [$params], ReportResult::class);
76  }
77  /**
78   * Generates a csv formatted saved report. (saved.generateCsv)
79   *
80   * @param string $name Required. Name of the saved report. Format:
81   * accounts/{account}/reports/{report}
82   * @param array $optParams Optional parameters.
83   *
84   * @opt_param string currencyCode The [ISO-4217 currency
85   * code](https://en.wikipedia.org/wiki/ISO_4217) to use when reporting on
86   * monetary metrics. Defaults to the account's currency if not set.
87   * @opt_param string dateRange Date range of the report, if unset the range will
88   * be considered CUSTOM.
89   * @opt_param int endDate.day Day of a month. Must be from 1 to 31 and valid for
90   * the year and month, or 0 to specify a year by itself or a year and month
91   * where the day isn't significant.
92   * @opt_param int endDate.month Month of a year. Must be from 1 to 12, or 0 to
93   * specify a year without a month and day.
94   * @opt_param int endDate.year Year of the date. Must be from 1 to 9999, or 0 to
95   * specify a date without a year.
96   * @opt_param string languageCode The language to use for translating report
97   * output. If unspecified, this defaults to English ("en"). If the given
98   * language is not supported, report output will be returned in English. The
99   * language is specified as an [IETF BCP-47 language
100   * code](https://en.wikipedia.org/wiki/IETF_language_tag).
101   * @opt_param string reportingTimeZone Timezone in which to generate the report.
102   * If unspecified, this defaults to the account timezone. For more information,
103   * see [changing the time zone of your
104   * reports](https://support.google.com/adsense/answer/9830725).
105   * @opt_param int startDate.day Day of a month. Must be from 1 to 31 and valid
106   * for the year and month, or 0 to specify a year by itself or a year and month
107   * where the day isn't significant.
108   * @opt_param int startDate.month Month of a year. Must be from 1 to 12, or 0 to
109   * specify a year without a month and day.
110   * @opt_param int startDate.year Year of the date. Must be from 1 to 9999, or 0
111   * to specify a date without a year.
112   * @return HttpBody
113   */
114  public function generateCsv($name, $optParams = [])
115  {
116    $params = ['name' => $name];
117    $params = array_merge($params, $optParams);
118    return $this->call('generateCsv', [$params], HttpBody::class);
119  }
120  /**
121   * Lists saved reports. (saved.listAccountsReportsSaved)
122   *
123   * @param string $parent Required. The account which owns the collection of
124   * reports. Format: accounts/{account}
125   * @param array $optParams Optional parameters.
126   *
127   * @opt_param int pageSize The maximum number of reports to include in the
128   * response, used for paging. If unspecified, at most 10000 reports will be
129   * returned. The maximum value is 10000; values above 10000 will be coerced to
130   * 10000.
131   * @opt_param string pageToken A page token, received from a previous
132   * `ListPayments` call. Provide this to retrieve the subsequent page. When
133   * paginating, all other parameters provided to `ListPayments` must match the
134   * call that provided the page token.
135   * @return ListSavedReportsResponse
136   */
137  public function listAccountsReportsSaved($parent, $optParams = [])
138  {
139    $params = ['parent' => $parent];
140    $params = array_merge($params, $optParams);
141    return $this->call('list', [$params], ListSavedReportsResponse::class);
142  }
143}
144
145// Adding a class alias for backwards compatibility with the previous class name.
146class_alias(AccountsReportsSaved::class, 'Google_Service_Adsense_Resource_AccountsReportsSaved');
147