Giter Club home page Giter Club logo

Comments (5)

stephangroen avatar stephangroen commented on July 1, 2024

Identifiers are given as strings on purpose by Moneybird. This is stated in their changelog:

Many JSON parsing tools out of the box don’t work well with our long integer IDs. Therefore we’ve updated the API to always return these IDs as strings instead.

Automatically creating DateTimeImmutable objects would require a new major version as this breaks backwards compatibility. I do like it, but we might consider some other changes if we're going to get to a new version.

from moneybird-php-client.

holtkamp avatar holtkamp commented on July 1, 2024

Identifiers are given as strings on purpose by Moneybird.

aah, well, ok πŸ˜„ missed that one. What is your stance on using integer for them in this library? I would say PHP can deal with it properly...

would require a new major version as this breaks backwards compatibility. ... we might consider some other changes...
Indeed, so maybe collect these things in a separate branch. I think I will collect some of these things in my fork, then you can cherry-pick the stuff you like / agree with.

from moneybird-php-client.

holtkamp avatar holtkamp commented on July 1, 2024

@stephangroen I though a bit on how improved support for datatypes could be realized. Unfortunately I do not see an 'easy' way: automatic detection. For example: users might use string that appear an integer or DateTime as descriptions. So we need to keep track of what field has/should have what kind of datatype. With other words: metadata.

Did you ever consider using a library for the serialization (PHP => JSON) and deserialization (JSON => PHP) process? For example: http://jmsyst.com/libs/serializer

from moneybird-php-client.

stephangroen avatar stephangroen commented on July 1, 2024

As long as we do not automatically form any string to a specific datatype, I don't see the usecase for adding complexity or the need to include extra libraries. I'd like to try and keep the library as clean as possible so it's easy to understand for all developers.

from moneybird-php-client.

stephangroen avatar stephangroen commented on July 1, 2024

For dates their could be a setting/switch on the library to either get DateTimeImmutable objects or strings, depending on the preference. For example https://github.com/box/spout#datetime-formatting handles it this way.

from moneybird-php-client.

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.