initial draft commit
This commit is contained in:
77
providers/calco2lato/calco2lato.xml
Normal file
77
providers/calco2lato/calco2lato.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<?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>
|
||||
|
||||
<!-- travel.flight.estimate_emissions -->
|
||||
<operation id="travel.flight.estimate_emissions">
|
||||
<http method="POST" path="/v1/flight/estimate" />
|
||||
|
||||
<!-- Template-based request body in provider's JSON shape -->
|
||||
<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>
|
||||
|
||||
<!-- How to interpret provider's JSON response -->
|
||||
<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" />
|
||||
<!-- store full JSON -->
|
||||
<map source="$" target="EmissionEstimate.vendor_raw" />
|
||||
</responseMapping>
|
||||
</operation>
|
||||
|
||||
<!-- travel.airport.search -->
|
||||
<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>
|
||||
<!-- array mapping: one AirportInfo per item in $.results[] -->
|
||||
<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>
|
||||
</providers>
|
||||
Reference in New Issue
Block a user