Thank you both I will give both a try and be back with more questions :)

On Fri, Dec 4, 2015 at 6:57 PM Skip Lentz <skip.le...@inria.fr> wrote:

> Hi,
>
> On Dec 4, 2015, at 11:56 AM, Dimitris Chloupis <kilon.al...@gmail.com>
> wrote:
>
> because I am clueless with web dev can you help me understand how to do
> this with ZnClient ?
>
>
> I tried some things, such as this snippet:
>
> ZnClient new
> setIfModifiedSince: DateAndTime now;
> contentReader: [ :entity | ZipArchive new readFrom: entity readStream ];
> get: 'https://api.github.com/repos/kilon/ChronosManager/zipball/master'
>
> But the response does not have a Last-Modified date.
>
> So what you probably want is the date of the latest commit to master (or
> whatever branch). Considering you do want to minimize dependencies and
> therefore not use the API bindings, the following could be done:
>
> client := ZnClient new.
> " Get latest commit list, we only care about the response in this case "
> client
> setIfModifiedSince: (Date year: 2015 month: 12 day: 1);
> get: 'https://api.github.com/repos/kilon/ChronosManager/commits?sha=master
> '.
> client response isNotModified
> ifTrue: [ nil ]
> ifFalse: [
> client
> contentReader: [ :entity | ZipArchive new readFrom: entity readStream ];
> get: 'https://api.github.com/repos/kilon/ChronosManager/zipball/master']
>
> So you need in total three GET requests, since the second request responds
> with a redirect. The first request does not count to the API rate limit if
> it returns a 304 Not Modified.
>

Reply via email to