001
002package io.vrap.rmf.base.client;
003
004public interface ServiceRegionConfig {
005
006    /**
007     * @return API base URL
008     */
009    public String getApiUrl();
010
011    /**
012     * @return auth base URL
013     */
014    public String getAuthUrl();
015
016    /**
017     * @return URL for requesting client credentials flow access token
018     */
019    public default String getOAuthTokenUrl() {
020        return getAuthUrl() + "/oauth/token";
021    }
022
023    /**
024     * @param projectKey
025     * @return URL for requesting anonymous flow access token
026     */
027    public default String getAnonymousFlowTokenURL(final String projectKey) {
028        return getAuthUrl() + "/oauth/" + projectKey + "/anonymous/token";
029    }
030
031    /**
032     * @param projectKey
033     * @return URL for requesting password flow access token
034     */
035    public default String getPasswordFlowTokenURL(final String projectKey) {
036        return getAuthUrl() + "/oauth/" + projectKey + "/customers/token";
037    }
038
039    /**
040     * @param projectKey
041     * @param storeKey
042     * @return URL for requesting in store password flow access token
043     */
044    public default String getInstorePasswordFlowTokenURL(final String projectKey, final String storeKey) {
045        return getAuthUrl() + "/oauth/" + projectKey + "/in-store/key=" + storeKey + "/customers/token";
046    }
047}