Constructor
new Stock(api)
Main constructor
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
api |
MkmApi
|
Parent api to make the calls |
Methods
(async) add(articles) → {Promise}
Add one or more articles to your stock
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
articles |
Array.<Object>
|
Articles to be listed |
Returns:
- Type:
-
Promise
Operation result
(async) change(articles) → {Promise}
Modify one or several articles in your stock, it can not be used to change the quantity.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
articles |
Array.<Object>
|
Changed articles |
Returns:
- Type:
-
Promise
Operation result
(async) delete(articles) → {Promise}
Remove articles from your stock
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
articles |
Array.<Object>
|
Articles to be removed |
Returns:
- Type:
-
Promise
Operation result
(async) dereaseAmmount(articles) → {Promise}
Decrease the ammount of one or several articles Attention: Increasing the stock for an article may fail, because we have limitations on how many copies of an article different seller types (private, professional) can have in their stock. In this case, the response body will have the failed key collecting all articles that failed in increasing the copies - in addition to the article key collecting all successful increases.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
articles |
Array.<Object>
|
List of articles to decrease and the amount for each one |
Returns:
- Type:
-
Promise
Operation result
(async) findArticles(name, idGameopt) → {Promise}
Find all articles in your stock from a specified game that matches a name.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
String
|
Name to be searched |
||
idGame |
Number
|
<optional> |
1 |
Id of game (by default Magic) |
Returns:
- Type:
-
Promise
List of articles that matches the query
(async) get(startopt) → {Promise}
Get the full list of articles published
Attention: Only 1.000 articles will be returned if there are more than that you must
use the start.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
start |
Number
|
<optional> |
null |
Paginate results starting from this element. If set only 100 elements will be returned by request |
Returns:
- Type:
-
Promise
List of Articles in stock.
(async) getArticle(idArticle) → {Promise}
Get all the information of a single article
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
idArticle |
Number
|
Id of the article |
Returns:
- Type:
-
Promise
Article information
(async) getInShoppingCart() → {Promise}
Get all articles that are currently in the shopping cart of other users.
- Source:
Returns:
- Type:
-
Promise
List of articles
(async) increaseAmmount(articles) → {Promise}
Increase the ammount of one or several articles Attention: Increasing the stock for an article may fail, because we have limitations on how many copies of an article different seller types (private, professional) can have in their stock. In this case, the response body will have the failed key collecting all articles that failed in increasing the copies - in addition to the article key collecting all successful increases.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
articles |
Array.<Object>
|
List of articles to increase and the amount for each one |
Returns:
- Type:
-
Promise
Operation result