/**
* This file was automatically generated by the Mule Development Kit
*/
package org.mule.modules;
import java.io.IOException;
import org.mule.api.annotations.Configurable;
import org.mule.api.annotations.Connector;
import org.mule.api.annotations.Processor;
import org.mule.api.annotations.param.Optional;
import org.mule.api.annotations.rest.HttpMethod;
import org.mule.api.annotations.rest.RestCall;
import org.mule.api.annotations.rest.RestExceptionOn;
import org.mule.api.annotations.rest.RestQueryParam;
/**
* Cloud Connector
*
* @author MuleSoft, Inc.
*/
@Connector(name="brewerydb", schemaVersion="1.0-SNAPSHOT")
public abstract class BrewerydbConnector
{
/**
* API key to be passed along with the request.
*/
//<start id="lis_13_brewery-config"/>
@Configurable//<co id="lis_13_brewery-config_1"/>
@RestQueryParam("apiKey")
private String apiKey;
//<end id="lis_13_brewery-config"/>
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
//<start id="lis_13_brewery-javadoc"/>
/**
* Gets a listing of all beers. Results will be paginated with 50
* results per page. One of the following attributes must be set:
* name, abv, ibu, srmId, availabilityId, styleId.
* {@sample.xml ../../../doc/brewerydb-connector.xml.sample
* brewerydb:get-beers}
*
* @param page Page Number.
* @param ids ID's of the beers to return, comma separated.
* @param beerName Name of a beer.
* @param abv ABV for a beer
* @param ibu IBUs for a beer.
* @param glasswareId ID for glassware.
* @param srmId ID for SRM.
* @param availableId ID for availability.
* @param styleId ID for style.
* @param isOrganic Certified organic or not (Y/N).
* @param hasLabels Has a label (Y/N).
* @param year Year vintage of the beer.
* @param since What has been updated since that date.
* @param status Status of the brewery.
* @param order How the results should be ordered.
* @param sort How the results should be sorted.
* @param withBreweries Include brewery information.
* @return JSON structure with the beers in the db.
* @throws IOException on error connecting to the api.
*/
//<end id="lis_13_brewery-javadoc"/>
//<start id="lis_13_brewery"/>
@Processor
@RestCall(uri = "http://api.brewerydb.com/v2/beers",
method = HttpMethod.GET,
contentType ="application/json",
exceptions={@RestExceptionOn(
expression=
"#[message.inboundProperties['http.status'] != 200]")})
public abstract String getBeers(
@Optional @RestQueryParam("p") int page,
@Optional @RestQueryParam("ids") String ids,
@Optional @RestQueryParam("name") String beerName,
@Optional @RestQueryParam("abv") String abv,
@Optional @RestQueryParam("ibu") String ibu,
@Optional @RestQueryParam("apiKey") String glasswareId,
@Optional @RestQueryParam("glasswareId") String srmId,
@Optional @RestQueryParam("srmId") String availableId,
@Optional @RestQueryParam("availableId") String styleId,
@Optional @RestQueryParam("styleId") String isOrganic,
@Optional @RestQueryParam("hasLabels") String hasLabels,
@Optional @RestQueryParam("year") int year,
@Optional @RestQueryParam("apiKey") int since,
@Optional @RestQueryParam("status") String status,
@Optional @RestQueryParam("order") String order,
@Optional @RestQueryParam("sort") String sort,
@Optional @RestQueryParam("withBreweries") String withBreweries
) throws IOException;
//<end id="lis_13_brewery"/>
}