Raml Object Interface
An abstract interface to the standard RAML object representation.
Installation
npm install raml-object-interface --save
Usage
var gitHub = gitHubRaml
getTitle()
Return the API title string or undefined
.
gitHub //=> "GitHub API v3"
getVersion()
Return the API version string or undefined
.
gitHub //=> "v3"
getBaseUri()
Return the base uri of the API.
gitHub //=> "https://api.gitHub.com"
getMediaType()
Return the global application mediaType
string.
gitHub //=> "application/json"
getProtocols()
Return an array of supported API protocols. Only HTTP
or HTTPS
.
gitHub //=> ["HTTPS"]
getSecuredBy()
Return an object describing the different way to handle authentication.
gitHub //=> { "oauth_2_0": { "type": "OAuth 2.0" }, ... }
getDocumentation()
Return the documentation array.
gitHub //=> [{ "title": "Home", "content": "..." }, ...]
getBaseUriParameters()
Return a map of named parameters used on the base uri.
gitHub //=> { "version": { "type": "string", "default": "v3" }, ... }
getResourceTypes()
Return a map of resource types.
gitHub //=> { "collection": { "get?": null }, ... }
getTraits()
Return a map of traits.
gitHub //=> { "filterable": { "queryParameters": { filter: { ... } } } }
getSecuritySchemes()
Return a map of security scheme objects.
gitHub //=> { "oauth_2_0": { "type": "OAuth 2.0", ... } }
getResources()
Return an array of all resource strings.
gitHub //=> ["/", "/users", ...]
getResourceChildren(path)
Return an array of valid child resources.
gitHub //=> ["/users", ...]
getResourceParent(path)
Return the path of the parent.
gitHub //=> "/users"
getResourceName(path)
Return a resource name, useful for client generators.
gitHub //=> "userId"
getRelativeUri(path)
Return the relative path to its parent.
gitHub //=> "/{userId}"
getRelativeParameters(path)
Return a map of named parameters used on the relative part of the resource.
gitHub //=> { "userId": { ...} }
getResourceMethods(path)
Return an array of support methods of a resource.
gitHub //=> ["get", "post"]
getResourceParameters(path)
Return a map of named parameters used on the resource.
gitHub //=> {}
getMethodHeaders(path, method)
Return a map of named parameters used for the method headers.
gitHub //=> { "X-GitHub-Media-Type": { ... }, ... }
getMethodQueryParameters(path, method)
Return a map of named parameters used for the method query parameters.
gitHub //=> { "since": { ... }, ... }
getMethodBody(path, method)
Return a map of content type bodies.
gitHub //=> { "application/json": { ... } }
getMethodResponses(path, method)
Return an map of possible responses.
gitHub //=> { "200": { "body": { "application/json": { ... } } } }
License
Apache License 2.0