All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kaltura.client.utils.request.ExecutedRequest Maven / Gradle / Ivy

Go to download

KalturaClient is a library of Java classes that can be used to interact with the Kaltura REST API. More information about the REST API can be found at http://corp.kaltura.com/Products/Kaltura-API Many of the Java classes in this library are auto-generated from a schema that defines the objects that are used to interect with the API. The current schema can be found at http://www.kaltura.com/api_v3/api_schema.php

There is a newer version: 19.3.0
Show newest version
package com.kaltura.client.utils.request;

import com.kaltura.client.utils.ErrorElement;
import com.kaltura.client.utils.response.base.ResponseElement;

import java.util.List;
import java.util.Map;

public class ExecutedRequest implements ResponseElement {

    String requestId;
    int code = -1;
    String response = null;
    boolean isSuccess = false;
    ErrorElement error = null;
    Map> headers = null;

    public ExecutedRequest requestId(String id) {
        this.requestId = id;
        return this;
    }

    public ExecutedRequest code(int code) {
        this.code = code;
        return this;
    }

    public ExecutedRequest response(String response) {
        this.response = response;
        return this;
    }

    public ExecutedRequest success(boolean success) {
        this.isSuccess = success;
        return this;
    }

    public ExecutedRequest error(ErrorElement error) {
        this.error = error;
        this.code = error.getCode();
        this.response = error.getMessage();
        return this;
    }

    public ExecutedRequest error(Exception exception) {
        return error(ErrorElement.fromException(exception));
    }

    public ExecutedRequest headers(Map> headers) {
        this.headers = headers;
        return this;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getResponse() {
        return response;
    }

    @Override
    public ErrorElement getError() {
        return error;
    }

    @Override
    public boolean isSuccess() {
        return isSuccess;
    }

    @Override
    public String getRequestId() {
        return requestId;
    }

    @Override
    public Map> getHeaders() {
        return headers;
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy