1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-19 05:30:08 -07:00

Add getPartsByLDrawNumber api function

Add function to fetch rebrickable parts related to LDraw model by number
This commit is contained in:
David Hübner 2017-04-05 16:57:45 +02:00
parent 6fb797a124
commit 6421ed66f2

View File

@ -119,6 +119,20 @@ class RebrickableManager
return $this->serializer->deserialize($data, PartCategory::class, self::FORMAT); return $this->serializer->deserialize($data, PartCategory::class, self::FORMAT);
} }
public function getPartsByLDrawNumber($number) {
$options = [
'query' => [
'ldraw_id' => $number
],
];
$response = $this->rebrickableClient->call('GET','lego/parts', $options);
$data = json_decode($response, true)['results'];
return $this->serializer->denormalize($data,Part::class.'[]',self::FORMAT);
}
/** /**
* Get the list of sets that a specific part/color appears in. * Get the list of sets that a specific part/color appears in.
* *