Add configuration storage class. Made DigikeyAPI into a class
This PR adds a method of setting and saving this package's settings (like client-id and refresh-token) without needing to use OS environment variables.
Main changes includes:
- Added all API fucntions (for V3) under a
DigikeyAPIclass. - Added a configuration class which is fed into
DigikeyAPI. This class includes all necessary functions to be able to save and get configurations. The parent class isDigikeyBaseConfig, which that one does nothing but outline what functions any child class must override. As of right now I've only 1 config storage method/kind underDigikeyJsonConfig, which stores and retrieves configurations in a JSON file. - Added the functions
needs_client_id(),needs_client_secret(), andset_client_info()to allow the user to know if said info are needed and to be able to give them to this library.
TODO:
- [x] Document
DigikeyBaseConfigfurther to specify how a user can create their own (for example if someone wants to store said settings inside a database). - [x] Document the new changes to how to call up the API
- [x] ~~Change V2's code to allow for the new configuration:~~
- ~~Is this even worth it, or is it better to drop V2 support?~~
- V2 support is dropped
This is an interesting proposition and I hope to see this being merged.
@peeter123 Any plan to review this soon?
@Electro707 Do you need help with testing?
@eeintech Sure, just beware that A) This is not too well documented which is something I need to do, and B) Only works with V3 API. @peeter123 Is it even worth it to add support to v2 even tough it's deprecated by Digikey, or is it time to drop V2 support?
@peeter123 Any thoughts on the V2 API, if I should add this new config class to it or if it should be deprecated?
I will look into this, I think we can make a 1.0 version where we drop the V2 API completely. What do you think?
Could you rebase on development-1.0 branch in peeter123/digikey-api?
Rebasing is done.