<?php
/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

namespace Google\Service\Walletobjects\Resource;

use Google\Service\Walletobjects\Media as MediaModel;
use Google\Service\Walletobjects\TransitObjectUploadRotatingBarcodeValuesRequest;
use Google\Service\Walletobjects\TransitObjectUploadRotatingBarcodeValuesResponse;

/**
 * The "media" collection of methods.
 * Typical usage is:
 *  <code>
 *   $walletobjectsService = new Google\Service\Walletobjects(...);
 *   $media = $walletobjectsService->media;
 *  </code>
 */
class Media extends \Google\Service\Resource
{
  /**
   * Downloads rotating barcode values for the transit object referenced by the
   * given object ID. (media.download)
   *
   * @param string $resourceId The unique identifier for an object. This ID must
   * be unique across all objects from an issuer. This value should follow the
   * format issuer ID. identifier where the former is issued by Google and latter
   * is chosen by you. Your unique identifier should only include alphanumeric
   * characters, '.', '_', or '-'.
   * @param array $optParams Optional parameters.
   * @return MediaModel
   * @throws \Google\Service\Exception
   */
  public function download($resourceId, $optParams = [])
  {
    $params = ['resourceId' => $resourceId];
    $params = array_merge($params, $optParams);
    return $this->call('download', [$params], MediaModel::class);
  }
  /**
   * Uploads rotating barcode values for the transit object referenced by the
   * given object ID. Note the max upload size is specified in
   * google3/production/config/cdd/apps-upload/customers/payments-consumer-
   * passes/config.gcl and enforced by Scotty. (media.upload)
   *
   * @param string $resourceId The unique identifier for an object. This ID must
   * be unique across all objects from an issuer. This value should follow the
   * format issuer ID. identifier where the former is issued by Google and latter
   * is chosen by you. Your unique identifier should only include alphanumeric
   * characters, '.', '_', or '-'.
   * @param TransitObjectUploadRotatingBarcodeValuesRequest $postBody
   * @param array $optParams Optional parameters.
   * @return TransitObjectUploadRotatingBarcodeValuesResponse
   * @throws \Google\Service\Exception
   */
  public function upload($resourceId, TransitObjectUploadRotatingBarcodeValuesRequest $postBody, $optParams = [])
  {
    $params = ['resourceId' => $resourceId, 'postBody' => $postBody];
    $params = array_merge($params, $optParams);
    return $this->call('upload', [$params], TransitObjectUploadRotatingBarcodeValuesResponse::class);
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Media::class, 'Google_Service_Walletobjects_Resource_Media');
