001package com.plivo.api;
002
003public class Plivo {
004
005  private static PlivoClient plivoInstance = null;
006  private static PlivoClient phloInstance = null;
007
008  /**
009   * Initializes the global {@link PlivoClient} plivoInstance
010   */
011  public static synchronized void init(String authId, String authToken) {
012    plivoInstance = new PlivoClient(authId, authToken);
013    phloInstance = new PhloRestClient(authId, authToken).getClient();
014  }
015
016  /**
017   * Initializes the global {@link PlivoClient} plivoInstance, taking the authId and authToken from
018   * environment variables called PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN.
019   */
020  public static synchronized void init() {
021    init(System.getenv("PLIVO_AUTH_ID"), System.getenv("PLIVO_AUTH_TOKEN"));
022  }
023
024  public static PlivoClient getClient() {
025    return plivoInstance;
026  }
027
028  public static PlivoClient getPhloClient() {
029    return phloInstance;
030  }
031}