Skip to content

Releases: rmuit/copernica-api

All outstanding work done.

05 Nov 16:49
Compare
Choose a tag to compare

More things have changed than expected since the beta, and I'm breaking compatibility again (which isn't nice, but given the very low user base I think I can get away with it still). The concept of the existing methods hasn't changed but some of them have been renamed and moved to different classes.

Renamed classes

  • CopernicaRestClient -> RestClient
  • CopernicaHelper -> Helper

Moved methods

  • CopernicaRestClient::getEntitiesNextBatch() -> BatchableRestClient::getMoreEntities()
  • CopernicaRestClient::lastEntitiesDatasetIsComplete() -> BatchableRestClient::allEntitiesFetched()
  • CopernicaRestClient::backupState() -> BatchableRestClient:: getState()
  • CopernicaRestClient::restoreState() -> BatchableRestClient:: setState()

Additions

Batched fetching has its dedicated class now, BatchableRestClient, which extends RestClient for some separation of the extra necessary logic/state. Besides the older getMoreEntities(), an alternative getMoreEntitiesOrdered() has been added which does the same using different, often safer, logic. (See the code comments.)

A change in approach

20 Aug 19:57
Compare
Choose a tag to compare

CopernicaRestClient now throws exceptions on every non-2xx HTTP response except HTTP 303 on PUT (which is the default response for PUT). This way we're sure we are not hiding any errors or other strange behavior.

It does mean that there's a chance of throwing exceptions in cases the caller doesn't want this. (Example: when deleting an already-deleted entity.) There's a way of suppressing certain exceptions; the README's Usage section including "Error handling" goes into detail about this.

PHPUnit tests have been introduced, including a 'TestApi' utility class to exercise test API calls against, which supports a sizable chunk of profile related API calls. This facilitates writing tests for code that uses this library. An example of this (a test I've written for a synchronization process) is in extra/.

There's one TODO to solve before tagging 2.0: getEntities() should implement the 'total = false' parameter because that's supposedly a lot faster. (I hope/assume callers won't have to change any code in order to support this, but can't be 100% sure until I implement it.)

Incompatible changes since v1.0:

  • removed getData() (which is the same as get() now that we've introduced granular error-suppressing options)
  • removed sendData() (which was duplicate except for different error behavior). Use post() / put() instead.

Functional API client

05 Jul 21:50
Compare
Choose a tag to compare
1.0

Add build icon for Travis CI.