use of com.reprezen.kaizen.oasparser.model3.MediaType in project olvid-android by olvid-io.
the class OkHttpSardine method put.
@Override
public void put(String url, File localFile, String contentType, boolean expectContinue, String lockToken) throws IOException {
MediaType mediaType = contentType == null ? null : MediaType.parse(contentType);
RequestBody requestBody = RequestBody.create(mediaType, localFile);
Headers.Builder headersBuilder = new Headers.Builder();
if (expectContinue) {
headersBuilder.add("Expect", "100-Continue");
}
if (!TextUtils.isEmpty(lockToken)) {
addLockTokenToHeaders(headersBuilder, url, lockToken);
}
put(url, requestBody, headersBuilder.build());
}
use of com.reprezen.kaizen.oasparser.model3.MediaType in project tbdex-protocol by TBD54566975.
the class RealCircleClient method transfer.
@Override
public void transfer(TransferRequest transferRequest) throws Exception {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, gson.toJson(transferRequest));
Request request = requestBuilder.url("https://api-sandbox.circle.com/v1/transfers").post(body).build();
client.newCall(request).execute();
}
use of com.reprezen.kaizen.oasparser.model3.MediaType in project tbdex-protocol by TBD54566975.
the class RealCircleClient method createBankAccount.
@Override
public BankAccount createBankAccount(CreateBankAccountRequest createBankAccountRequest) throws Exception {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, gson.toJson(createBankAccountRequest));
Request request = requestBuilder.url("https://api-sandbox.circle.com/v1/businessAccount/banks/wires").post(body).build();
Response response = client.newCall(request).execute();
JSONObject data = new JSONObject(response.body().string()).getJSONObject("data");
return new BankAccount.Builder().trackingRef(data.getString("trackingRef")).id(data.getString("id")).build();
}
use of com.reprezen.kaizen.oasparser.model3.MediaType in project tbdex-protocol by TBD54566975.
the class RealCircleClient method createWirePayment.
@Override
public void createWirePayment(CreateWirePaymentRequest createWirePaymentRequest) throws Exception {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, gson.toJson(createWirePaymentRequest));
Request request = requestBuilder.url("https://api-sandbox.circle.com/v1/mocks/payments/wire").post(body).build();
client.newCall(request).execute();
}
use of com.reprezen.kaizen.oasparser.model3.MediaType in project student-manager by SYYANI.
the class CourseSelectFragment method initCourseSelectList.
private void initCourseSelectList() throws JSONException, IOException {
MediaType JSON = MediaType.parse("application/json;charset=utf-8");
JSONObject json = new JSONObject();
json.put("cid", courseSelectFragmentBinding.selectCourseFragmentInputClassNumber.getText().toString());
json.put("cname", courseSelectFragmentBinding.selectCourseFragmentCourseName.getText().toString());
json.put("tid", courseSelectFragmentBinding.selectCourseFragmentTeacherNumberTid.getText().toString());
json.put("tname", courseSelectFragmentBinding.selectCourseFragmentTeacherNameTname.getText().toString());
json.put("tFuzzy", courseSelectFragmentBinding.selectCourseCheckboxIsFuzzy.isChecked());
json.put("cFuzzy", courseSelectFragmentBinding.selectCourseCheckboxIsFuzzy.isChecked());
Log.d(TAG, "initCourseSelectList: " + json.toString());
new Thread() {
@Override
public void run() {
super.run();
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(JSON, json.toString());
Request request = new Request.Builder().url("http://101.35.20.64:10086/courseTeacher/findCourseTeacherInfo").method("POST", body).addHeader("Content-Type", "application/json").build();
Response response = null;
try {
response = client.newCall(request).execute();
} catch (IOException e) {
e.printStackTrace();
}
if (response.isSuccessful()) {
ArrayList<CourseStudent> tlist = null;
try {
// Log.d(TAG, "run: "+response.body().string());
tlist = new Gson().fromJson(response.body().string(), new TypeToken<ArrayList<CourseStudent>>() {
}.getType());
// mlist.addAll(tlist);
courseSelectViewModel.setMutableLiveData_student_select_course_list(tlist);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}.start();
}
Aggregations