/// <summary> /// Create a new instance /// </summary> /// <param name="apiKey">API key</param> /// <param name="clientConfig">Client config</param> public MapsAPIClient(string apiKey, MapsAPIClientConfig clientConfig) { // Check API key if (apiKey == null) { // Must provide API key or enterprise credentials when creating client. throw new APICredentialsNotSpecifiedException(); } // Validate API key if (apiKey != null && !apiKey.StartsWith("AIza")) { // Invalid API key provided throw new APIKeyInvalidException(); } // Assign API key to instance APIKey = apiKey; // Init sent times SentTimes = new List <DateTime>(); // Assign and initialize config ClientConfig = clientConfig; ClientConfig.Init(); }
/// <summary> /// Create a new instance /// </summary> /// <param name="clientId">Client Id</param> /// <param name="clientSecret">Client secret</param> /// <param name="clientConfig">Client config</param> public MapsAPIClient(string clientId, string clientSecret, MapsAPIClientConfig clientConfig) { // Check enterprise credentials if (clientId == null || clientSecret == null) { // Must provide API key or enterprise credentials when creating client. throw new APICredentialsNotSpecifiedException(); } // Assign enterprise credentials to instance ClientId = clientId; ClientSecret = clientSecret; // Init sent times SentTimes = new List <DateTime>(); // Assign and initialize config ClientConfig = clientConfig; ClientConfig.Init(); }
/// <summary> /// Create a new instance (with default configuration) /// </summary> /// <param name="clientId">Client Id</param> /// <param name="clientSecret">Client secret</param> public MapsAPIClient(string clientId, string clientSecret) : this(clientId, clientSecret, MapsAPIClientConfig.Default()) { }
/// <summary> /// Create a new instance (with default configuration) /// </summary> /// <param name="apiKey">API key</param> public MapsAPIClient(string apiKey) : this(apiKey, MapsAPIClientConfig.Default()) { }