Search in sources :

Example 91 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project org.hl7.fhir.core by hapifhir.

the class Client method postBatchRequest.

public Bundle postBatchRequest(URI resourceUri, byte[] payload, String resourceFormat, String message, int timeout) throws IOException {
    if (payload == null)
        throw new EFhirClientException("POST requests require a non-null payload");
    RequestBody body = RequestBody.create(MediaType.parse(resourceFormat + ";charset=" + DEFAULT_CHARSET), payload);
    Request.Builder request = new Request.Builder().url(resourceUri.toURL()).post(body);
    return executeBundleRequest(request, resourceFormat, new Headers.Builder().build(), message, retryCount, timeout);
}
Also used : Request(okhttp3.Request) EFhirClientException(org.hl7.fhir.dstu3.utils.client.EFhirClientException) RequestBody(okhttp3.RequestBody)

Example 92 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project org.hl7.fhir.core by hapifhir.

the class Client method issuePostRequest.

public <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat, Headers headers, String message, long timeout) throws IOException {
    if (payload == null)
        throw new EFhirClientException("POST requests require a non-null payload");
    this.payload = payload;
    RequestBody body = RequestBody.create(MediaType.parse(resourceFormat + ";charset=" + DEFAULT_CHARSET), payload);
    Request.Builder request = new Request.Builder().url(resourceUri.toURL()).post(body);
    return executeFhirRequest(request, resourceFormat, headers, message, retryCount, timeout);
}
Also used : Request(okhttp3.Request) EFhirClientException(org.hl7.fhir.r4b.utils.client.EFhirClientException) RequestBody(okhttp3.RequestBody)

Example 93 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project org.hl7.fhir.core by hapifhir.

the class Client method issuePostRequest.

public <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat, Headers headers, String message, long timeout) throws IOException {
    if (payload == null)
        throw new EFhirClientException("POST requests require a non-null payload");
    this.payload = payload;
    RequestBody body = RequestBody.create(MediaType.parse(resourceFormat + ";charset=" + DEFAULT_CHARSET), payload);
    Request.Builder request = new Request.Builder().url(resourceUri.toURL()).post(body);
    return executeFhirRequest(request, resourceFormat, headers, message, retryCount, timeout);
}
Also used : Request(okhttp3.Request) EFhirClientException(org.hl7.fhir.r5.utils.client.EFhirClientException) RequestBody(okhttp3.RequestBody)

Example 94 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project org.hl7.fhir.core by hapifhir.

the class Client method issuePutRequest.

public <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat, Headers headers, String message, long timeout) throws IOException {
    if (payload == null)
        throw new EFhirClientException("PUT requests require a non-null payload");
    this.payload = payload;
    RequestBody body = RequestBody.create(payload);
    Request.Builder request = new Request.Builder().url(resourceUri.toURL()).put(body);
    return executeFhirRequest(request, resourceFormat, headers, message, retryCount, timeout);
}
Also used : Request(okhttp3.Request) EFhirClientException(org.hl7.fhir.r5.utils.client.EFhirClientException) RequestBody(okhttp3.RequestBody)

Example 95 with RequestBody

use of com.reprezen.kaizen.oasparser.model3.RequestBody in project org.hl7.fhir.core by hapifhir.

the class Client method postBatchRequest.

public Bundle postBatchRequest(URI resourceUri, byte[] payload, String resourceFormat, Headers headers, String message, int timeout) throws IOException {
    if (payload == null)
        throw new EFhirClientException("POST requests require a non-null payload");
    RequestBody body = RequestBody.create(MediaType.parse(resourceFormat + ";charset=" + DEFAULT_CHARSET), payload);
    Request.Builder request = new Request.Builder().url(resourceUri.toURL()).post(body);
    return executeBundleRequest(request, resourceFormat, headers, message, retryCount, timeout);
}
Also used : Request(okhttp3.Request) EFhirClientException(org.hl7.fhir.r5.utils.client.EFhirClientException) RequestBody(okhttp3.RequestBody)

Aggregations

RequestBody (okhttp3.RequestBody)1358 Request (okhttp3.Request)785 Response (okhttp3.Response)598 IOException (java.io.IOException)420 Test (org.junit.Test)235 OkHttpClient (okhttp3.OkHttpClient)216 MultipartBody (okhttp3.MultipartBody)213 MediaType (okhttp3.MediaType)204 Call (okhttp3.Call)198 JSONObject (org.json.JSONObject)183 ResponseBody (okhttp3.ResponseBody)177 Callback (okhttp3.Callback)115 FormBody (okhttp3.FormBody)106 Buffer (okio.Buffer)98 File (java.io.File)92 Map (java.util.Map)90 JsonObject (io.vertx.core.json.JsonObject)89 Headers (okhttp3.Headers)88 HashMap (java.util.HashMap)83 HttpUrl (okhttp3.HttpUrl)80