Constructor
new Market(api)
Main constructor
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
api |
MkmApi
|
Parent api to make the calls |
Methods
(async) findMetaproducts(name, isExactopt, idLanguageopt, idGameopt) → {Promise}
Search for metaproducts by card name
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
String
|
String to match |
||
isExact |
Boolean
|
<optional> |
true |
Only return exact matches |
idLanguage |
Number
|
<optional> |
1 |
Search string in card names in an specific language (1 is English) |
idGame |
Number
|
<optional> |
1 |
Search cards of a specific game (1 is Magic) |
Returns:
- Type:
-
Promise
List of all matched metaproducts
(async) findProducts(name, isExactopt, startopt, maxResultsopt, idLanguageopt, idGameopt) → {Promise}
Find products by name
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
String
|
Search string to use |
||
isExact |
Boolean
|
<optional> |
true |
Only return exact matches |
start |
Number
|
<optional> |
null |
Pagination start parameter (if defined maxResults must be defined) |
maxResults |
Number
|
<optional> |
null |
Page size for pagination |
idLanguage |
Number
|
<optional> |
1 |
Search string in card names in an specific language (1 is English) |
idGame |
Number
|
<optional> |
1 |
Search cards of a specific game (1 is Magic) (if defined start must be defined) |
Returns:
- Type:
-
Promise
List of all products that matches the query
(async) findUsers(search) → {Promise}
Search for users by name
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
search |
String
|
Search string (min length of 3) |
Returns:
- Type:
-
Promise
List of users matching the query, max 50 elements are returned
(async) getArticles(idProduct, searchParamsopt) → {Promise}
Get all the offers for a product that matches the search parameters.
Attention: Only 1.000 articles will be returned if there are more than that you must
use the searchParams.start and searchParams.maxResults to paginate the query.
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
idProduct |
Number
|
id of the Product |
|||||||||||||||||||||||||||||||||||||||||||||
searchParams |
Object
|
<optional> |
Search parameters
|
Returns:
- Type:
-
Promise
List of all articles matching the query
(async) getArticlesByUser(idUser, startopt, maxResultsopt, idGameopt) → {Promise}
Get all articles for a game that an user is selling
Attention: Only 1.000 articles will be returned if there are more than that you must
use the searchParams.start and searchParams.maxResults to paginate the query.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
idUser |
Number
|
User id |
||
start |
Number
|
<optional> |
null |
Pagination start parameter (if defined maxResults must be defined) |
maxResults |
Number
|
<optional> |
null |
Page size for pagination (if defined start must be defined) |
idGame |
Number
|
<optional> |
1 |
Filter articles of a specific game (1 is Magic) |
Returns:
- Type:
-
Promise
List all articles of the specified game from that user.
(async) getExpansionSingles(idExpansion) → {Promise}
Get all card (products) in a single expansion
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
idExpansion |
Number
|
id of the expansion |
Returns:
- Type:
-
Promise
List of products in the expansion.
(async) getGameExpansions(idGame) → {Promise}
Get all expansions of a game
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
idGame |
Number
|
id of the game |
Returns:
- Type:
-
Promise
List of game expansions
(async) getGames() → {Promise}
Get all available games in MKKM
- Source:
Returns:
- Type:
-
Promise
List of available games
(async) getMetaproduct(idMetaproduct) → {Promise}
Get MetaProduct information (a MetaProduct is a card info with all reprints and versions)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
idMetaproduct |
Number
|
MetaProduct id |
Returns:
- Type:
-
Promise
MetaProduct information
(async) getProduct(idProduct) → {Promise}
Get product information by id
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
idProduct |
Number
|
id of the product |
Returns:
- Type:
-
Promise
product information
(async) getUser(idOrName) → {Promise}
Get user by id or exact name
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
idOrName |
Number
|
String
|
id of the user or exact name |
Returns:
- Type:
-
Promise
User information