modzyClient.getRelatedModels
Retrieve related models
modzyClient.getRelatedModels(modelId)
Returns a detailed list of all the models that share tags with a given model.
Parameters
Parameter | Type | Description | Example |
---|---|---|---|
model | string | A model identifier assigned by Modzy. | 'ed542963de' |
Returns
A JSON object with a detailed list of models that share at least one tag with a given model.
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "array",
"items": {
"$ref": "#/definitions/Model"
},
"definitions": {
"Model": {
"type": "object",
"additionalProperties": false,
"properties": {
"identifier": {
"type": "string"
},
"permalink": {
"type": "string"
},
"name": {
"type": "string"
},
"author": {
"type": "string"
},
"isRecommended": {
"type": "boolean"
},
"isActive": {
"type": "boolean"
},
"tags": {
"type": "array",
"items": {}
},
"features": {
"type": "array",
"items": {}
},
"versions": {
"type": "array",
"items": {}
},
"latestVersion": {
"type": "string"
},
"isAvailable": {
"type": "boolean"
},
"images": {
"type": "array",
"items": {
"$ref": "#/definitions/Image"
}
},
"snapshotImages": {
"type": "array",
"items": {}
}
},
"required": [
"author",
"features",
"identifier",
"images",
"isActive",
"isAvailable",
"isRecommended",
"latestVersion",
"name",
"permalink",
"snapshotImages",
"tags",
"versions"
]
},
"Image": {
"type": "object",
"additionalProperties": false,
"properties": {
"url": {
"type": "string"
},
"caption": {
"type": "string"
},
"relationType": {
"$ref": "#/definitions/RelationType"
}
},
"required": [
"caption",
"relationType",
"url"
]
},
"RelationType": {
"type": "string",
"enum": [
"background",
"card",
"thumbnail",
"logo"
]
}
}
}
Examples
models = await modzyClient.getRelatedModels('mcmedzgiu3')
console.log( `Related models ${models.length}` );
Using promises
modzyClient.getRelatedModels('mcmedzgiu3')
.then(
(models)=>{
console.log( `Related models ${models.length}` );
}
)
.catch(
(error)=>{
console.error(error);
}
);
Updated over 2 years ago