KnpLabs / php-github-api

A simple PHP GitHub API client, Object Oriented, tested and documented.
MIT License
2.15k stars 598 forks source link

Is having one object for every thing that is returned by github a good idea ? #745

Closed husseinmirzaki closed 6 years ago

husseinmirzaki commented 6 years ago

In irazasyed/telegram-bot-sdk library if you go to this directory you will see a bunch of objects which, each of them are related to a specific response of telegram bot API now GitHub is the same....So could we do the same ? will it be merged if we started to do it ? or is it a good idea to go with ? I think this way we can offer a lot more functionality than just sending and receiving. e.g: Retrieve a commit get a specific file of that commit an then delete that specific file then again commit sth like this:

$commit = $client->api('repo')->commits()->show('KnpLabs', 'php-github-api', '839e5185da9434753db47959bee16642bb4f2ce4');
$file = $commit->files()->first();
$file_content = $file->getContent();
// change file content
$file->setContent($file_content);
$file->commit('message .....' , $end_point);

or even for example we could some how put some data in file object so we could just write this :

$file->commit('message .....');

I think this is possible but does contributors support this stuff ?

m1guelpf commented 6 years ago

It's a good idea, but not this library's work IMO. I'm actually working on something like this, but with Eloquent models: https://github.com/snaptier/github-whisper

acrobat commented 6 years ago

It's indeed a good idea but not in the scope of this library. You have for example lp-digital/github-event-parser, to convert the github event json's to objects. So it could easily be created in a separate library.

husseinmirzaki commented 6 years ago

aha, thanks