Starred components

You can star the motors, propellers and batteries you are considering, so you can find them again. A star belongs to one project. The same part can be starred in several projects.

Star a part

python
from thrustlab import Client

client = Client()

star = client.starred_components.add(
    project_id="proj_...",
    component_id="comp_...",
    component_type="motor",
)
print(star["id"])

component_type is "motor", "propeller" or "battery". The result is a star with its own id, which starts with star_. Keep it if you want to remove the star later.

List your stars

python
for star in client.starred_components.list(project_id="proj_...", component_type="motor"):
    print(star["component_id"], star["created_at"])

Both filters are optional. Newest stars come first. Each star holds id, project_id, component_id, component_type and created_at.

Remove a star

You remove a star with its own star_ id. The part's comp_ id does not work:

python
client.starred_components.remove(star["id"])

If you don't have the id, find it with list.

When it fails

  • Starring a part that is already starred in that project raises a ConflictError with the code already_starred.
  • Removing a star that doesn't exist raises a NotFoundError.

So a call that worked fails if you send it a second time.