Class mbo_Service
Defined in: mbo_Service.js.
Constructor Attributes | Constructor Name and Description |
---|---|
mbo_Service(service, sourceName, sourcePassword, siteIds, apiVersion)
This class is not meant to be instantiated, and only serves as a base class for the actual Service classes.
|
Method Attributes | Method Name and Description |
---|---|
addSiteIds(siteIds)
Adds Site Ids to the current users accessible sites.
|
|
defaultParam(name, value)
Gets or Sets defaults passed to every request.
|
|
<static> |
mbo_Service.getSoapFault(result)
Check if the SOAP call returned a SOAP Fualt.
|
log(type, , host, port)
Enables or disables the logging of calls to the API.
|
|
setUserCredentials(username, password, siteIds)
Sets the User Credentials to use for any call, and sets them to be used.
|
|
Sets the default credentials to the default value.
|
Class Detail
mbo_Service(service, sourceName, sourcePassword, siteIds, apiVersion)
This class is not meant to be instantiated, and only serves as a base class for the actual Service classes.
Creates a new MBO Service.
Retrieves the WSDL of the given service and creates two methods for each SOAP method in the WSDL.
For each SOAP method a function is created:
1) Bearing the same name that either extracts the result of the same name, and
2) Bearing the name with 'Response' post-fixed, which returns an array of the
i) Raw response converted to a JS object
ii) Raw XML response
iii) Raw XML SOAP header info
Each of these functions returns an A+ Promise.
Each method of the service methods accepts an Object as a parameter as well.
Each element of the object will be included in the Request section of the SOAP Request.
Emits an 'initialized' event once all methods have been defined.
A 'ready' event is triggered by the ServiceFactory once User Credentails have been set.
- Parameters:
- {string|boolean} service
- The full name of the service to be implemented. E.g 'SaleService' Set to False if no service is desired.
- {string} sourceName
- Your MINDBODY developer Source Name, included in all service calls.
- {string} sourcePassword
- Your MINDBODY developer Source Password, included in all service calls.
- {int[]} siteIds Optional
- An array containg site Ids to add.
- {number} apiVersion
- The MINDBODY API version you wish to use. Defaults to the most recent stable release.
- Returns:
- {mbo_Service} An absract service to interact with the MINDBODY API service.
Method Detail
addSiteIds(siteIds)
Adds Site Ids to the current users accessible sites.
- Parameters:
- {number|number[]} siteIds
- A single, or array of, Site ID(s) which the client can interact with.
{string}
defaultParam(name, value)
Gets or Sets defaults passed to every request.
If second argument is included, the key is set to that value.
If the second parameter is not included, the current value of the key is returned.
- Parameters:
- {string} name
- The key of the default parameter to get or set
- {string} value Optional
- The value to set the key to.
- Returns:
- {string} If getting a value the value is returned. If setting a value, nothing is returned.
<static>
{boolean}
mbo_Service.getSoapFault(result)
Check if the SOAP call returned a SOAP Fualt.
Triggers a 'SoapFault' event if found.
- Parameters:
- {object} result
- The object representation of the SOAP response.
- Deprecated:
- MBO Services respond with status codes instead of SOAP Faults.
- Returns:
- {boolean} Whether the response contained a SOAP Fault of not.
log(type, , host, port)
Enables or disables the logging of calls to the API.
- Parameters:
- {string|boolean} type
- The type of Logger to use -- 'local' or 'remote' -- or false to disable.
- {string}
- host
- port
- Throws:
- {Error}
setUserCredentials(username, password, siteIds)
Sets the User Credentials to use for any call, and sets them to be used.
Not all calls require user credentials.
- Parameters:
- {string} username
- The username of the MINDOBDY client you're interacting with.
- {string} password
- The password of the MINDBODY client you're interacting with.
- {number|number[]} siteIds
- A single, or array of, Site ID(s) which the client can interact with.
useDefaultUserCredentials(val)
Sets the default credentials to the default value.
This appends an underscore before the Source Name, and uses the Source's password.
- Parameters:
- val