use of com.squareup.okhttp.Call in project paypayopa-sdk-java by paypay.
the class UserApi method unlinkUserWithHttpInfo.
/**
* Unlink user
* Unlink a user from the client **Timeout: 15s**
* @param userAuthorizationId (required)
* @return ApiResponse<NotDataResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
protected ApiResponse<NotDataResponse> unlinkUserWithHttpInfo(String userAuthorizationId) throws ApiException {
Call call = unlinkUserValidateBeforeCall(userAuthorizationId);
Type localVarReturnType = new TypeToken<NotDataResponse>() {
}.getType();
return apiClient.execute(call, localVarReturnType, ApiNameConstants.UNLINK_USER);
}
use of com.squareup.okhttp.Call in project paypayopa-sdk-java by paypay.
the class UserApi method getUserAuthorizationStatusWithHttpInfo.
/**
* Get user authorization status
* Get the authorization status of a user **Timeout: 15s**
* @param userAuthorizationId (required)
* @return ApiResponse<UserAuthorizationStatus>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
protected ApiResponse<UserAuthorizationStatus> getUserAuthorizationStatusWithHttpInfo(String userAuthorizationId) throws ApiException {
Call call = getUserAuthorizationStatusValidateBeforeCall(userAuthorizationId);
Type localVarReturnType = new TypeToken<UserAuthorizationStatus>() {
}.getType();
return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_USER_AUTH_STATUS);
}
use of com.squareup.okhttp.Call in project casa by GluuFederation.
the class StytchService method deleteUser.
// curl --request DELETE --url
// https://test.stytch.com/v1/users/user-test-2a80900ef -u
// 'project-test-918d-74cde970a61e:secret-test-N6SYPKrD6RdEk8KJis=' -H
// 'Content-Type: application/json'
public boolean deleteUser(String stytchUserId) {
OkHttpClient httpClient = new OkHttpClient();
String asB64 = new String(new Base64().encode((properties.get("PROJECT_ID") + ":" + properties.get("SECRET")).getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
String authHeader = "Basic " + new String(asB64);
Request request = new Request.Builder().url(getScriptPropertyValue("DELETE_USER_ENDPOINT") + stytchUserId).delete().addHeader(HttpHeaders.AUTHORIZATION, authHeader).addHeader("Content-Type", "application/json").build();
Call call = httpClient.newCall(request);
logger.debug(request.toString() + "-" + request.headers() + "-" + request.body().toString());
try {
Response response = call.execute();
if (response.code() == 200 || response.code() == 201) {
return true;
} else {
logger.debug("Response for enrolling user was : " + response.code() + "---" + response.message());
return false;
}
} catch (IOException e) {
logger.error(e.getMessage(), e);
return false;
}
}
use of com.squareup.okhttp.Call in project yoo_home_Android by culturer.
the class OkHttpStack method performRequest.
@Override
public URLHttpResponse performRequest(Request<?> request, ArrayList<HttpParamsEntry> additionalHeaders) throws IOException {
OkHttpClient client = mClient.clone();
int timeoutMs = request.getTimeoutMs();
client.setConnectTimeout(timeoutMs, TimeUnit.MILLISECONDS);
client.setReadTimeout(timeoutMs, TimeUnit.MILLISECONDS);
client.setWriteTimeout(timeoutMs, TimeUnit.MILLISECONDS);
com.squareup.okhttp.Request.Builder okHttpRequestBuilder = new com.squareup.okhttp.Request.Builder();
okHttpRequestBuilder.url(request.getUrl());
for (final HttpParamsEntry entry : request.getHeaders()) {
okHttpRequestBuilder.addHeader(entry.k, entry.v);
}
for (final HttpParamsEntry entry : additionalHeaders) {
okHttpRequestBuilder.addHeader(entry.k, entry.v);
}
setConnectionParametersForRequest(okHttpRequestBuilder, request);
com.squareup.okhttp.Request okHttpRequest = okHttpRequestBuilder.build();
Call okHttpCall = client.newCall(okHttpRequest);
Response okHttpResponse = okHttpCall.execute();
return responseFromConnection(okHttpResponse);
}
use of com.squareup.okhttp.Call in project apiman by apiman.
the class EnrichPre21ExportCommand method downloadExportJson.
private File downloadExportJson(DownloadBean downloadBean) throws IOException {
LOGGER.info("Successfully triggered an export operation on the Manager API.");
HttpUrl downloadUrl = HttpUrl.parse(endpoint).newBuilder().addPathSegment("downloads").addPathSegment(downloadBean.getId()).build();
Request downloadRequest = buildRequest(downloadUrl);
Call downloadCall = client.newCall(downloadRequest);
Response downloadResponse = downloadCall.execute();
checkStatusOk(downloadResponse);
File downloadedFileTmp = File.createTempFile("EnrichPre21Export", ".json");
// Get the underlying okio source, as it has some nice methods for writing directly without loads of copying.
BufferedSource source = downloadResponse.body().source();
BufferedSink buff = Okio.buffer(Okio.sink(downloadedFileTmp));
buff.writeAll(source);
buff.close();
LOGGER.debug("Successfully downloaded an Apiman export to tmp: {}", downloadedFileTmp);
return downloadedFileTmp;
}
Aggregations