51 lines
1.7 KiB
XML
51 lines
1.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<providers xmlns="https://calco2la.to/schema/providers/v1">
|
|
<!-- Google TIM -->
|
|
<provider id="google_tim">
|
|
<name>Google Travel Impact Model</name>
|
|
<baseUrl>https://travelimpactmodel.googleapis.com/v1</baseUrl>
|
|
|
|
<auth type="apiKey">
|
|
<header>X-Goog-Api-Key</header>
|
|
<format>${API_KEY}</format>
|
|
</auth>
|
|
|
|
<operations>
|
|
|
|
<operation id="travel.flight.estimate_emissions">
|
|
<http method="POST" path="/flights:computeFlightEmissions" />
|
|
|
|
<requestBody format="json">
|
|
{
|
|
"flightSegments": [
|
|
#for leg in request.legs
|
|
{
|
|
"departureAirport": { "code": "${leg.origin_iata}" },
|
|
"arrivalAirport": { "code": "${leg.destination_iata}" }
|
|
}#sep,
|
|
#end
|
|
],
|
|
"cabinClass": "${request.cabin_class}",
|
|
"passengerCount": ${request.passengers}
|
|
}
|
|
</requestBody>
|
|
|
|
<responseMapping>
|
|
<map source="$.flightEmissions[0].co2Grams"
|
|
target="EmissionEstimate.co2_kg"
|
|
transform="divideBy1000" />
|
|
<map source="$.flightEmissions[0].co2eGrams"
|
|
target="EmissionEstimate.co2e_kg"
|
|
transform="divideBy1000" />
|
|
<map source="$.modelVersion"
|
|
target="EmissionEstimate.method_version" />
|
|
<constant target="EmissionEstimate.method_name" value="Travel Impact Model" />
|
|
<constant target="EmissionEstimate.vendor" value="google_tim" />
|
|
<map source="$" target="EmissionEstimate.vendor_raw" />
|
|
</responseMapping>
|
|
</operation>
|
|
|
|
</operations>
|
|
</provider>
|
|
</providers>
|