[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\TravelImpactModel\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\TravelImpactModel\ComputeFlightEmissionsRequest;
|
---|
| 21 | use Google\Service\TravelImpactModel\ComputeFlightEmissionsResponse;
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * The "flights" collection of methods.
|
---|
| 25 | * Typical usage is:
|
---|
| 26 | * <code>
|
---|
| 27 | * $travelimpactmodelService = new Google\Service\TravelImpactModel(...);
|
---|
| 28 | * $flights = $travelimpactmodelService->flights;
|
---|
| 29 | * </code>
|
---|
| 30 | */
|
---|
| 31 | class Flights extends \Google\Service\Resource
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * Stateless method to retrieve emission estimates. Details on how emission
|
---|
| 35 | * estimates are computed: https://github.com/google/travel-impact-model The
|
---|
| 36 | * response will contain all entries that match the input flight legs, in the
|
---|
| 37 | * same order. If there are no estimates available for a certain flight leg, the
|
---|
| 38 | * response will return the flight leg object with empty emission fields. The
|
---|
| 39 | * request will still be considered successful. Reasons for missing emission
|
---|
| 40 | * estimates include: - The flight is unknown to the server. - The input flight
|
---|
| 41 | * leg is missing one or more identifiers. - The flight date is in the past. -
|
---|
| 42 | * The aircraft type is not supported by the model. - Missing seat
|
---|
| 43 | * configuration. The request can contain up to 1000 flight legs. If the request
|
---|
| 44 | * has more than 1000 direct flights, if will fail with an INVALID_ARGUMENT
|
---|
| 45 | * error. (flights.computeFlightEmissions)
|
---|
| 46 | *
|
---|
| 47 | * @param ComputeFlightEmissionsRequest $postBody
|
---|
| 48 | * @param array $optParams Optional parameters.
|
---|
| 49 | * @return ComputeFlightEmissionsResponse
|
---|
| 50 | * @throws \Google\Service\Exception
|
---|
| 51 | */
|
---|
| 52 | public function computeFlightEmissions(ComputeFlightEmissionsRequest $postBody, $optParams = [])
|
---|
| 53 | {
|
---|
| 54 | $params = ['postBody' => $postBody];
|
---|
| 55 | $params = array_merge($params, $optParams);
|
---|
| 56 | return $this->call('computeFlightEmissions', [$params], ComputeFlightEmissionsResponse::class);
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 61 | class_alias(Flights::class, 'Google_Service_TravelImpactModel_Resource_Flights');
|
---|