Comments (2)
Hey @lucasob,
So I'd actually made things generic enough with the original implementation to allow for this.
https://github.com/uptick/pymyob/blame/7d932a42264fc625cfa3c0276f6d290f7f0fc7a6/myob/endpoints.py
One would manually set up kwargs, defined in [ ]
brackets, and they'd be set up accordingly on the method.
This got kinda lost when I streamlined it later with METHOD_MAPPING
to reduce repetition. Off the top of my head, the smallest tweak we need here to allow custom GETs is to allow that manual endpoint definition again. Something like
'Banking/': {
'name': 'banking',
'methods': [
(ALL, '', 'banking type'),
(CRUD, 'SpendMoneyTxn/', 'spend money transaction'),
(RAW_GET, 'SpendMoneyTxn/[uid]/Attachment', 'Return attachments for selected selected spend money transaction.')
(CRUD, 'ReceiveMoneyTxn/', 'receive money transaction'),
(CRUD, 'TransferMoneyTxn/', 'transfer money transaction'),
],
},
And plug it through so that RAW_GET folds down to GET later. Not very pretty though..
Could also look into nested definitions:
'Banking/': {
'name': 'banking',
'methods': [
(ALL, '', 'banking type'),
(CRUD, 'SpendMoneyTxn/', 'spend money transaction', [
('Attachment', 'Return attachments for selected selected spend money transaction.'),
]),
(CRUD, 'ReceiveMoneyTxn/', 'receive money transaction'),
(CRUD, 'TransferMoneyTxn/', 'transfer money transaction'),
],
},
Not a huge fan of this either, as it implies it's nesting off the entire set of CRUD operations, rather than just the GET..
Happy to look at a PR if you want to have a crack at implementing either of these above, or a more involved approach like what you've suggested. As long as the endpoints are easy to view at a glance and extend.
from pymyob.
Hey -- Thanks so much for quick response. I'll give this a good whirl and get something back to you asap.
I'll leave this open and attach the PR for reference later too.
Thanks!
from pymyob.
Related Issues (20)
- Update flow to not require companyfile credentials passed. HOT 2
- Unable to setup with the package HOT 6
- Company list returns blank HOT 3
- KeyError: 'There are no stored username-password credentials for this company id.' HOT 4
- Add support for Essentials v2 API HOT 4
- Modernise pipeline HOT 1
- Support for Report api endpoints HOT 2
- Using 'ge' (greater than) and 'le' (less than) in GET filter HOT 2
- Invalid client_id HOT 6
- Unable to install master HOT 5
- Empty string returned from API causes JSON error HOT 6
- customer_payments doesn't have POST method HOT 9
- Code does not catch error from simplejson HOT 4
- x-myobapi-cftoken header not needed sometimes HOT 2
- Using this library with an access_token rather than creds HOT 3
- How does one use $top, $filter, etc. ? HOT 4
- Add endpoint ALL accountregister
- Swap to Poetry
- Add Black CI check
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pymyob.