inventree / inventree-python

Python library for communication with inventree via API
https://docs.inventree.org/en/latest/api/python/python/
MIT License
26 stars 34 forks source link

Add add_link function to Attachment class #214

Closed 30350n closed 9 months ago

30350n commented 10 months ago

This adds an add_link class method to the Attachment class, to make it possible to add external link attachments via the python api.

Should I also add a bunch of addLinkAttachment functions to Part, Company, etc. (similar to the uploadAttachment methods)?

SchrodingersGat commented 10 months ago

@30350n thanks!

Regarding the suggested extra methods - I think there should be a mixing class in base.py which these classes inherit, which implements uploadAttachment and uploasdLink - there is a lot of code duplicated which would be reduced.

30350n commented 10 months ago

Looking at the code, that would have to be some kind of generative mixin though, because the current Attachment classes all have different URLs and REQUIRED_KWARGS. I'll see if I can throw something together tomorrow ^^

30350n commented 9 months ago

Here we go, what do you think of this?

SchrodingersGat commented 9 months ago

@30350n clean implementation, I like it. Let's see if it passes :)

30350n commented 9 months ago

Looks good now I'd say!

30350n commented 9 months ago

Mind if I bump the version to 0.13.2 so we can get a release for this?

SchrodingersGat commented 9 months ago

@30350n happy for you to bump the release and then I'll merge

30350n commented 9 months ago

Done, thanks a lot! :)