Package org.springframework.restdocs.cli
Class CliDocumentation
java.lang.Object
org.springframework.restdocs.cli.CliDocumentation
Static factory methods for documenting a RESTful API as if it were being driven using a
command-line utility such as curl or HTTPie.
- Since:
- 1.1.0
- Author:
- Andy Wilkinson, Paul-Christian Volkmer, Raman Gupta, Tomasz Kopczynski
-
Method Summary
Modifier and TypeMethodDescriptionstatic Snippet
Returns a newSnippet
that will document the curl request for the API operation.static Snippet
curlRequest
(Map<String, Object> attributes) Returns a newSnippet
that will document the curl request for the API operation.static Snippet
curlRequest
(Map<String, Object> attributes, CommandFormatter commandFormatter) Returns a newSnippet
that will document the curl request for the API operation.static Snippet
curlRequest
(CommandFormatter commandFormatter) Returns a newSnippet
that will document the curl request for the API operation.static Snippet
Returns a newSnippet
that will document the HTTPie request for the API operation.static Snippet
httpieRequest
(Map<String, Object> attributes) Returns a newSnippet
that will document the HTTPie request for the API operation.static Snippet
httpieRequest
(Map<String, Object> attributes, CommandFormatter commandFormatter) Returns a newSnippet
that will document the HTTPie request for the API operation.static Snippet
httpieRequest
(CommandFormatter commandFormatter) Returns a newSnippet
that will document the HTTPie request for the API operation.static CommandFormatter
Creates a newCommandFormatter
that produces multi-line output.static CommandFormatter
Creates a newCommandFormatter
that produces single-line output.
-
Method Details
-
curlRequest
Returns a newSnippet
that will document the curl request for the API operation.- Returns:
- the snippet that will document the curl request
-
curlRequest
Returns a newSnippet
that will document the curl request for the API operation. The givenattributes
will be available during snippet generation.- Parameters:
attributes
- the attributes- Returns:
- the snippet that will document the curl request
-
curlRequest
Returns a newSnippet
that will document the curl request for the API operation. The givencommandFormatter
will be used to format the curl command in the snippet.- Parameters:
commandFormatter
- the command formatter- Returns:
- the snippet that will document the curl request
- Since:
- 1.2.0
-
curlRequest
Returns a newSnippet
that will document the curl request for the API operation. The givenattributes
will be available during snippet generation. The givencommandFormatter
will be used to format the curl command in the snippet.- Parameters:
attributes
- the attributescommandFormatter
- the command formatter- Returns:
- the snippet that will document the curl request
- Since:
- 1.2.0
-
httpieRequest
Returns a newSnippet
that will document the HTTPie request for the API operation.- Returns:
- the snippet that will document the HTTPie request
-
httpieRequest
Returns a newSnippet
that will document the HTTPie request for the API operation. The givenattributes
will be available during snippet generation.- Parameters:
attributes
- the attributes- Returns:
- the snippet that will document the HTTPie request
-
httpieRequest
Returns a newSnippet
that will document the HTTPie request for the API operation. The givencommandFormatter
will be used to format the HTTPie command in the snippet.- Parameters:
commandFormatter
- the command formatter- Returns:
- the snippet that will document the HTTPie request
- Since:
- 1.2.0
-
httpieRequest
public static Snippet httpieRequest(Map<String, Object> attributes, CommandFormatter commandFormatter) Returns a newSnippet
that will document the HTTPie request for the API operation. The givenattributes
will be available during snippet generation. The givencommandFormatter
will be used to format the HTTPie command in the snippet snippet.- Parameters:
attributes
- the attributescommandFormatter
- the command formatter- Returns:
- the snippet that will document the HTTPie request
- Since:
- 1.2.0
-
multiLineFormat
Creates a newCommandFormatter
that produces multi-line output.- Returns:
- a multi-line
CommandFormatter
-
singleLineFormat
Creates a newCommandFormatter
that produces single-line output.- Returns:
- a single-line
CommandFormatter
-