PascalPrecht/Clever-Reach-PHP-API — Issue #2: A "more-beautyful" API
Author: PascalPrecht
Created: 2011-11-29 10:33:52+00:00
State: open

Currently you have to make requests with the CleverReachClient. It were nice, if there is a way to make some methods in other classes available. E.g. adding a new CleverReachReceiver to a CleverReachList. Currently you do it so:

```php
$client = CleverReachFactory::clientForAPIKey("Your_API_key");

$receiver = CleverReachFactory::buildReceiver();
$receiver->setEmail("any@email.address");
$receiver->setFirstname("Foo");
$receiver->setLastname("Bar");

// and so on...

$client->addReceiver("Any_list_ID", $receiver);
```

I think it were more useful to do it a little bit like this:

```php
$client = CleverReachFactory::clientForAPIKey("Your_API_key");

$receiver = CleverReachFactory::buildReceiver();
$receiver->setEmail("any@email.address");
$receiver->setFirstname("Foo");
$receiver->setLastname("Bar");

$list = $client->getListByName("MyList");
$list->addReceiver($receiver);

// and the same for fetching a receiver

$otherReceiver = $list->getReceiverByEmail("any@email.address");

```