Skip to content

Commit

Permalink
Merge branch 'master' into review/contactsTest
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Factory.php
#	src/Resources/Contacts.php
  • Loading branch information
ksvirkou-hubspot committed Jan 9, 2020
2 parents 6a320d7 + cee468c commit b530cd6
Show file tree
Hide file tree
Showing 27 changed files with 1,290 additions and 375 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: php

php:
- 5.6
- 7.0
- 7.1

sudo: false

Expand Down
76 changes: 48 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,31 +171,51 @@ $authUrl = Utils::getFactory()->oAuth2()->getAuthUrl(

## Status

If you see something not planned, that you want, make an [issue](https://github.com/fungku/hubspot-php/issues) and there's a good chance I will add it.

- [x] Analytics
- [x] Blogs (COS)
- [x] Blog Authors (COS)
- [x] Blog Posts (COS)
- [x] Blog Topics (COS)
- [x] Companies
- [x] Company Properties
- [x] Contacts
- [x] Contact Lists
- [x] Contact Properties
- [x] CRM Pipelines
- [x] Deals
- [x] Email
- [x] Email Events
- [x] Engagements
- [x] Events (Enterprise)
- [x] Files (COS)
- [x] Forms
- [x] Keywords
- [x] Object Properties :new:
- [x] Owners
- [x] Page Publishing (COS)
- [x] Social Media
- [ ] Templates (COS)
- [x] Timeline
- [x] Workflows
If you see something not planned, that you want, make an [issue](https://github.com/HubSpot/hubspot-php/issues) and there's a good chance I will add it.

- [x] Analytics API
- [x] Calendar API :upadated:
- [x] Companies API :upadated:
- [x] Company Properties API :upadated:
- [x] Contacts API :upadated:
- [x] Contact Lists API :upadated:
- [x] Contact Properties API :upadated:
- [ ] Conversations Live Chat Widget API (Front End)
- [x] CMS Blog API (Blogs)
- [x] CMS Blog Authors API (BlogAuthors)
- [ ] CMS Blog Comments API
- [x] CMS Blog Post API (BlogPosts)
- [x] CMS Blog Topics API (BlogTopics)
- [ ] CMS Domains API
- [x] CMS Files API (Files)
- [x] CMS HubDB API (HubDB) :upadated:
- [ ] CMS Layouts API
- [x] CMS Page Publishing API (Pages)
- [ ] CMS Site Maps
- [ ] CMS Site Search API
- [ ] CMS Templates API
- [ ] CMS URL Mappings API
- [x] CRM Associations API
- [ ] CRM Extensions API
- [x] CRM Object Properties API (ObjectProperties) :new:
- [x] CRM Pipelines API (CrmPipelines)
- [x] Deals API
- [x] Deal Pipelines API :deprecated:
- [x] Deal Properties API :upadated:
- [x] Ecommerce Bridge API :upadated:
- [x] Email Subscription API :upadated:
- [x] Email Events API :upadated:
- [x] Engagements API
- [x] Events API
- [x] Forms API :upadated:
- [ ] Line Items API
- [ ] Marketing Email API
- [x] Owners API :upadated:
- [ ] Products API
- [x] Social Media API
- [x] Tickets API
- [x] Timeline API :upadated:
- [ ] Tracking Code API
- [x] Transactional Email API
- [x] Workflows API :upadated:
- [x] Webhooks API
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"php": ">=5.6.0",
"php": ">=7.0",
"ext-json": "*",
"guzzlehttp/guzzle": "~6.0"
},
Expand Down
96 changes: 48 additions & 48 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,54 @@
namespace SevenShores\Hubspot;

use SevenShores\Hubspot\Http\Client;
use SevenShores\Hubspot\Resources\Resource;

/**
* Class Factory.
*
* @method \SevenShores\Hubspot\Resources\Analytics analytics()
* @method \SevenShores\Hubspot\Resources\BlogAuthors blogAuthors()
* @method \SevenShores\Hubspot\Resources\Blogs blogs()
* @method \SevenShores\Hubspot\Resources\BlogPosts blogPosts()
* @method \SevenShores\Hubspot\Resources\BlogTopics blogTopics()
* @method \SevenShores\Hubspot\Resources\Companies companies()
* @method \SevenShores\Hubspot\Resources\CompanyProperties companyProperties()
* @method \SevenShores\Hubspot\Resources\CalendarEvents calendarEvents()
* @method \SevenShores\Hubspot\Resources\ContactLists contactLists()
* @method \SevenShores\Hubspot\Resources\ContactProperties contactProperties()
* @method \SevenShores\Hubspot\Resources\Contacts contacts()
* @method \SevenShores\Hubspot\Resources\CrmAssociations crmAssociations()
* @method \SevenShores\Hubspot\Resources\CrmPipelines crmPipelines()
* @method \SevenShores\Hubspot\Resources\Email email()
* @method \SevenShores\Hubspot\Resources\EmailEvents emailEvents()
* @method \SevenShores\Hubspot\Resources\Engagements engagements()
* @method \SevenShores\Hubspot\Resources\Files files()
* @method \SevenShores\Hubspot\Resources\Forms forms()
* @method \SevenShores\Hubspot\Resources\HubDB hubDB()
* @method \SevenShores\Hubspot\Resources\Keywords keywords()
* @method \SevenShores\Hubspot\Resources\Pages pages()
* @method \SevenShores\Hubspot\Resources\SocialMedia socialMedia()
* @method \SevenShores\Hubspot\Resources\Tickets tickets()
* @method \SevenShores\Hubspot\Resources\Timeline timeline()
* @method \SevenShores\Hubspot\Resources\Workflows workflows()
* @method \SevenShores\Hubspot\Resources\Events events()
* @method \SevenShores\Hubspot\Resources\DealPipelines dealPipelines()
* @method \SevenShores\Hubspot\Resources\DealProperties dealProperties()
* @method \SevenShores\Hubspot\Resources\Deals deals()
* @method \SevenShores\Hubspot\Resources\Owners owners()
* @method \SevenShores\Hubspot\Resources\SingleEmail singleEmail()
* @method \SevenShores\Hubspot\Resources\Integration integration()
* @method \SevenShores\Hubspot\Resources\EcommerceBridge ecommerceBridge()
* @method \SevenShores\Hubspot\Resources\Webhooks webhooks()
* @method \SevenShores\Hubspot\Resources\OAuth2 oAuth2()
* @method \SevenShores\Hubspot\Resources\ObjectProperties objectProperties()
* @method \SevenShores\Hubspot\Resources\Analytics analytics()
* @method \SevenShores\Hubspot\Resources\BlogAuthors blogAuthors()
* @method \SevenShores\Hubspot\Resources\Blogs blogs()
* @method \SevenShores\Hubspot\Resources\BlogPosts blogPosts()
* @method \SevenShores\Hubspot\Resources\BlogTopics blogTopics()
* @method \SevenShores\Hubspot\Resources\Companies companies()
* @method \SevenShores\Hubspot\Resources\CompanyProperties companyProperties()
* @method \SevenShores\Hubspot\Resources\CalendarEvents calendarEvents()
* @method \SevenShores\Hubspot\Resources\ContactLists contactLists()
* @method \SevenShores\Hubspot\Resources\ContactProperties contactProperties()
* @method \SevenShores\Hubspot\Resources\Contacts contacts()
* @method \SevenShores\Hubspot\Resources\CrmAssociations crmAssociations()
* @method \SevenShores\Hubspot\Resources\CrmPipelines crmPipelines()
* @method \SevenShores\Hubspot\Resources\EmailSubscription emailSubscription()
* @method \SevenShores\Hubspot\Resources\EmailEvents emailEvents()
* @method \SevenShores\Hubspot\Resources\Engagements engagements()
* @method \SevenShores\Hubspot\Resources\Files files()
* @method \SevenShores\Hubspot\Resources\Forms forms()
* @method \SevenShores\Hubspot\Resources\HubDB hubDB()
* @method \SevenShores\Hubspot\Resources\Keywords keywords()
* @method \SevenShores\Hubspot\Resources\Pages pages()
* @method \SevenShores\Hubspot\Resources\SocialMedia socialMedia()
* @method \SevenShores\Hubspot\Resources\Tickets tickets()
* @method \SevenShores\Hubspot\Resources\Timeline timeline()
* @method \SevenShores\Hubspot\Resources\Workflows workflows()
* @method \SevenShores\Hubspot\Resources\Events events()
* @method \SevenShores\Hubspot\Resources\DealPipelines dealPipelines()
* @method \SevenShores\Hubspot\Resources\DealProperties dealProperties()
* @method \SevenShores\Hubspot\Resources\Deals deals()
* @method \SevenShores\Hubspot\Resources\Owners owners()
* @method \SevenShores\Hubspot\Resources\TransactionalEmail transactionalEmail()
* @method \SevenShores\Hubspot\Resources\Integration integration()
* @method \SevenShores\Hubspot\Resources\EcommerceBridge ecommerceBridge()
* @method \SevenShores\Hubspot\Resources\Webhooks webhooks()
* @method \SevenShores\Hubspot\Resources\OAuth2 oAuth2()
* @method \SevenShores\Hubspot\Resources\ObjectProperties objectProperties()
*/
class Factory
{
/** @var Client */
private $client;
/**
* @var Client
*/
protected $client;

/**
* C O N S T R U C T O R ( ^_^)y.
Expand All @@ -57,21 +60,18 @@ class Factory
* @param array $clientOptions options to be send with each request
* @param bool $wrapResponse wrap request response in own Response object
*/
public function __construct($config = [], $client = null, $clientOptions = [], $wrapResponse = true)
public function __construct(array $config = [], Client $client = null, array $clientOptions = [], $wrapResponse = true)
{
$this->client = $client ?: new Client($config, null, $clientOptions, $wrapResponse);
}

/**
* Return an instance of a Resource based on the method called.
*
* @param string $name
* @param array $arguments
* @param mixed $args
*
* @return \SevenShores\Hubspot\Resources\Resource
* @param array $arguments
* @param mixed $args
*/
public function __call($name, $args)
public function __call(string $name, $args): Resource
{
$resource = 'SevenShores\\Hubspot\\Resources\\'.ucfirst($name);

Expand All @@ -96,7 +96,7 @@ public function getClient()
*
* @return static
*/
public static function create($api_key = null, $client = null, $clientOptions = [], $wrapResponse = true)
public static function create(string $api_key = null, Client $client = null, array $clientOptions = [], bool $wrapResponse = true): self
{
return new static(['key' => $api_key], $client, $clientOptions, $wrapResponse);
}
Expand All @@ -111,7 +111,7 @@ public static function create($api_key = null, $client = null, $clientOptions =
*
* @return static
*/
public static function createWithToken($token, $client = null, $clientOptions = [], $wrapResponse = true)
public static function createWithToken(string $token, Client $client = null, array $clientOptions = [], bool $wrapResponse = true): self
{
return new static(['key' => $token, 'oauth' => true], $client, $clientOptions, $wrapResponse);
}
Expand All @@ -126,7 +126,7 @@ public static function createWithToken($token, $client = null, $clientOptions =
*
* @return static
*/
public static function createWithOAuth2Token($token, $client = null, $clientOptions = [], $wrapResponse = true)
public static function createWithOAuth2Token(string $token, Client $client = null, array $clientOptions = [], bool $wrapResponse = true): self
{
return new static(['key' => $token, 'oauth2' => true], $client, $clientOptions, $wrapResponse);
}
Expand Down
20 changes: 9 additions & 11 deletions src/Resources/Contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function update($id, array $properties)
*
* @see https://developers.hubspot.com/docs/methods/contacts/update_contact-by-email
*/
public function updateByEmail($email, array $properties)
public function updateByEmail(string $email, array $properties)
{
$endpoint = "https://api.hubapi.com/contacts/v1/contact/email/{$email}/profile";

Expand All @@ -79,7 +79,7 @@ public function updateByEmail($email, array $properties)
*
* @see https://developers.hubspot.com/docs/methods/contacts/create_or_update
*/
public function createOrUpdate($email, array $properties = [])
public function createOrUpdate(string $email, array $properties = [])
{
$endpoint = "https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/{$email}";

Expand Down Expand Up @@ -259,15 +259,14 @@ public function getBatchByIds(array $vids, array $params = [])
/**
* Get a contact by email address.
*
* @param string $email
* @param array $params Array of optional parameters ['property', 'propertyMode', 'formSubmissionMode',
* 'showListMemberships']
* @param array $params Array of optional parameters ['property', 'propertyMode', 'formSubmissionMode',
* 'showListMemberships']
*
* @return \SevenShores\Hubspot\Http\Response
*
* @see https://developers.hubspot.com/docs/methods/contacts/get_contact_by_email
*/
public function getByEmail($email, array $params = [])
public function getByEmail(string $email, array $params = [])
{
$endpoint = "https://api.hubapi.com/contacts/v1/contact/email/{$email}/profile";

Expand Down Expand Up @@ -310,15 +309,14 @@ public function getBatchByEmails($emails, array $params = [])
/**
* Get a contact by its user token.
*
* @param string $utk
* @param array $params Array of optional parameters ['property', 'propertyMode', 'formSubmissionMode',
* 'showListMemberships']
* @param array $params Array of optional parameters ['property', 'propertyMode', 'formSubmissionMode',
* 'showListMemberships']
*
* @return \SevenShores\Hubspot\Http\Response
*
* @see https://developers.hubspot.com/docs/methods/contacts/get_contact_by_utk
*/
public function getByToken($utk, array $params = [])
public function getByToken(string $utk, array $params = [])
{
$endpoint = "https://api.hubapi.com/contacts/v1/contact/utk/{$utk}/profile";

Expand Down Expand Up @@ -378,7 +376,7 @@ public function getBatchByTokens(array $utks, array $params = [])
*
* @return \SevenShores\Hubspot\Http\Response
*/
public function search($query, array $params = [])
public function search(string $query, array $params = [])
{
$endpoint = 'https://api.hubapi.com/contacts/v1/search/query';

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Deals.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function updateBatch(array $deals)
*
* @return \Psr\Http\Message\ResponseInterface|\SevenShores\Hubspot\Http\Response
*/
public function getAll(array $params = [])
public function all(array $params = [])
{
$endpoint = 'https://api.hubapi.com/deals/v1/deal/paged';

Expand Down
Loading

0 comments on commit b530cd6

Please sign in to comment.