Giter Club home page Giter Club logo

Comments (2)

jarekwg avatar jarekwg commented on August 27, 2024 1

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.

lucasob avatar lucasob commented on August 27, 2024 1

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.