Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

   1  <?php
   2  /*
   3   * Copyright 2010 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  
  18  /**
  19   * Service definition for YouTubeReporting (v1).
  20   *
  21   * <p>
  22   * An API to schedule reporting jobs and download the resulting bulk data
  23   * reports about YouTube channels, videos etc. in the form of CSV files.</p>
  24   *
  25   * <p>
  26   * For more information about this service, see the API
  27   * <a href="https://developers.google.com/youtube/reporting/v1/reports/" target="_blank">Documentation</a>
  28   * </p>
  29   *
  30   * @author Google, Inc.
  31   */
  32  class Google_Service_YouTubeReporting extends Google_Service
  33  {
  34    /** View monetary and non-monetary YouTube Analytics reports for your YouTube content. */
  35    const YT_ANALYTICS_MONETARY_READONLY =
  36        "https://www.googleapis.com/auth/yt-analytics-monetary.readonly";
  37    /** View YouTube Analytics reports for your YouTube content. */
  38    const YT_ANALYTICS_READONLY =
  39        "https://www.googleapis.com/auth/yt-analytics.readonly";
  40  
  41    public $jobs;
  42    public $jobs_reports;
  43    public $media;
  44    public $reportTypes;
  45    
  46  
  47    /**
  48     * Constructs the internal representation of the YouTubeReporting service.
  49     *
  50     * @param Google_Client $client
  51     */
  52    public function __construct(Google_Client $client)
  53    {
  54      parent::__construct($client);
  55      $this->rootUrl = 'https://youtubereporting.googleapis.com/';
  56      $this->servicePath = '';
  57      $this->version = 'v1';
  58      $this->serviceName = 'youtubereporting';
  59  
  60      $this->jobs = new Google_Service_YouTubeReporting_Jobs_Resource(
  61          $this,
  62          $this->serviceName,
  63          'jobs',
  64          array(
  65            'methods' => array(
  66              'create' => array(
  67                'path' => 'v1/jobs',
  68                'httpMethod' => 'POST',
  69                'parameters' => array(
  70                  'onBehalfOfContentOwner' => array(
  71                    'location' => 'query',
  72                    'type' => 'string',
  73                  ),
  74                ),
  75              ),'delete' => array(
  76                'path' => 'v1/jobs/{jobId}',
  77                'httpMethod' => 'DELETE',
  78                'parameters' => array(
  79                  'jobId' => array(
  80                    'location' => 'path',
  81                    'type' => 'string',
  82                    'required' => true,
  83                  ),
  84                  'onBehalfOfContentOwner' => array(
  85                    'location' => 'query',
  86                    'type' => 'string',
  87                  ),
  88                ),
  89              ),'get' => array(
  90                'path' => 'v1/jobs/{jobId}',
  91                'httpMethod' => 'GET',
  92                'parameters' => array(
  93                  'jobId' => array(
  94                    'location' => 'path',
  95                    'type' => 'string',
  96                    'required' => true,
  97                  ),
  98                  'onBehalfOfContentOwner' => array(
  99                    'location' => 'query',
 100                    'type' => 'string',
 101                  ),
 102                ),
 103              ),'list' => array(
 104                'path' => 'v1/jobs',
 105                'httpMethod' => 'GET',
 106                'parameters' => array(
 107                  'pageToken' => array(
 108                    'location' => 'query',
 109                    'type' => 'string',
 110                  ),
 111                  'onBehalfOfContentOwner' => array(
 112                    'location' => 'query',
 113                    'type' => 'string',
 114                  ),
 115                  'pageSize' => array(
 116                    'location' => 'query',
 117                    'type' => 'integer',
 118                  ),
 119                ),
 120              ),
 121            )
 122          )
 123      );
 124      $this->jobs_reports = new Google_Service_YouTubeReporting_JobsReports_Resource(
 125          $this,
 126          $this->serviceName,
 127          'reports',
 128          array(
 129            'methods' => array(
 130              'get' => array(
 131                'path' => 'v1/jobs/{jobId}/reports/{reportId}',
 132                'httpMethod' => 'GET',
 133                'parameters' => array(
 134                  'jobId' => array(
 135                    'location' => 'path',
 136                    'type' => 'string',
 137                    'required' => true,
 138                  ),
 139                  'reportId' => array(
 140                    'location' => 'path',
 141                    'type' => 'string',
 142                    'required' => true,
 143                  ),
 144                  'onBehalfOfContentOwner' => array(
 145                    'location' => 'query',
 146                    'type' => 'string',
 147                  ),
 148                ),
 149              ),'list' => array(
 150                'path' => 'v1/jobs/{jobId}/reports',
 151                'httpMethod' => 'GET',
 152                'parameters' => array(
 153                  'jobId' => array(
 154                    'location' => 'path',
 155                    'type' => 'string',
 156                    'required' => true,
 157                  ),
 158                  'pageToken' => array(
 159                    'location' => 'query',
 160                    'type' => 'string',
 161                  ),
 162                  'onBehalfOfContentOwner' => array(
 163                    'location' => 'query',
 164                    'type' => 'string',
 165                  ),
 166                  'pageSize' => array(
 167                    'location' => 'query',
 168                    'type' => 'integer',
 169                  ),
 170                ),
 171              ),
 172            )
 173          )
 174      );
 175      $this->media = new Google_Service_YouTubeReporting_Media_Resource(
 176          $this,
 177          $this->serviceName,
 178          'media',
 179          array(
 180            'methods' => array(
 181              'download' => array(
 182                'path' => 'v1/media/{+resourceName}',
 183                'httpMethod' => 'GET',
 184                'parameters' => array(
 185                  'resourceName' => array(
 186                    'location' => 'path',
 187                    'type' => 'string',
 188                    'required' => true,
 189                  ),
 190                ),
 191              ),
 192            )
 193          )
 194      );
 195      $this->reportTypes = new Google_Service_YouTubeReporting_ReportTypes_Resource(
 196          $this,
 197          $this->serviceName,
 198          'reportTypes',
 199          array(
 200            'methods' => array(
 201              'list' => array(
 202                'path' => 'v1/reportTypes',
 203                'httpMethod' => 'GET',
 204                'parameters' => array(
 205                  'pageToken' => array(
 206                    'location' => 'query',
 207                    'type' => 'string',
 208                  ),
 209                  'onBehalfOfContentOwner' => array(
 210                    'location' => 'query',
 211                    'type' => 'string',
 212                  ),
 213                  'pageSize' => array(
 214                    'location' => 'query',
 215                    'type' => 'integer',
 216                  ),
 217                ),
 218              ),
 219            )
 220          )
 221      );
 222    }
 223  }
 224  
 225  
 226  /**
 227   * The "jobs" collection of methods.
 228   * Typical usage is:
 229   *  <code>
 230   *   $youtubereportingService = new Google_Service_YouTubeReporting(...);
 231   *   $jobs = $youtubereportingService->jobs;
 232   *  </code>
 233   */
 234  class Google_Service_YouTubeReporting_Jobs_Resource extends Google_Service_Resource
 235  {
 236  
 237    /**
 238     * Creates a job and returns it. (jobs.create)
 239     *
 240     * @param Google_Job $postBody
 241     * @param array $optParams Optional parameters.
 242     *
 243     * @opt_param string onBehalfOfContentOwner The content owner's external ID on
 244     * which behalf the user is acting on. If not set, the user is acting for
 245     * himself (his own channel).
 246     * @return Google_Service_YouTubeReporting_Job
 247     */
 248    public function create(Google_Service_YouTubeReporting_Job $postBody, $optParams = array())
 249    {
 250      $params = array('postBody' => $postBody);
 251      $params = array_merge($params, $optParams);
 252      return $this->call('create', array($params), "Google_Service_YouTubeReporting_Job");
 253    }
 254  
 255    /**
 256     * Deletes a job. (jobs.delete)
 257     *
 258     * @param string $jobId The ID of the job to delete.
 259     * @param array $optParams Optional parameters.
 260     *
 261     * @opt_param string onBehalfOfContentOwner The content owner's external ID on
 262     * which behalf the user is acting on. If not set, the user is acting for
 263     * himself (his own channel).
 264     * @return Google_Service_YouTubeReporting_Empty
 265     */
 266    public function delete($jobId, $optParams = array())
 267    {
 268      $params = array('jobId' => $jobId);
 269      $params = array_merge($params, $optParams);
 270      return $this->call('delete', array($params), "Google_Service_YouTubeReporting_Empty");
 271    }
 272  
 273    /**
 274     * Gets a job. (jobs.get)
 275     *
 276     * @param string $jobId The ID of the job to retrieve.
 277     * @param array $optParams Optional parameters.
 278     *
 279     * @opt_param string onBehalfOfContentOwner The content owner's external ID on
 280     * which behalf the user is acting on. If not set, the user is acting for
 281     * himself (his own channel).
 282     * @return Google_Service_YouTubeReporting_Job
 283     */
 284    public function get($jobId, $optParams = array())
 285    {
 286      $params = array('jobId' => $jobId);
 287      $params = array_merge($params, $optParams);
 288      return $this->call('get', array($params), "Google_Service_YouTubeReporting_Job");
 289    }
 290  
 291    /**
 292     * Lists jobs. (jobs.listJobs)
 293     *
 294     * @param array $optParams Optional parameters.
 295     *
 296     * @opt_param string pageToken A token identifying a page of results the server
 297     * should return. Typically, this is the value of
 298     * ListReportTypesResponse.next_page_token returned in response to the previous
 299     * call to the `ListJobs` method.
 300     * @opt_param string onBehalfOfContentOwner The content owner's external ID on
 301     * which behalf the user is acting on. If not set, the user is acting for
 302     * himself (his own channel).
 303     * @opt_param int pageSize Requested page size. Server may return fewer jobs
 304     * than requested. If unspecified, server will pick an appropriate default.
 305     * @return Google_Service_YouTubeReporting_ListJobsResponse
 306     */
 307    public function listJobs($optParams = array())
 308    {
 309      $params = array();
 310      $params = array_merge($params, $optParams);
 311      return $this->call('list', array($params), "Google_Service_YouTubeReporting_ListJobsResponse");
 312    }
 313  }
 314  
 315  /**
 316   * The "reports" collection of methods.
 317   * Typical usage is:
 318   *  <code>
 319   *   $youtubereportingService = new Google_Service_YouTubeReporting(...);
 320   *   $reports = $youtubereportingService->reports;
 321   *  </code>
 322   */
 323  class Google_Service_YouTubeReporting_JobsReports_Resource extends Google_Service_Resource
 324  {
 325  
 326    /**
 327     * Gets the metadata of a specific report. (reports.get)
 328     *
 329     * @param string $jobId The ID of the job.
 330     * @param string $reportId The ID of the report to retrieve.
 331     * @param array $optParams Optional parameters.
 332     *
 333     * @opt_param string onBehalfOfContentOwner The content owner's external ID on
 334     * which behalf the user is acting on. If not set, the user is acting for
 335     * himself (his own channel).
 336     * @return Google_Service_YouTubeReporting_Report
 337     */
 338    public function get($jobId, $reportId, $optParams = array())
 339    {
 340      $params = array('jobId' => $jobId, 'reportId' => $reportId);
 341      $params = array_merge($params, $optParams);
 342      return $this->call('get', array($params), "Google_Service_YouTubeReporting_Report");
 343    }
 344  
 345    /**
 346     * Lists reports created by a specific job. Returns NOT_FOUND if the job does
 347     * not exist. (reports.listJobsReports)
 348     *
 349     * @param string $jobId The ID of the job.
 350     * @param array $optParams Optional parameters.
 351     *
 352     * @opt_param string pageToken A token identifying a page of results the server
 353     * should return. Typically, this is the value of
 354     * ListReportsResponse.next_page_token returned in response to the previous call
 355     * to the `ListReports` method.
 356     * @opt_param string onBehalfOfContentOwner The content owner's external ID on
 357     * which behalf the user is acting on. If not set, the user is acting for
 358     * himself (his own channel).
 359     * @opt_param int pageSize Requested page size. Server may return fewer report
 360     * types than requested. If unspecified, server will pick an appropriate
 361     * default.
 362     * @return Google_Service_YouTubeReporting_ListReportsResponse
 363     */
 364    public function listJobsReports($jobId, $optParams = array())
 365    {
 366      $params = array('jobId' => $jobId);
 367      $params = array_merge($params, $optParams);
 368      return $this->call('list', array($params), "Google_Service_YouTubeReporting_ListReportsResponse");
 369    }
 370  }
 371  
 372  /**
 373   * The "media" collection of methods.
 374   * Typical usage is:
 375   *  <code>
 376   *   $youtubereportingService = new Google_Service_YouTubeReporting(...);
 377   *   $media = $youtubereportingService->media;
 378   *  </code>
 379   */
 380  class Google_Service_YouTubeReporting_Media_Resource extends Google_Service_Resource
 381  {
 382  
 383    /**
 384     * Method for media download. Download is supported on the URI
 385     * `/v1/media/{+name}?alt=media`. (media.download)
 386     *
 387     * @param string $resourceName Name of the media that is being downloaded. See
 388     * [][ByteStream.ReadRequest.resource_name].
 389     * @param array $optParams Optional parameters.
 390     * @return Google_Service_YouTubeReporting_Media
 391     */
 392    public function download($resourceName, $optParams = array())
 393    {
 394      $params = array('resourceName' => $resourceName);
 395      $params = array_merge($params, $optParams);
 396      return $this->call('download', array($params), "Google_Service_YouTubeReporting_Media");
 397    }
 398  }
 399  
 400  /**
 401   * The "reportTypes" collection of methods.
 402   * Typical usage is:
 403   *  <code>
 404   *   $youtubereportingService = new Google_Service_YouTubeReporting(...);
 405   *   $reportTypes = $youtubereportingService->reportTypes;
 406   *  </code>
 407   */
 408  class Google_Service_YouTubeReporting_ReportTypes_Resource extends Google_Service_Resource
 409  {
 410  
 411    /**
 412     * Lists report types. (reportTypes.listReportTypes)
 413     *
 414     * @param array $optParams Optional parameters.
 415     *
 416     * @opt_param string pageToken A token identifying a page of results the server
 417     * should return. Typically, this is the value of
 418     * ListReportTypesResponse.next_page_token returned in response to the previous
 419     * call to the `ListReportTypes` method.
 420     * @opt_param string onBehalfOfContentOwner The content owner's external ID on
 421     * which behalf the user is acting on. If not set, the user is acting for
 422     * himself (his own channel).
 423     * @opt_param int pageSize Requested page size. Server may return fewer report
 424     * types than requested. If unspecified, server will pick an appropriate
 425     * default.
 426     * @return Google_Service_YouTubeReporting_ListReportTypesResponse
 427     */
 428    public function listReportTypes($optParams = array())
 429    {
 430      $params = array();
 431      $params = array_merge($params, $optParams);
 432      return $this->call('list', array($params), "Google_Service_YouTubeReporting_ListReportTypesResponse");
 433    }
 434  }
 435  
 436  
 437  
 438  
 439  class Google_Service_YouTubeReporting_Empty extends Google_Model
 440  {
 441  }
 442  
 443  class Google_Service_YouTubeReporting_Job extends Google_Model
 444  {
 445    protected $internal_gapi_mappings = array(
 446    );
 447    public $createTime;
 448    public $id;
 449    public $name;
 450    public $reportTypeId;
 451  
 452  
 453    public function setCreateTime($createTime)
 454    {
 455      $this->createTime = $createTime;
 456    }
 457    public function getCreateTime()
 458    {
 459      return $this->createTime;
 460    }
 461    public function setId($id)
 462    {
 463      $this->id = $id;
 464    }
 465    public function getId()
 466    {
 467      return $this->id;
 468    }
 469    public function setName($name)
 470    {
 471      $this->name = $name;
 472    }
 473    public function getName()
 474    {
 475      return $this->name;
 476    }
 477    public function setReportTypeId($reportTypeId)
 478    {
 479      $this->reportTypeId = $reportTypeId;
 480    }
 481    public function getReportTypeId()
 482    {
 483      return $this->reportTypeId;
 484    }
 485  }
 486  
 487  class Google_Service_YouTubeReporting_ListJobsResponse extends Google_Collection
 488  {
 489    protected $collection_key = 'jobs';
 490    protected $internal_gapi_mappings = array(
 491    );
 492    protected $jobsType = 'Google_Service_YouTubeReporting_Job';
 493    protected $jobsDataType = 'array';
 494    public $nextPageToken;
 495  
 496  
 497    public function setJobs($jobs)
 498    {
 499      $this->jobs = $jobs;
 500    }
 501    public function getJobs()
 502    {
 503      return $this->jobs;
 504    }
 505    public function setNextPageToken($nextPageToken)
 506    {
 507      $this->nextPageToken = $nextPageToken;
 508    }
 509    public function getNextPageToken()
 510    {
 511      return $this->nextPageToken;
 512    }
 513  }
 514  
 515  class Google_Service_YouTubeReporting_ListReportTypesResponse extends Google_Collection
 516  {
 517    protected $collection_key = 'reportTypes';
 518    protected $internal_gapi_mappings = array(
 519    );
 520    public $nextPageToken;
 521    protected $reportTypesType = 'Google_Service_YouTubeReporting_ReportType';
 522    protected $reportTypesDataType = 'array';
 523  
 524  
 525    public function setNextPageToken($nextPageToken)
 526    {
 527      $this->nextPageToken = $nextPageToken;
 528    }
 529    public function getNextPageToken()
 530    {
 531      return $this->nextPageToken;
 532    }
 533    public function setReportTypes($reportTypes)
 534    {
 535      $this->reportTypes = $reportTypes;
 536    }
 537    public function getReportTypes()
 538    {
 539      return $this->reportTypes;
 540    }
 541  }
 542  
 543  class Google_Service_YouTubeReporting_ListReportsResponse extends Google_Collection
 544  {
 545    protected $collection_key = 'reports';
 546    protected $internal_gapi_mappings = array(
 547    );
 548    public $nextPageToken;
 549    protected $reportsType = 'Google_Service_YouTubeReporting_Report';
 550    protected $reportsDataType = 'array';
 551  
 552  
 553    public function setNextPageToken($nextPageToken)
 554    {
 555      $this->nextPageToken = $nextPageToken;
 556    }
 557    public function getNextPageToken()
 558    {
 559      return $this->nextPageToken;
 560    }
 561    public function setReports($reports)
 562    {
 563      $this->reports = $reports;
 564    }
 565    public function getReports()
 566    {
 567      return $this->reports;
 568    }
 569  }
 570  
 571  class Google_Service_YouTubeReporting_Media extends Google_Model
 572  {
 573    protected $internal_gapi_mappings = array(
 574    );
 575    public $resourceName;
 576  
 577  
 578    public function setResourceName($resourceName)
 579    {
 580      $this->resourceName = $resourceName;
 581    }
 582    public function getResourceName()
 583    {
 584      return $this->resourceName;
 585    }
 586  }
 587  
 588  class Google_Service_YouTubeReporting_Report extends Google_Model
 589  {
 590    protected $internal_gapi_mappings = array(
 591    );
 592    public $createTime;
 593    public $downloadUrl;
 594    public $endTime;
 595    public $id;
 596    public $jobId;
 597    public $startTime;
 598  
 599  
 600    public function setCreateTime($createTime)
 601    {
 602      $this->createTime = $createTime;
 603    }
 604    public function getCreateTime()
 605    {
 606      return $this->createTime;
 607    }
 608    public function setDownloadUrl($downloadUrl)
 609    {
 610      $this->downloadUrl = $downloadUrl;
 611    }
 612    public function getDownloadUrl()
 613    {
 614      return $this->downloadUrl;
 615    }
 616    public function setEndTime($endTime)
 617    {
 618      $this->endTime = $endTime;
 619    }
 620    public function getEndTime()
 621    {
 622      return $this->endTime;
 623    }
 624    public function setId($id)
 625    {
 626      $this->id = $id;
 627    }
 628    public function getId()
 629    {
 630      return $this->id;
 631    }
 632    public function setJobId($jobId)
 633    {
 634      $this->jobId = $jobId;
 635    }
 636    public function getJobId()
 637    {
 638      return $this->jobId;
 639    }
 640    public function setStartTime($startTime)
 641    {
 642      $this->startTime = $startTime;
 643    }
 644    public function getStartTime()
 645    {
 646      return $this->startTime;
 647    }
 648  }
 649  
 650  class Google_Service_YouTubeReporting_ReportType extends Google_Model
 651  {
 652    protected $internal_gapi_mappings = array(
 653    );
 654    public $id;
 655    public $name;
 656  
 657  
 658    public function setId($id)
 659    {
 660      $this->id = $id;
 661    }
 662    public function getId()
 663    {
 664      return $this->id;
 665    }
 666    public function setName($name)
 667    {
 668      $this->name = $name;
 669    }
 670    public function getName()
 671    {
 672      return $this->name;
 673    }
 674  }