Module agentforge4j.tools.http
Package com.agentforge4j.tools.http
Class HttpEndpointDefinition.Builder
java.lang.Object
com.agentforge4j.tools.http.HttpEndpointDefinition.Builder
- Enclosing class:
- HttpEndpointDefinition
Fluent builder for
HttpEndpointDefinition. Each with* method sets exactly one
field, so adjacent same-typed fields (the several String and Map components)
can no longer transpose silently at a call site the way they can with the 16-argument
positional constructor. Validation is deferred to build(), which delegates to the
canonical constructor.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the validatedHttpEndpointDefinition.withBodyMode(BodyMode bodyMode) Sets how the request body is formed from the leftover arguments.withCapability(String capability) Sets the logical capability id.withDescription(String description) Sets the human-readable description.withDisplayName(String displayName) Sets the human-readable display name.withInputSchema(com.fasterxml.jackson.databind.JsonNode inputSchema) Sets the JSON Schema for the arguments.withMaxResponseBytes(Long maxResponseBytes) Sets the response body read cap.withMaxRetries(Integer maxRetries) Sets the endpoint-level retry cap.withMethod(HttpMethod method) Sets the HTTP method.withMutating(boolean mutating) Sets whether invoking this endpoint may mutate remote state.withOutputSchema(com.fasterxml.jackson.databind.JsonNode outputSchema) Sets the JSON Schema for the result.withQueryArgs(Set<String> queryArgs) Sets the argument names routed to the query string.withRetryNonIdempotent(boolean retryNonIdempotent) Sets whether to opt in to retryingPOST/PATCH.withSecretHeaders(Map<String, String> secretHeaders) Sets the header name to secret-reference key mapping.withStaticHeaders(Map<String, String> staticHeaders) Sets the fixed, non-secret headers.withTimeout(Duration timeout) Sets the endpoint-level timeout ceiling.withUrlTemplate(String urlTemplate) Sets the absolute URL template.
-
Method Details
-
withCapability
Sets the logical capability id.- Parameters:
capability-<domain>.<verb_object>id, lowercase snake_case; required- Returns:
- this builder
-
withDisplayName
Sets the human-readable display name.- Parameters:
displayName- display name, ornull- Returns:
- this builder
-
withDescription
Sets the human-readable description.- Parameters:
description- description, ornull- Returns:
- this builder
-
withMutating
Sets whether invoking this endpoint may mutate remote state. Never calling this method leavesmutatingat its default,true— the highest safe risk — matching the wire default an HTTP_TOOL integration config applies when it omits the field.- Parameters:
mutating- mutating signal; required, no "unset" value exists at this API surface- Returns:
- this builder
-
withMethod
Sets the HTTP method.- Parameters:
method- HTTP method; required- Returns:
- this builder
-
withUrlTemplate
Sets the absolute URL template.- Parameters:
urlTemplate- absolutehttp/httpsURL with{name}placeholders; required- Returns:
- this builder
-
withInputSchema
public HttpEndpointDefinition.Builder withInputSchema(com.fasterxml.jackson.databind.JsonNode inputSchema) Sets the JSON Schema for the arguments.- Parameters:
inputSchema- input JSON Schema; required- Returns:
- this builder
-
withOutputSchema
public HttpEndpointDefinition.Builder withOutputSchema(com.fasterxml.jackson.databind.JsonNode outputSchema) Sets the JSON Schema for the result.- Parameters:
outputSchema- output JSON Schema, ornullif unknown- Returns:
- this builder
-
withQueryArgs
Sets the argument names routed to the query string.- Parameters:
queryArgs- query argument names;null(or never calling this method) becomes empty- Returns:
- this builder
-
withBodyMode
Sets how the request body is formed from the leftover arguments.- Parameters:
bodyMode- body mode; required- Returns:
- this builder
-
withStaticHeaders
Sets the fixed, non-secret headers.- Parameters:
staticHeaders- static headers;null(or never calling this method) becomes empty- Returns:
- this builder
-
withSecretHeaders
Sets the header name to secret-reference key mapping.- Parameters:
secretHeaders- secret headers;null(or never calling this method) becomes empty- Returns:
- this builder
-
withTimeout
Sets the endpoint-level timeout ceiling.- Parameters:
timeout- timeout ceiling, ornull; restricts, never expands- Returns:
- this builder
-
withMaxRetries
Sets the endpoint-level retry cap. Never calling this method leavesmaxRetriesnull(unset).- Parameters:
maxRetries- retry cap, ornullfor unset; must be>= 0when set, restricts, never expands- Returns:
- this builder
-
withRetryNonIdempotent
Sets whether to opt in to retryingPOST/PATCH.- Parameters:
retryNonIdempotent- opt-in flag; meaningless on other methods- Returns:
- this builder
-
withMaxResponseBytes
Sets the response body read cap.- Parameters:
maxResponseBytes- read cap, ornullto use the provider default- Returns:
- this builder
-
build
Builds the validatedHttpEndpointDefinition.- Returns:
- immutable endpoint definition; never
null - Throws:
IllegalArgumentException- if a required field was not set, or a set field is invalid
-