Skip to content

Latest commit

 

History

History
100 lines (83 loc) · 5.4 KB

documentation.md

File metadata and controls

100 lines (83 loc) · 5.4 KB

meteor-swagger-client

License: MIT

meteor-swagger-client~SwaggerClients : object

The SwaggerClients class. This is an exported global data structure able to hold proxies of numerous remote REST API hosts. The original asynchronous methods generated by the NodeJS module 'swagger-client' are available as is, but also available wrapped as synchronous methods using Meteor.wrapAsync().

API documentation can be accessed at anytime through the Swagger demo viewer

Kind: inner namespace of meteor-swagger-client
See: Swagger JS library
Example

// instantiate a host instance.
const swaggerSpecURL = "http://petstore.swagger.io/v2/swagger.json";
SwaggerClients.addRemoteHost(swaggerSpecURL);
const host = SwaggerClients.getHost("Swagger Petstore");

Example

// Get data from a remote host with an asynchronous call
host.proxy.pet.getPetById(args, hdrs, function(resp){ | do work | });

Example

// Get data from a remote host with a synchronous call
pet = host.sync.pet.getPetById(args, hdrs);

SwaggerClients~addRemoteHost(swaggerSpecURL, [name]) ⇒ void

Using a Swagger specification obtained remotely, instantiate and store a Swagger API proxy for future use.

Kind: inner method of SwaggerClients
Access: public
See: getHost

Param Type Default Description
swaggerSpecURL url URL of a remote JSON formatted Swagger specification.
[name] string null An identifier to use to get the host proxy later. If none is provided then the Swagger specification element "info.title" will be taken from within the retrieved JSON file.

addRemoteHost~self : namespace

'self' is set to the SwaggerClients namespace.

Kind: inner property of addRemoteHost

addRemoteHost~proxy : namespace

'proxy' is the dynamically generated client-side functionality of a remote REST API.

Kind: inner property of addRemoteHost

addRemoteHost~nameHost : string

'nameHost' is an identifier to use to get the host proxy later. If none is provided then the Swagger specification element "info.title" will be taken from within the retrieved JSON file.

Kind: inner property of addRemoteHost

SwaggerClients~getHost(title) ⇒ Swagger

Get a previously stored API proxy

Kind: inner method of SwaggerClients
Access: public
See: SwaggerClients.addRemoteHost

Param Type Description
title string An identifier of a previously stored host proxy.