Skip to content

Redesign Request and Update procedure #209

Open
@noplanman

Description

@noplanman

Whilst implementing Guzzle, I noticed that the way the Requests and Updates work at the moment is a bit illogical and confusing. Especially because some functionality is placed where it clearly doesn't belong.

As an example: setInputRaw() is adding an entry to the update log. To me, the correct place to add the entry to the log, is when the update is actually processed, processUpdate().
This would also solve weird exception fixes like this one, making the procedure more concise.

Furthermore, the raw update data should be passed to the Update constructor, so that it is part of the object itself. That way, logging the raw data is easy and any necessary conversion to an array for example, can be done within the object, thus taking away the responsibility to provide a certain data format (i.e. an array or the JSON string).

Also on a side note, should there be a log entry when updates are fetched manually using getUpdates.php even if there are no updates? It just adds an empty response: {"ok":true,"result":[]}
Additionally, the log entry when using getUpdates.php is different to using the Webhook, which shouldn't be, in my view.

Please give me you opinion on this, as this might become a bigger change / optimisation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions