initial draft commit
This commit is contained in:
97
providers.xml
Normal file
97
providers.xml
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<providers xmlns="https://calco2la.to/schema/providers/v1">
|
||||
<provider id="calco2lato">
|
||||
<name>calco2la.to</name>
|
||||
<baseUrl>https://api.calco2la.to</baseUrl>
|
||||
<auth type="apiKey">
|
||||
<header>Authorization</header>
|
||||
<format>Bearer ${API_KEY}</format>
|
||||
</auth>
|
||||
<operations>
|
||||
<operation id="travel.flight.estimate_emissions">
|
||||
<http method="POST" path="/v1/flight/estimate" />
|
||||
<requestBody format="json">
|
||||
{
|
||||
"legs": [
|
||||
#for leg in request.legs
|
||||
{
|
||||
"origin": "${leg.origin_iata}",
|
||||
"destination": "${leg.destination_iata}",
|
||||
"departure_time": "${leg.departure_time}"
|
||||
}#sep,
|
||||
#end
|
||||
],
|
||||
"cabin_class": "${request.cabin_class}",
|
||||
"passengers": ${request.passengers},
|
||||
"include_non_co2": ${request.include_non_co2}
|
||||
}
|
||||
</requestBody>
|
||||
<responseMapping>
|
||||
<map source="$.co2_kg" target="EmissionEstimate.co2_kg" />
|
||||
<map source="$.co2e_kg" target="EmissionEstimate.co2e_kg" />
|
||||
<map source="$.non_co2_mult" target="EmissionEstimate.non_co2_multiplier" />
|
||||
<map source="$.method.name" target="EmissionEstimate.method_name" />
|
||||
<map source="$.method.version" target="EmissionEstimate.method_version" />
|
||||
<map source="$.standard" target="EmissionEstimate.standard" />
|
||||
<map source="$.documentation_url" target="EmissionEstimate.documentation_url" />
|
||||
<map source="$" target="EmissionEstimate.vendor_raw" />
|
||||
</responseMapping>
|
||||
</operation>
|
||||
<operation id="travel.airport.search">
|
||||
<http method="GET" path="/v1/airports/search" />
|
||||
<requestQuery>
|
||||
<param name="q" from="AirportSearchRequest.query" />
|
||||
<param name="limit" from="AirportSearchRequest.limit" />
|
||||
</requestQuery>
|
||||
<responseMapping>
|
||||
<list target="AirportInfo">
|
||||
<item source="$.results[*]">
|
||||
<map source="$.iata" target="AirportInfo.iata_code" />
|
||||
<map source="$.icao" target="AirportInfo.icao_code" />
|
||||
<map source="$.name" target="AirportInfo.name" />
|
||||
<map source="$.city" target="AirportInfo.city" />
|
||||
<map source="$.country" target="AirportInfo.country" />
|
||||
<map source="$.lat" target="AirportInfo.latitude" />
|
||||
<map source="$.lon" target="AirportInfo.longitude" />
|
||||
</item>
|
||||
</list>
|
||||
</responseMapping>
|
||||
</operation>
|
||||
</operations>
|
||||
</provider>
|
||||
<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>
|
||||
Reference in New Issue
Block a user