<commit_before><?php namespace Fungku\HubSpot\Api;

use Fungku\HubSpot\Exceptions\HubSpotException;

class Contacts extends Api
{
    /**
     * @param array $contact Array of contact properties.
     * @return mixed
     * @throws HubSpotException
     */
    public function create(array $contact)
    {
        if (! has_required_property('email', $contact)) {
            throw new HubSpotException("You need an email address to create a Contact");
        }

        $endpoint = "/contacts/v1/contact";

        $options['json'] = $contact;

        return $this->request('post', $endpoint, $options);
    }

    /**
     * @param int $id The contact id.
     * @param array $contact The contact properties to update.
     * @return mixed
     */
    public function update($id, array $contact)
    {
        $endpoint = "/contacts/v1/contact/vid/{$id}/profile";

        $options['json'] = $contact;

        return $this->request('post', $endpoint, $options);
    }

    /**
     * @param string $email The contact's email address.
     * @param array $properties The contact properties.
     * @return mixed
     */
    public function createOrUpdate($email, array $properties)
    {
        $endpoint = "/contacts/v1/contact/createOrUpdate/email/{$email}";

        $options['json'] = $properties;

        return $this->request('post', $endpoint, $options);
    }

    /**
     * @param array $contacts The contacts and properties.
     * @return mixed
     */
    public function createOrUpdateBatch(array $contacts)
    {
        $endpoint = "/contacts/v1/contact/batch";

        $options['json'] = $contacts;

        return $this->request('post', $endpoint, $options);
    }

    /**
     * @param int $id
     * @return mixed
     */
    public function delete($id)
    {
        $endpoint = "/contacts/v1/contact/vid/{$id}";

        return $this->request('delete', $endpoint);
    }
<commit_msg>Create or update contacts, add properties array key for consistency<commit_after><?php namespace Fungku\HubSpot\Api;

use Fungku\HubSpot\Exceptions\HubSpotException;

class Contacts extends Api
{
    /**
     * @param array $properties Array of contact properties.
     * @return mixed
     * @throws HubSpotException
     */
    public function create(array $properties)
    {
        $endpoint = "/contacts/v1/contact";

        $options['json'] = ['properties' => $properties];

        return $this->request('post', $endpoint, $options);
    }

    /**
     * @param int $id The contact id.
     * @param array $properties The contact properties to update.
     * @return mixed
     */
    public function update($id, array $properties)
    {
        $endpoint = "/contacts/v1/contact/vid/{$id}/profile";

        $options['json'] = ['properties' => $properties];

        return $this->request('post', $endpoint, $options);
    }

    /**
     * @param string $email The contact's email address.
     * @param array $properties The contact properties.
     * @return mixed
     */
    public function createOrUpdate($email, array $properties)
    {
        $endpoint = "/contacts/v1/contact/createOrUpdate/email/{$email}";

        $options['json'] = ['properties' => $properties];

        return $this->request('post', $endpoint, $options);
    }

    /**
     * @param array $contacts The contacts and properties.
     * @return mixed
     */
    public function createOrUpdateBatch(array $contacts)
    {
        $endpoint = "/contacts/v1/contact/batch";

        $options['json'] = $contacts;

        return $this->request('post', $endpoint, $options);
    }

    /**
     * @param int $id
     * @return mixed
     */
    public function delete($id)
    {
        $endpoint = "/contacts/v1/contact/vid/{$id}";

        return $this->request('delete', $endpoint);
    }

{'fraction_non_alphanumeric': 0.14364786505007907, 'fraction_numerical': 0.002635740643120717, 'mean_word_length': 2.4880514705882355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2057031', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1075, 'n_words': 272}