Skip to content

Commit 09f5611

Browse files
committed
clean files
1 parent a88a01c commit 09f5611

File tree

3 files changed

+6
-53
lines changed

3 files changed

+6
-53
lines changed

docs/PhoneNumberLookupApi.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public class Example {
146146

147147
### Authorization
148148

149-
[Basic](../README.md#Basic)
149+
[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2)
150150

151151
### HTTP request headers
152152

@@ -187,6 +187,10 @@ public class Example {
187187
Basic.setUsername("YOUR USERNAME");
188188
Basic.setPassword("YOUR PASSWORD");
189189

190+
// Configure OAuth2 access token for authorization: OAuth2
191+
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
192+
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
193+
190194
PhoneNumberLookupApi apiInstance = new PhoneNumberLookupApi(defaultClient);
191195
String accountId = "9900000"; // String |
192196
UUID requestId = UUID.fromString("004223a0-8b17-41b1-bf81-20732adf5590"); // UUID |

src/main/java/com/bandwidth/sdk/ApiClient.java

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
*/
6767
public class ApiClient {
6868

69-
protected String basePath = "http://localhost";
7069
protected String basePath = "http://localhost";
7170
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
7271
new ServerConfiguration(
@@ -81,36 +80,21 @@ public class ApiClient {
8180
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
8281
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
8382
protected String tempFolderPath = null;
84-
protected boolean debugging = false;
85-
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
86-
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
87-
protected String tempFolderPath = null;
8883

89-
protected Map<String, Authentication> authentications;
9084
protected Map<String, Authentication> authentications;
9185

92-
protected DateFormat dateFormat;
93-
protected DateFormat datetimeFormat;
94-
protected boolean lenientDatetimeFormat;
95-
protected int dateLength;
9686
protected DateFormat dateFormat;
9787
protected DateFormat datetimeFormat;
9888
protected boolean lenientDatetimeFormat;
9989
protected int dateLength;
10090

101-
protected InputStream sslCaCert;
102-
protected boolean verifyingSsl;
103-
protected KeyManager[] keyManagers;
10491
protected InputStream sslCaCert;
10592
protected boolean verifyingSsl;
10693
protected KeyManager[] keyManagers;
10794

108-
protected OkHttpClient httpClient;
109-
protected JSON json;
11095
protected OkHttpClient httpClient;
11196
protected JSON json;
11297

113-
protected HttpLoggingInterceptor loggingInterceptor;
11498
protected HttpLoggingInterceptor loggingInterceptor;
11599

116100
/**
@@ -215,7 +199,6 @@ protected void initHttpClient() {
215199
initHttpClient(Collections.<Interceptor>emptyList());
216200
}
217201

218-
protected void initHttpClient(List<Interceptor> interceptors) {
219202
protected void initHttpClient(List<Interceptor> interceptors) {
220203
OkHttpClient.Builder builder = new OkHttpClient.Builder();
221204
builder.addNetworkInterceptor(getProgressInterceptor());
@@ -226,7 +209,6 @@ protected void initHttpClient(List<Interceptor> interceptors) {
226209
httpClient = builder.build();
227210
}
228211

229-
protected void init() {
230212
protected void init() {
231213
verifyingSsl = true;
232214

@@ -252,8 +234,6 @@ public String getBasePath() {
252234
*
253235
* @param basePath Base path of the URL (e.g http://localhost)
254236
* @return An instance of ApiClient
255-
* @param basePath Base path of the URL (e.g http://localhost)
256-
* @return An instance of ApiClient
257237
*/
258238
public ApiClient setBasePath(String basePath) {
259239
this.basePath = basePath;
@@ -302,7 +282,6 @@ public OkHttpClient getHttpClient() {
302282
*
303283
* @param newHttpClient An instance of OkHttpClient
304284
* @return ApiClient
305-
* @return ApiClient
306285
* @throws java.lang.NullPointerException when newHttpClient is null
307286
*/
308287
public ApiClient setHttpClient(OkHttpClient newHttpClient) {
@@ -810,7 +789,6 @@ public List<Pair> parameterToPair(String name, Object value) {
810789
* @param value The value of the parameter.
811790
* @return A list of {@code Pair} objects.
812791
*/
813-
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection<?> value) {
814792
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection<?> value) {
815793
List<Pair> params = new ArrayList<Pair>();
816794

@@ -919,7 +897,6 @@ public String collectionPathParameterToString(String collectionFormat, Collectio
919897
*/
920898
public String sanitizeFilename(String filename) {
921899
return filename.replaceFirst("^.*[/\\\\]", "");
922-
return filename.replaceFirst("^.*[/\\\\]", "");
923900
}
924901

925902
/**
@@ -1029,8 +1006,6 @@ public <T> T deserialize(Response response, Type returnType) throws ApiException
10291006
return (T) downloadFileFromResponse(response);
10301007
}
10311008

1032-
ResponseBody respBody = response.body();
1033-
if (respBody == null) {
10341009
ResponseBody respBody = response.body();
10351010
if (respBody == null) {
10361011
return null;
@@ -1041,18 +1016,6 @@ public <T> T deserialize(Response response, Type returnType) throws ApiException
10411016
// ensuring a default content type
10421017
contentType = "application/json";
10431018
}
1044-
try {
1045-
if (isJsonMime(contentType)) {
1046-
return JSON.deserialize(respBody.byteStream(), returnType);
1047-
} else if (returnType.equals(String.class)) {
1048-
String respBodyString = respBody.string();
1049-
if (respBodyString.isEmpty()) {
1050-
return null;
1051-
}
1052-
// Expecting string, return the raw response body.
1053-
return (T) respBodyString;
1054-
} else {
1055-
throw new ApiException(
10561019
try {
10571020
if (isJsonMime(contentType)) {
10581021
return JSON.deserialize(respBody.byteStream(), returnType);
@@ -1070,10 +1033,6 @@ public <T> T deserialize(Response response, Type returnType) throws ApiException
10701033
response.headers().toMultimap(),
10711034
response.body().string());
10721035
}
1073-
} catch (IOException e) {
1074-
throw new ApiException(e);
1075-
response.body().string());
1076-
}
10771036
} catch (IOException e) {
10781037
throw new ApiException(e);
10791038
}
@@ -1404,8 +1363,6 @@ public String buildUrl(String baseUrl, String path, List<Pair> queryParams, List
14041363
throw new ArrayIndexOutOfBoundsException(String.format(
14051364
Locale.ROOT,
14061365
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
1407-
Locale.ROOT,
1408-
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
14091366
));
14101367
}
14111368
baseURL = servers.get(serverIndex).URL(serverVariables);
@@ -1478,12 +1435,10 @@ public void processHeaderParams(Map<String, String> headerParams, Request.Builde
14781435
public void processCookieParams(Map<String, String> cookieParams, Request.Builder reqBuilder) {
14791436
for (Entry<String, String> param : cookieParams.entrySet()) {
14801437
reqBuilder.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
1481-
reqBuilder.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
14821438
}
14831439
for (Entry<String, String> param : defaultCookieMap.entrySet()) {
14841440
if (!cookieParams.containsKey(param.getKey())) {
14851441
reqBuilder.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
1486-
reqBuilder.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
14871442
}
14881443
}
14891444
}
@@ -1576,7 +1531,6 @@ public String guessContentTypeFromFile(File file) {
15761531
* @param key The key of the Header element
15771532
* @param file The file to add to the Header
15781533
*/
1579-
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
15801534
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) {
15811535
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\"");
15821536
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
@@ -1590,7 +1544,6 @@ protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String
15901544
* @param key The key of the Header element
15911545
* @param obj The complex object to add to the Header
15921546
*/
1593-
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
15941547
protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) {
15951548
RequestBody requestBody;
15961549
if (obj instanceof String) {
@@ -1613,7 +1566,6 @@ protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String
16131566
* Get network interceptor to add it to the httpClient to track download progress for
16141567
* async requests.
16151568
*/
1616-
protected Interceptor getProgressInterceptor() {
16171569
protected Interceptor getProgressInterceptor() {
16181570
return new Interceptor() {
16191571
@Override
@@ -1635,7 +1587,6 @@ public Response intercept(Interceptor.Chain chain) throws IOException {
16351587
* Apply SSL related settings to httpClient according to the current values of
16361588
* verifyingSsl and sslCaCert.
16371589
*/
1638-
protected void applySslSettings() {
16391590
protected void applySslSettings() {
16401591
try {
16411592
TrustManager[] trustManagers;
@@ -1698,7 +1649,6 @@ public boolean verify(String hostname, SSLSession session) {
16981649
}
16991650
}
17001651

1701-
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
17021652
protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
17031653
try {
17041654
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
@@ -1716,7 +1666,6 @@ protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityExcep
17161666
* @return The string representation of the HTTP request body
17171667
* @throws com.bandwidth.sdk.ApiException If fail to serialize the request body object into a string
17181668
*/
1719-
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
17201669
protected String requestBodyToString(RequestBody requestBody) throws ApiException {
17211670
if (requestBody != null) {
17221671
try {

src/main/java/com/bandwidth/sdk/api/PhoneNumberLookupApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public okhttp3.Call createSyncLookupCall(@javax.annotation.Nonnull String accoun
276276
localVarHeaderParams.put("Content-Type", localVarContentType);
277277
}
278278

279-
String[] localVarAuthNames = new String[] { "Basic" };
279+
String[] localVarAuthNames = new String[] { "Basic", "OAuth2" };
280280
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
281281
}
282282

0 commit comments

Comments
 (0)