Nascom / TeamleaderApiClient

PHP Client to connect to the Teamleader API
MIT License
9 stars 9 forks source link

Do not post optional, unset Contact fields to Teamleader API #9

Closed svendecabooter closed 6 years ago

svendecabooter commented 6 years ago

When adding a contact through v2 of this Teamleader API library, I'm getting errors when only a few variables are provided.

Example use case:

    $contact_variables = [
      'first_name' => "First",
      'last_name' => "Last",
      'emails' => [
        [
          'type' => 'primary',
          'email' => "test@example.com",
        ],
      ],
    ];
    $contact = new Contact($contact_variables);
    $contactRepository->addContact($contact);

Problems:

This PR fixes this behaviour, allowing me to add contacts to Teamleader that only contain a few basic fields.

mark-gerarts commented 6 years ago

We encountered the same problem ourselves, and were thinking about a similar fix. Thanks for the PR!

svendecabooter commented 6 years ago

Thanks for the quick feedback & merge!