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 SnippetReturns a newSnippetthat will document the curl request for the API operation.static SnippetcurlRequest(Map<String, Object> attributes) Returns a newSnippetthat will document the curl request for the API operation.static SnippetcurlRequest(Map<String, Object> attributes, CommandFormatter commandFormatter) Returns a newSnippetthat will document the curl request for the API operation.static SnippetcurlRequest(CommandFormatter commandFormatter) Returns a newSnippetthat will document the curl request for the API operation.static SnippetReturns a newSnippetthat will document the HTTPie request for the API operation.static SnippethttpieRequest(Map<String, Object> attributes) Returns a newSnippetthat will document the HTTPie request for the API operation.static SnippethttpieRequest(Map<String, Object> attributes, CommandFormatter commandFormatter) Returns a newSnippetthat will document the HTTPie request for the API operation.static SnippethttpieRequest(CommandFormatter commandFormatter) Returns a newSnippetthat will document the HTTPie request for the API operation.static CommandFormatterCreates a newCommandFormatterthat produces multi-line output.static CommandFormatterCreates a newCommandFormatterthat produces single-line output.
-
Method Details
-
curlRequest
Returns a newSnippetthat will document the curl request for the API operation.- Returns:
- the snippet that will document the curl request
-
curlRequest
Returns a newSnippetthat will document the curl request for the API operation. The givenattributeswill be available during snippet generation.- Parameters:
attributes- the attributes- Returns:
- the snippet that will document the curl request
-
curlRequest
Returns a newSnippetthat will document the curl request for the API operation. The givencommandFormatterwill 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 newSnippetthat will document the curl request for the API operation. The givenattributeswill be available during snippet generation. The givencommandFormatterwill 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 newSnippetthat will document the HTTPie request for the API operation.- Returns:
- the snippet that will document the HTTPie request
-
httpieRequest
Returns a newSnippetthat will document the HTTPie request for the API operation. The givenattributeswill be available during snippet generation.- Parameters:
attributes- the attributes- Returns:
- the snippet that will document the HTTPie request
-
httpieRequest
Returns a newSnippetthat will document the HTTPie request for the API operation. The givencommandFormatterwill 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 newSnippetthat will document the HTTPie request for the API operation. The givenattributeswill be available during snippet generation. The givencommandFormatterwill 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 newCommandFormatterthat produces multi-line output.- Returns:
- a multi-line
CommandFormatter
-
singleLineFormat
Creates a newCommandFormatterthat produces single-line output.- Returns:
- a single-line
CommandFormatter
-