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

travel.izi.api.service.PublisherService 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 Publisher.
 */
@SuppressWarnings("unused")
public interface PublisherService {

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

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

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

    /**
     * Get Publisher children in compact form.
     *
     * @param uuid      UUID of the Publisher.
     * @param languages Array of requested languages, i.e. Publisher's children should have one of the requested languages.
     * @param includes  Array of sections which should be included.
     * @param except    Array of sections which should NOT be included.
     * @param limit     Limit for pagination, defaults to 20.
     * @param offset    Offset for pagination, defaults to 0.
     * @return Tours and Museums which belongs to the Publisher. Returns 404 HTTP code if there is no Publisher with provided UUID.
     * @see #getFullChildren(String, String[], String[], String[], Long, Long, Boolean)
     */
    @GET("/mtg/publishers/{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("/mtg/publishers/{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 Publisher children in full form.
     *
     * @see #getCompactChildren(String, String[], String[], String[], Long, Long)
     */
    @GET("/mtg/publishers/{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("/mtg/publishers/{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("/mtg/publishers/{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 the number of Publisher’s children (museums, tours)
     *
     * @param uuid      UUID of the Publisher.
     * @param languages Array of requested languages. Publisher’s children should have one of the requested languages.
     * @return Number of children (tours and museums).
     */
    @GET("/mtg/publishers/{uuid}/children/count")
    Integer getChildrenCount(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages
    );

    /**
     * Asynchronous version of {@link #getChildrenCount(String, String[])}.
     */
    @GET("/mtg/publishers/{uuid}/children/count")
    void getChildrenCount(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            IZITravelCallback callback
    );

    @GET("/mtg/publishers/{uuid}/children/count")
    Response getChildrenCountResponse(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages
    );

    /**
     * Get Publisher languages by UUID, i.e. returns list of unique languages on which Publisher have content.
     *
     * @param uuid      UUID of the Publisher.
     * @param languages Array of requested languages. The resulting list of languages to be contained in this array.
     * @return List of languages.
     */
    @GET("/mtg/publishers/{uuid}/children/languages")
    List getLanguages(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages
    );

    /**
     * Asynchronous version of {@link #getLanguages(String, String[])}.
     */
    @GET("/mtg/publishers/{uuid}/children/languages")
    void getLanguages(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages,
            IZITravelCallback> callback
    );

    @GET("/mtg/publishers/{uuid}/children/languages")
    Response getLanguagesResponse(
            @Path("uuid") String uuid,
            @Query("languages") String[] languages
    );

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy