Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added NumbersClient class #16

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/main/java/com/bandwidth/sdk/numbers/NumbersClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.bandwidth.sdk.numbers;

import org.asynchttpclient.AsyncHttpClient;
import org.asynchttpclient.AsyncHttpClientConfig;
import org.asynchttpclient.DefaultAsyncHttpClientConfig;
import org.asynchttpclient.Realm;

import static org.asynchttpclient.Dsl.asyncHttpClient;


public class NumbersClient {

private static String BASE_URL = "https://dashboard.bandwidth.com/api";

private final String account;
private final AsyncHttpClient httpClient;

/**
* Credentials to access Bandwidth's Numbers api
*
* @param account Your account id to use on dashboard.bandwidth.com
* @param username Your username to login to dashboard.bandwidth.com
* @param password Your password to login to dashboard.bandwidth.com
*/
public NumbersClient(String account, String username, String password) {
this.account = account;

AsyncHttpClientConfig httpClientConfig = new DefaultAsyncHttpClientConfig.Builder()
.setRealm(new Realm.Builder(username, password)
.setUsePreemptiveAuth(true)
.setScheme(Realm.AuthScheme.BASIC))
.build();

httpClient = asyncHttpClient(httpClientConfig);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to import this function
import static org.asynchttpclient.Dsl.asyncHttpClient;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

}