Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.nexusrpc.client;

import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

/** CancelOperationOptions is used to specify options for canceling an operation. */
public class CancelOperationOptions {
/** Create a builder for CancelOperationOptions. */
public static CancelOperationOptions.Builder newBuilder() {
return new CancelOperationOptions.Builder();
}

private final SortedMap<String, String> headers;

private CancelOperationOptions(SortedMap<String, String> headers) {
this.headers = headers;
}

/** Headers. The returned map operates without regard to case. */
public Map<String, String> getHeaders() {
return headers;
}

public static class Builder {
private final SortedMap<String, String> headers;

private Builder() {
headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
}

/** Get headers to mutate. */
public Map<String, String> getHeaders() {
return headers;
}

public CancelOperationOptions build() {
return new CancelOperationOptions(headers);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package io.nexusrpc.client;

import io.nexusrpc.Link;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

public class ExecuteOperationOptions {
private final Map<String, String> headers;
private final String callbackURL;
private final Map<String, String> callbackHeaders;
private final String requestId;
private final List<Link> inboundLinks;
private final Duration timeout;

public ExecuteOperationOptions(
Map<String, String> headers,
String callbackURL,
Map<String, String> callbackHeaders,
String requestId,
List<Link> inboundLinks,
Duration timeout) {
this.headers = headers;
this.callbackURL = callbackURL;
this.callbackHeaders = callbackHeaders;
this.requestId = requestId;
this.inboundLinks = inboundLinks;
this.timeout = timeout;
}

public Map<String, String> getHeaders() {
return headers;
}

public String getCallbackURL() {
return callbackURL;
}

public Map<String, String> getCallbackHeaders() {
return callbackHeaders;
}

public String getRequestId() {
return requestId;
}

public List<Link> getInboundLinks() {
return inboundLinks;
}

public Duration getTimeout() {
return timeout;
}

public static class Builder {
private final SortedMap<String, String> headers;
private String callbackURL;
private SortedMap<String, String> callbackHeaders;
private String requestId;
private List<Link> inboundLinks;
private Duration timeout;

public Builder() {
headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
callbackHeaders = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
}

public Map<String, String> getHeaders() {
return headers;
}

public Builder setCallbackURL(String callbackURL) {
this.callbackURL = callbackURL;
return this;
}

public Map<String, String> getCallbackHeaders() {
return callbackHeaders;
}

public Builder setRequestId(String requestId) {
this.requestId = requestId;
return this;
}

public Builder setInboundLinks(List<Link> inboundLinks) {
this.inboundLinks = inboundLinks;
return this;
}

public Builder setTimeout(Duration timeout) {
this.timeout = timeout;
return this;
}

public ExecuteOperationOptions build() {
return new ExecuteOperationOptions(
headers, callbackURL, callbackHeaders, requestId, inboundLinks, timeout);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.nexusrpc.client;

import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

public class GetOperationInfoOptions {
/** Create a builder for CancelOperationOptions. */
public static GetOperationInfoOptions.Builder newBuilder() {
return new GetOperationInfoOptions.Builder();
}

private final SortedMap<String, String> headers;

private GetOperationInfoOptions(SortedMap<String, String> headers) {
this.headers = headers;
}

/** Headers. The returned map operates without regard to case. */
public Map<String, String> getHeaders() {
return headers;
}

public static class Builder {
private final SortedMap<String, String> headers;

private Builder() {
headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
}

/** Get headers to mutate. */
public Map<String, String> getHeaders() {
return headers;
}

public GetOperationInfoOptions build() {
return new GetOperationInfoOptions(headers);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package io.nexusrpc.client;

import java.time.Duration;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

public class GetOperationResultOptions {
/** Create a builder for GetOperationResultOptions. */
public static GetOperationResultOptions.Builder newBuilder() {
return new GetOperationResultOptions.Builder();
}

private final Duration timeout;
private final SortedMap<String, String> headers;

private GetOperationResultOptions(Duration timeout, SortedMap<String, String> headers) {
this.timeout = timeout;
this.headers = headers;
}

/** Headers. The returned map operates without regard to case. */
public Map<String, String> getHeaders() {
return headers;
}

public Duration getTimeout() {
return timeout;
}

public static class Builder {
private final SortedMap<String, String> headers;
private Duration timeout;

private Builder() {
headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
}

/** Get headers to mutate. */
public Map<String, String> getHeaders() {
return headers;
}

/**
* Set the timeout for the operation.
*
* @param timeout the duration to wait for the operation result
* @return this builder instance
*/
public Builder setTimeout(Duration timeout) {
this.timeout = timeout;
return this;
}

public GetOperationResultOptions build() {
return new GetOperationResultOptions(timeout, headers);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.nexusrpc.client;

import io.nexusrpc.Link;
import java.util.List;

public class GetResultResponse<T> {
public static GetResultResponse.Builder newBuilder() {
return new GetResultResponse.Builder();
}

private final T result;
private final List<Link> links;

private GetResultResponse(T result, List<Link> links) {
this.result = result;
this.links = links;
}

public T getResult() {
return result;
}

public List<Link> getLinks() {
return links;
}

public static class Builder<T> {
private T result;
private List<Link> links;

public Builder setResult(T result) {
this.result = result;
return this;
}

public Builder setLinks(List<Link> links) {
this.links = links;
return this;
}

public GetResultResponse<T> build() {
return new GetResultResponse<>(result, links);
}
}
}
Loading
Loading