lucee.Componentrelax.RelaxDSL.Document
Copyright Ortus Solutions, Corp, All rights reserved www.ortussolutions.com --- Relax offers you a nice programmatic DSL to define RESTFul web services. All functions defined in this DSL can be concatenated with each other to create expressive and human readable representations of your API Definitions.
Constructor Summary | |
---|---|
init()
Constructor. |
Method Summary | |
---|---|
any
|
appendData(struct args, string dataKey)
Append Data elements. |
any
|
appendResponse(struct args, string dataKey)
Append a response to a resource. |
any
|
defaultFormat(string format)
Define a default return format for a resource. |
any
|
defaultMethod(string method)
Define a default HTTP method for a resource. |
any
|
description(string description)
Add a description to a resource. |
any
|
globalHeader(string name, [string description=''], [boolean required='false'], [string defaultValue=''], [string type='string'])
Add a global header to the relax definition. |
any
|
globalParam(string name, [string description=''], [boolean required='false'], [string defaultValue=''], [string type='string'])
Add a global parameter to the relax definition. |
any
|
header(string name, [string description=''], [boolean required='false'], [string defaultValue=''], [string type='string'])
Add a header to a resource. |
any
|
methods(any methods)
Add valid HTTP methods to a resource. |
any
|
param(string name, [string description=''], [boolean required='false'], [string defaultValue=''], [string type='string'])
Add a parameter to a resource. |
any
|
placeholder(string name, [string description=''], [boolean required='false'], [string defaultValue=''], [string type='string'])
Add a placeholder to a resource. |
any
|
resource(string pattern, [string handler], [any action], [string defaultMethod='GET'])
Add a new resource to the API definition, you can then concatenate more methods to the same resource: methods(),description(),header(),parameter(),placeholder(),schema(),sample(). |
any
|
sample(string format, [string description=''], [string body=''])
Append a sample to a resource. |
any
|
schema(string format, [string description=''], [string body=''])
Append a schema to a resource. |
any
|
service(string title, string description, any entryPoint, [boolean extensionDetection='false'], [string validExtensions='json,jsont,xml,html,htm,rss'], [boolean throwOnInvalidExtensions='false'])
The relaxed service information. |
any
|
setHeaders(array headers)
Set all the required headers of a resource. |
any
|
setParams(array params)
Set all the required parameters of a resource. |
any
|
setPlaceHolders(array placeholders)
Set all the required placeholders of a resource. |
any
|
verifyResourcePivot()
Verify if the resource pivot exists. |
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Constructor
Method Detail |
---|
Append Data elements
args
- The incoming data argumentsdataKey
- The key to append it toAppend a response to a resource
args
- The data argumentsdataKey
- The key to add it toDefine a default return format for a resource
format
- The format. Ex: json, xml, htmlDefine a default HTTP method for a resource
method
- The HTTP method that will be the defaultAdd a description to a resource
description
- The long description of a resourceAdd a global header to the relax definition
name
- The name of the headerdescription
- The description of the headerrequired
- Is the header required or notdefaultValue
- The default value of this headertype
- The type of the incoming headerAdd a global parameter to the relax definition
name
- The name of the parameterdescription
- The description of the parameterrequired
- Is the parameter required or notdefaultValue
- The default value of this parametertype
- The type of the incoming parameterAdd a header to a resource
name
- The name of the headerdescription
- The description of the headerrequired
- Is the header required or notdefaultValue
- The default value of this headertype
- The type of the incoming headerAdd valid HTTP methods to a resource
methods
- A list of HTTP methods a resource allowsAdd a parameter to a resource
name
- The name of the parameterdescription
- The description of the parameterrequired
- Is the parameter required or notdefaultValue
- The default value of this parametertype
- The type of the incoming parameterAdd a placeholder to a resource
name
- The name of the placeholderdescription
- The description of the placeholderrequired
- Is the placeholder required or notdefaultValue
- The default value of this placeholdertype
- The type of the incoming placeholderAdd a new resource to the API definition, you can then concatenate more methods to the same resource: methods(),description(),header(),parameter(),placeholder(),schema(),sample()
pattern
- The SES pattern to register for the resourcehandler
- The handler this pattern directs toaction
- The action this pattern directs to, it can be simple or a complex HTTP-Action struct: { "get" : "list", "delete", "doRemove" }defaultMethod
Append a sample to a resource
format
- The format of the sampledescription
- The description of the samplebody
- The body contents of the sampleAppend a schema to a resource
format
- The format of the schemadescription
- The description of the schemabody
- The body contents of the schemaThe relaxed service information. From here you will define the RESTful service endpoints, extension detection, valid formats, and more.
title
- The title of the RESTful servicedescription
- The description of the RESTful serviceentryPoint
- A simple URL or a structure of entry points for different tiers: { dev="http://localhost/api", prd="http://www.mysite.com/api" }extensionDetection
- Will this API do extension detectionvalidExtensions
- The valid extensions to detectthrowOnInvalidExtensions
- Throw on invalid extensions or notSet all the required headers of a resource
headers
- Set the headers of a resourceSet all the required parameters of a resource
params
- Set the parameters of a resourceSet all the required placeholders of a resource
placeholders
- Set the placeholders of a resourceVerify if the resource pivot exists