inventree / inventree-python

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

Add add_link function to Attachment class #214

Closed 30350n closed 11 months ago

30350n commented 11 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 11 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 11 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 11 months ago

Here we go, what do you think of this?

SchrodingersGat commented 11 months ago

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

30350n commented 11 months ago

Looks good now I'd say!

30350n commented 11 months ago

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

SchrodingersGat commented 11 months ago

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

30350n commented 11 months ago

Done, thanks a lot! :)