-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Financials API initial commit #352
base: master
Are you sure you want to change the base?
Conversation
This file introduces the financials API endpoint. It is currently only available on the Graph API beta version or via the BusinessCentral API endpoint. One additional dependency is created by this module (inflection). Many endpoints are currently only available on the business central API endpoint. These are not yet fully implemented, whereas all endpoints accessible via Graph API are already fully implemented, but not all CRUD operations are yet tested for all entities. Navigation properties are always loaded in the current implementation.
This is absolutely great @teamoo! Let me go through the code and I'll report back |
Sure, feel free to change things. I took a slightly different approach than you. In my opinion, you have a lot of boilerplate in the current classes, a lot of repetition in the code...event thought about using data classes (python>=3.7). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @teamoo I've reviewed the code and wrote some comments,
Just a few comments:
- There is no need for the inflection dependency. This is already covered by the
stringcase
dependency. The casing functions are also incorporated into the protocols (see the code). And the ApiComponent gives each class aself._cc
('cc' means convert case) method that is an alias forself.protocol.convert_case
.
from stringcase import snake_case, pascal_case
print(snake_case('myUnitDimension'))
# results in 'my_unit_dimension'
print(camelcase('my_unit_dimension'))
# results in 'myUnitDimension'
- Although I like the approach of auto converting everything received from the api into a property like you did, it can generate problems. If you receive a keyword that is a reserved keyword in python this will cause a SyntaxError. For example if you try to add 'from' or 'class' to a class it will fail.
This can be overcome by checking if the keyword is a reserved keyword and set the keyword with a modification instead.
Also, there are some properties that need to be set more like an instance of another class (such as Attachments
for messages and others that need some adjustments (like body on messages).
Maybe this approach can be set to the other classes in the library. Will have to investigate a little more.
- You should accept a
Query
instance when getting collection of items.
Simply update the data of the query withq.as_params()
if kwargs.pop('main_resource', None): | ||
main_resource = kwargs.pop('main_resource', None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you pop the main_resource then the next call to pop inside the if will always return None.
hi @teamoo can you change the code about the inflection dependency? There's any reason to maintain this dependency? This way I can merge the PR. |
Hi @janscas, yes sure. Sorry I was busy with projects, will do that next week. |
Sorry again, Deadline on a client project and time off next week. I will Update it in December. |
@teamoo it's been rather quiet on your O365 Financials API pull request. Any change you'd be able to wrap it up soon? |
Hi @jeroenhabets , sorry, no chance to update it at the moment. If it is a problem for you guys, feel free to discard it. |
This file introduces the financials API endpoint. It is currently only available on the Graph API beta version or via the BusinessCentral API endpoint.
One additional dependency is created by this module (
inflection
).Many endpoints are currently only available on the business central API endpoint. These are not yet fully implemented, whereas all endpoints accessible via Graph API are already fully implemented, but not all CRUD operations are yet tested for all entities.
Navigation properties are always loaded in the current implementation.
The object can be called like this:
Currently, you cannot grant application access, only delegated access.
If using the BusinessCentral API endpoint, make sure to grant access not for "Microsoft Graph", but for "Dynamics 365 Business Central".
The
Company
object contains access to most objects as they are company-specific.