The MP object is the central object that programmers will generally direct all of their requests through. It is almost never instantiated directly, but instead through the connect method.
Arguments: |
|
---|
The SOAP client object
An instance of Extensions() that allows for easily calling extensions written for MPJS. For example:
mp.ext.doSomething();
An instance of Schema(), which you shouldn’t need to interact with. Ever.
Arguments: |
|
---|---|
Returns: | Promise |
Instantiates and returns a StoredProcedure() object of the given name.
Arguments: |
|
---|---|
Returns: | StoredProcedure() object |
Returns a APIFunction() object of the given name. Note that if the requested function name is not defined by the WSDL, an error will be thrown.
Arguments: |
|
---|---|
Returns: | APIFunction() object |
Fetches a table, as defined by the MP object’s Schema().
Arguments: |
|
---|---|
Returns: | Table() object |
Save either a single record or an array of records back to MP. If the record is new (does not have a primary key value), then AddRecord is called, otherwise UpdateRecord is used.
Arguments: | |
---|---|
Returns: | Promise |
Creates a Query() object for the given table and returns it.
Arguments: |
|
---|---|
Returns: | Query() object. |
Lists the SOAP API functions described by API.
Returns: | Array of objects |
---|
Coordinates executing and returning results from stored procedures. These objects should be created via the main MP() object by calling MP.prototype.sp().
Arguments: |
|
---|
The MP() object that this stored procedure belongs to.
The stored procedure’s name.
Returns: | A string representing the name of the stored procedure. |
---|
Execute the stored procedure and return a promise that, when resolved, contains the resulting datasets, if any.
Arguments: |
|
---|---|
Returns: | Promise |
Creates a function call referencing ExecuteStoredProcedure and sets the request string as provided by data.
Arguments: |
|
---|---|
Returns: | APIFunctionCall() object |
Facilitates calling SOAP functions. These objects should always be created by the MPJS library when a connection is initiated. You should not have to ever create them yourself. Instead, retrieve them by calling MP.prototype.fn().
Arguments: |
|
---|
An instance of APIFunctionArguments(), which is used for validating, encoding, and providing defaults for arguments passed to SOAP function calls
Calls the SOAP function with the parameters specified, returning a promise that resolves with an APIFunctionResponse() upon completion.
Arguments: |
|
---|---|
Returns: | Promise |
Creates and returns an APIFunctionCall() object. This method is called by the call() method.
Arguments: |
|
---|---|
Returns: | APIFunctionCall() object |
Basically an interim object that holds an APIFunction() and the arguments that it should be called with.
Arguments: |
|
---|
This is the method that performs the actual call to the SOAP API. It returns a promise that is resolved with whatever is returned by the resulting APIFunctionResponse()‘s getData().
Returns: | Promise |
---|
Contains the response from a SOAP function. Helps to facilitate delivery of that content, providing a seemingly more standard interface to the output of the raw function. NOTE: This class is not directly exposed to the public API.
Arguments: |
|
---|
Checks the type of the response. If an “<anyXML>” type result, returns an instance of DataResolver(); otherwise, returns the raw response (mostly).
Returns: | Mixed |
---|
This class is really not a public part of the API. Just know that it exists and does magical things. :)
Stores information about a Ministry Platform table, such as columns, and constraints. Can be used to create Record() objects, which reference the parent table.
In the future, the Table object will likely play a greater role in database querying.
Arguments: |
|
---|
An array of Constraint() objects
Fetch a Column() object from table by name
Arguments: |
|
---|---|
Returns: | Column() object |
Returns: | Array of column names |
---|
Provides an interface for interacting with table-level data from Ministry Platform. Record objects are used to save data to Ministry Platform via the MP.prototype.save() method. They are almost always created by calling the Table.prototype.record() method or via the Query() object results parsing. In other words, you should never have to instantiate a Record manually.
Arguments: |
|
---|
The raw data that has been stored for the record. No touchy!
Return the value of the record’s primary key column. If the record belongs to a table that does not have a primary key, an error will be thrown.
Returns: | Integer |
---|
Sets the record’s primary key column to the supplied value. If the record belongs to a table that does not have a primary key, an error will be thrown.
Arguments: |
|
---|
Whether or not the record has been saved to the database. This is determined by checking if the record’s primary key column has been set or not.
Returns: | Boolean |
---|
Convert the record to a standard JavaScript object. If skipDecode is truthy, the values are not decoded to their proper JavaScript type (normally, primary key will return as an int instead of a string).
Arguments: |
|
---|---|
Returns: | Object |
Returns JSON-compatible representation of the record. This method simply returns the result of toObject().
Returns: | Object |
---|
Returns a RequestData() representation of this record.
Returns: | RequestData() object |
---|
Returns stringified version of toRequestData().
Returns: | String |
---|
For each key in data, set column to corresponding value.
Example:
record.update({
First_Name: 'Tim',
Last_Name: 'Radke'
});
Arguments: |
|
---|---|
Returns: | Self |
Tables are made up of columns, so it makes sense that we ought to have a Column object. And so we do. :)
The type encoder / decoder for this column.
What the column should default to if no value is provided.
Whether or not a null value is acceptable
A boolean that indicates whether this column is the table’s primary key
An object that contains a bunch of functions for performing queries with the column. These functions are not part of the prototype due to the unfortunate nature of nesting an object in a prototype (its child functions lose access to the correct “this”).
These methods are used like so:
var Contacts = mp.table('Contacts')
, results = mp.query(Contacts).filter(Contacts.not.eq(4)).all();
Return a Filter() where column <> v.
Arguments: |
|
---|---|
Returns: | Filter() object |
Return an appropriate default for the column.
Returns: | Mixed |
---|
Return a Filter() where column == v.
Arguments: |
|
---|---|
Returns: | Filter() object |
Return an OrderBy() with the column in ASC direction.
Returns: | OrderBy() object |
---|
Returns an OrderBy() with the column in DESC direction.
Returns: | OrderBy() object |
---|
Query objects allow us to build complex Ministry Platform queries on arbitrary tables. They have a handful of query-modifying methods, such as limit(), filter(), and orderBy() that actually return new Query objects with the changes requested. So to be very clear, if you do the following:
var query = mp.query('Contacts')
, query2 = query.limit(5);
... then:
query === query2; // false !!
Also it should be noted that you shouldn’t have to instantiate these objects yourself. Instead, grab a new Query object via your application’s main MP object:
var query = mp.query('Contacts');
// or create a query from a Table:
var query = mp.query(mp.table('Contacts'));
Arguments: |
---|
Creates a new query with either provided filter/filters.
Arguments: |
|
---|---|
Returns: | A new Query() object |
For each key/value in the filters object, creates a new filter and finally returns a new Query object with these filters appended.
Here’s what goes on behind the scenes:
var result = [];
for (var i in filters) {
if (filters.hasOwnProperty(i)) {
result.push(this.table.column(i).eq(filters[i]));
}
}
return modQuery(this, {filters: result});
Arguments: |
|
---|---|
Returns: | A new Query() object |
Creates a new query with the provided orderBy object/objects.
Arguments: |
|
---|---|
Returns: | A new Query() object |
Creates a new query with the provided row limit.
Arguments: |
|
---|---|
Returns: | A new Query() object |
Creates a new query with the provided offset.
Arguments: |
|
---|---|
Returns: | A new Query() object |