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

com.testfabrik.webmate.javasdk.WebmateEnvironment Maven / Gradle / Ivy

There is a newer version: 0.56
Show newest version
package com.testfabrik.webmate.javasdk;

import java.net.URI;
import java.net.URISyntaxException;


/**
 * The WebmateEnvironment contains important parameters for accessing webmate, e.g. the API base URI.
 */
public class WebmateEnvironment {

    private final static String WEBMATE_DEFAULT_BASEURI = "https://api.webmate.io/v1";

    public final URI baseURI;

    public static WebmateEnvironment create() {
        URI baseUri;
        try {
           baseUri = new URI(WEBMATE_DEFAULT_BASEURI);
        } catch (URISyntaxException e) {
            throw new WebmateApiClientException("Could not create webmate Environment. Invalid URL.", e);
        }
        return new WebmateEnvironment(baseUri);
    }

    public static WebmateEnvironment create(URI baseUri) {
        return new WebmateEnvironment(baseUri.normalize());
    }

    /**
     * Create WebmateEnvironment with new base URI.
     * @param baseURI Base URI to webmate API
     */
    protected WebmateEnvironment(URI baseURI) {
        this.baseURI = baseURI;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy