All Downloads are FREE. Search and download functionalities are using the official Maven repository.

travel.izi.api.service.CountryService Maven / Gradle / Ivy

Go to download

Java wrapper around the izi.TRAVEL API using Retrofit. Remote services are grouped into local service objects which can be centrally managed by a IZITravel instance. It will act as a factory for all of the services and will automatically initialize them with your credentials and API key.

There is a newer version: 1.6.0
Show newest version
/*
 * Copyright (C) 2014 IZITEQ B.V.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package travel.izi.api.service;

import retrofit.client.Response;
import retrofit.http.GET;
import retrofit.http.Path;
import retrofit.http.Query;
import travel.izi.api.IZITravelCallback;
import travel.izi.api.model.entity.CompactMtgObject;
import travel.izi.api.model.entity.FullMtgObject;

import java.util.List;

/**
 * Endpoints for Country.
 */
@SuppressWarnings("unused")
public interface CountryService {

    /**
     * Get list of compact Country objects which have content on requested languages.
     *
     * @param languages Array of languages which should have country.
     * @param includes  Array of sections which should be included to country object.
     * @param except    Array of sections which should NOT be included to country object.
     * @param limit     Limit for pagination, defaults to 20.
     * @param offset    Offset for pagination, defaults to 0.
     * @return List of countries which have content on requested languages. Returns empty list of there
     * are no matched countries.
     * @see #getFullCountries(String[], String[], String[], Long, Long)
     */
    @GET("/countries?form=compact")
    List getCompactCountries(
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset
    );

    /**
     * Asynchronous version of {@link #getCompactCountries(String[], String[], String[], Long, Long)}.
     */
    @GET("/countries?form=compact")
    void getCompactCountries(
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset,
            IZITravelCallback> callback
    );

    /**
     * Get list of full Country objects which have content on requested languages.
     *
     * @see #getCompactCountries(String[], String[], String[], Long, Long)
     */
    @GET("/countries?form=full")
    List getFullCountries(
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset
    );

    /**
     * Asynchronous version of {@link #getFullCountries(String[], String[], String[], Long, Long)}.
     */
    @GET("/countries?form=full")
    void getFullCountries(
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset,
            IZITravelCallback> callback
    );

    @GET("/countries")
    Response getCountriesResponse(
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset,
            @Query("form") String form
    );

    /**
     * Get full Country object by UUID.
     *
     * @param uuid      UUID of the Country.
     * @param languages Array of languages which should have country.
     * @param includes  Array of sections which should be included to country object.
     * @param except    Array of sections which should NOT be included to country object.
     * @return Country or 404 HTTP code if there is no Country with provided UUID.
     */
    @GET("/countries/{uuid}")
    FullMtgObject getCountry(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except
    );

    /**
     * Asynchronous version of {@link #getCountry(String, String[], String[], String[])}.
     */
    @GET("/countries/{uuid}")
    void getCountry(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            IZITravelCallback callback
    );

    @GET("/countries/{uuid}")
    Response getCountryResponse(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("form") String form
    );

    /**
     * Get Country children in compact form.
     *
     * @param uuid      UUID of the Country.
     * @param languages Array of requested languages, i.e. Country's children should have one of the requested languages.
     * @param includes  Array of sections which should be included into response.
     * @param except    Array of sections which should NOT be included into response.
     * @param limit     Limit for pagination, defaults to 20.
     * @param offset    Offset for pagination, defaults to 0.
     * @return Tours and Museums which belongs to the country. Returns 404 HTTP code if there is no Country with provided UUID.
     * @see #getFullChildren(String, String[], String[], String[], Long, Long, Boolean)
     */
    @GET("/countries/{uuid}/children?form=compact")
    List getCompactChildren(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset
    );

    /**
     * Asynchronous version of {@link #getCompactChildren(String, String[], String[], String[], Long, Long)}.
     */
    @GET("/countries/{uuid}/children?form=compact")
    void getCompactChildren(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset,
            IZITravelCallback> callback
    );

    /**
     * Get Country children in full form.
     *
     * @see #getCompactChildren(String, String[], String[], String[], Long, Long)
     */
    @GET("/countries/{uuid}/children?form=full")
    List getFullChildren(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset,
            @Query("children_count_in_full_form") Boolean children_count
    );

    /**
     * Asynchronous version of {@link #getFullChildren(String, String[], String[], String[], Long, Long, Boolean)}.
     */
    @GET("/countries/{uuid}/children?form=full")
    void getFullChildren(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset,
            @Query("children_count_in_full_form") Boolean children_count,
            IZITravelCallback> callback
    );

    @GET("/countries/{uuid}/children")
    Response getChildrenResponse(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset,
            @Query("children_count_in_full_form") Boolean children_count,
            @Query("form") String form
    );

    /**
     * Get list of compact City objects which belong to the Country with requested UUID.
     *
     * @param uuid      UUID of the Country.
     * @param languages Array of requested languages, each Country's City should have content at one of the requested language.
     * @param includes  Array of sections which should be included to city object.
     * @param except    Array of sections which should NOT be included to city object.
     * @param limit     Limit for pagination, defaults to 20.
     * @param offset    Offset for pagination, defaults to 0.
     * @return List of cities which belong to requested Country and have content on requested languages object or
     * 404 HTTP code if there is no Country with provided UUID.
     * @see #getFullCities(String, String[], String[], String[], Long, Long)
     */
    @GET("/countries/{uuid}/cities?form=compact")
    List getCompactCities(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset
    );

    /**
     * Asynchronous version of {@link #getCompactCities(String, String[], String[], String[], Long, Long)}.
     */
    @GET("/countries/{uuid}/cities?form=compact")
    void getCompactCities(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset,
            IZITravelCallback> callback
    );

    /**
     * Get list of full City objects which belong to the Country with requested UUID.
     *
     * @see #getCompactCities(String, String[], String[], String[], Long, Long)
     */
    @GET("/countries/{uuid}/cities?form=full")
    List getFullCities(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset
    );

    /**
     * Asynchronous version of {@link #getFullCities(String, String[], String[], String[], Long, Long)}.
     */
    @GET("/countries/{uuid}/cities?form=full")
    void getFullCities(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset,
            IZITravelCallback> callback
    );

    @GET("/countries/{uuid}/cities")
    Response getCitiesResponse(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            @Query("includes") String[] includes,
            @Query("except") String[] except,
            @Query("limit") Long limit,
            @Query("offset") Long offset,
            @Query("form") String form
    );

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy