Code Duplication    Length = 8-10 lines in 20 locations

src/Api/Contacts.php 6 locations

@@ 142-151 (lines=10) @@
139
     *                      'showListMemberships', 'includeDeletes']
140
     * @return \Fungku\HubSpot\Http\Response
141
     */
142
    public function getBatchByIds($vids, $params = [])
143
    {
144
        $endpoint = "/contacts/v1/contact/vids/batch/";
145
146
        $params['vid'] = $vids;
147
148
        $queryString = $this->buildQueryString($params);
149
150
        return $this->request('get', $endpoint, [], $queryString);
151
    }
152
153
    /**
154
     * @param string $email
@@ 177-186 (lines=10) @@
174
     *                      'showListMemberships', 'includeDeletes']
175
     * @return \Fungku\HubSpot\Http\Response
176
     */
177
    public function getBatchByEmails($emails, $params = [])
178
    {
179
        $endpoint = "/contacts/v1/contact/emails/batch/";
180
181
        $params['email'] = $emails;
182
183
        $queryString = $this->buildQueryString($params);
184
185
        return $this->request('get', $endpoint, [], $queryString);
186
    }
187
188
    /**
189
     * @param string $utk
@@ 216-225 (lines=10) @@
213
     *                      'showListMemberships', 'includeDeletes']
214
     * @return \Fungku\HubSpot\Http\Response
215
     */
216
    public function getBatchByTokens($utks, $params = [])
217
    {
218
        $endpoint = "/contacts/v1/contact/utks/batch/";
219
220
        $params['utk'] = $utks;
221
222
        $queryString = $this->buildQueryString($params);
223
224
        return $this->request('get', $endpoint, [], $queryString);
225
    }
226
227
    /**
228
     * For a given portal, return contacts and some data associated with
@@ 242-251 (lines=10) @@
239
     * @param array  $params Array of optional parameters ['count', 'offset']
240
     * @return \Fungku\HubSpot\Http\Response
241
     */
242
    public function search($query, $params = [])
243
    {
244
        $endpoint = "/contacts/v1/search/query";
245
246
        $params['q'] = $query;
247
248
        $queryString = $this->buildQueryString($params);
249
250
        return $this->request('get', $endpoint, [], $queryString);
251
    }
252
253
    /**
254
     * @return \Fungku\HubSpot\Http\Response
@@ 88-95 (lines=8) @@
85
     * @param array $params Array of optional parameters ['count', 'property', 'vidOffset']
86
     * @return \Fungku\HubSpot\Http\Response
87
     */
88
    public function all($params = [])
89
    {
90
        $endpoint = "/contacts/v1/lists/all/contacts/all";
91
92
        $queryString = $this->buildQueryString($params);
93
94
        return $this->request('get', $endpoint, [], $queryString);
95
    }
96
97
    /**
98
     * For a given portal, return all contacts that have been recently updated or created.
@@ 108-115 (lines=8) @@
105
     *                      'propertyMode', 'formSubmissionMode', 'showListMemberships']
106
     * @return \Fungku\HubSpot\Http\Response
107
     */
108
    public function recent($params = [])
109
    {
110
        $endpoint = "/contacts/v1/lists/recently_updated/contacts/recent";
111
112
        $queryString = $this->buildQueryString($params);
113
114
        return $this->request('get', $endpoint, [], $queryString);
115
    }
116
117
    /**
118
     * @param int $id

src/Api/Email.php 2 locations

@@ 61-69 (lines=9) @@
58
     * @param array  $params
59
     * @return \Fungku\HubSpot\Http\Response
60
     */
61
    public function updateSubscription($portal_id, $email, $params = [])
62
    {
63
        $endpoint = "/email/public/v1/subscriptions/{$email}";
64
65
        $queryString = $this->buildQueryString(['portalId' => $portal_id]);
66
        $options['json'] = $params;
67
68
        return $this->request('put', $endpoint, $options, $queryString);
69
    }
70
71
}
72
@@ 28-35 (lines=8) @@
25
     * @param array $params Optional parameters
26
     * @return \Fungku\HubSpot\Http\Response
27
     */
28
    public function subscriptionsTimeline($params = [])
29
    {
30
        $endpoint = "/email/public/v1/subscriptions/timeline";
31
32
        $queryString = $this->buildQueryString($params);
33
34
        return $this->request('get', $endpoint, [], $queryString);
35
    }
36
37
    /**
38
     * Get email subscription status for an email address.

src/Api/BlogPosts.php 1 location

@@ 28-35 (lines=8) @@
25
     * @param  array $params Optional parameters.
26
     * @return \Fungku\HubSpot\Http\Response
27
     */
28
    public function all($params = [])
29
    {
30
        $endpoint = "/content/api/v2/blog-posts";
31
32
        $queryString = $this->buildQueryString($params);
33
34
        return $this->request('get', $endpoint, [], $queryString);
35
    }
36
37
    /**
38
     * Update a blog post.

src/Api/Blogs.php 1 location

@@ 13-20 (lines=8) @@
10
     * @param array $params Optional parameters ['limit', 'offset', 'created', 'deleted_at', 'name']
11
     * @return \Fungku\HubSpot\Http\Response
12
     */
13
    public function all($params = [])
14
    {
15
        $endpoint = '/content/api/v2/blogs';
16
17
        $queryString = $this->buildQueryString($params);
18
19
        return $this->request('get', $endpoint, [], $queryString);
20
    }
21
22
    /**
23
     * Get information about a specific blog.

src/Api/Companies.php 4 locations

@@ 64-71 (lines=8) @@
61
     *
62
     * @return \Fungku\HubSpot\Http\Response
63
     */
64
    public function getRecentlyModified($params = [])
65
    {
66
        $endpoint = '/companies/v2/companies/recent/modified';
67
68
        $queryString = $this->buildQueryString($params);
69
70
        return $this->request('get', $endpoint, [], $queryString);
71
    }
72
73
    /**
74
     * Returns the recently created companies
@@ 81-88 (lines=8) @@
78
     *
79
     * @return \Fungku\HubSpot\Http\Response
80
     */
81
    public function getRecentlyCreated($params = [])
82
    {
83
        $endpoint = '/companies/v2/companies/recent/created';
84
85
        $queryString = $this->buildQueryString($params);
86
87
        return $this->request('get', $endpoint, [], $queryString);
88
    }
89
90
    /**
91
     * Returns an array of companies that have a matching domain
@@ 146-153 (lines=8) @@
143
     *
144
     * @return \Fungku\HubSpot\Http\Response
145
     */
146
    public function getAssociatedContacts($companyId, $params = [])
147
    {
148
        $endpoint = "/companies/v2/companies/{$companyId}/contacts";
149
150
        $queryString = $this->buildQueryString($params);
151
152
        return $this->request('get', $endpoint, [], $queryString);
153
    }
154
155
    /**
156
     * Returns all of the contact IDs who are associated with the given company
@@ 164-171 (lines=8) @@
161
     *
162
     * @return \Fungku\HubSpot\Http\Response
163
     */
164
    public function getAssociatedContactIds($companyId, $params = [])
165
    {
166
        $endpoint = "/companies/v2/companies/{$companyId}/vids";
167
168
        $queryString = $this->buildQueryString($params);
169
170
        return $this->request('get', $endpoint, [], $queryString);
171
    }
172
173
    /**
174
     * Removes a contact from a company

src/Api/EmailEvents.php 2 locations

@@ 13-20 (lines=8) @@
10
     * @param array $params Optional parameters
11
     * @return \Fungku\HubSpot\Http\Response
12
     */
13
    public function getCampaignIds($params = [])
14
    {
15
        $endpoint = "/email/public/v1/campaigns";
16
17
        $queryString = $this->buildQueryString($params);
18
19
        return $this->request('get', $endpoint, [], $queryString);
20
    }
21
22
    /**
23
     * Get campaign data for a given campaign.
@@ 44-51 (lines=8) @@
41
     * @param array $params Optional parameters
42
     * @return \Fungku\HubSpot\Http\Response
43
     */
44
    public function all($params = [])
45
    {
46
        $endpoint = "/email/public/v1/events";
47
48
        $queryString = $this->buildQueryString($params);
49
50
        return $this->request('get', $endpoint, [], $queryString);
51
    }
52
53
    /**
54
     * Get event data for a specific event.

src/Api/Pages.php 1 location

@@ 28-35 (lines=8) @@
25
     * @param array $params Optional parameters.
26
     * @return \Fungku\HubSpot\Http\Response
27
     */
28
    public function all($params = [])
29
    {
30
        $endpoint = "/content/api/v2/pages";
31
32
        $queryString = $this->buildQueryString($params);
33
34
        return $this->request('get', $endpoint, [], $queryString);
35
    }
36
37
    /**
38
     * Update a page.

src/Api/ContactLists.php 2 locations

@@ 94-101 (lines=8) @@
91
     * @param array $params Optional parameters ['count', 'offset']
92
     * @return \Fungku\HubSpot\Http\Response
93
     */
94
    public function getAllStatic($params = [])
95
    {
96
        $endpoint = "/contacts/v1/lists/static";
97
98
        $queryString = $this->buildQueryString($params);
99
100
        return $this->request('get', $endpoint, [], $queryString);
101
    }
102
103
    /**
104
     * @param array $params Optional parameters ['count', 'offset']
@@ 107-114 (lines=8) @@
104
     * @param array $params Optional parameters ['count', 'offset']
105
     * @return \Fungku\HubSpot\Http\Response
106
     */
107
    public function getAllDynamic($params = [])
108
    {
109
        $endpoint = "/contacts/v1/lists/dynamic";
110
111
        $queryString = $this->buildQueryString($params);
112
113
        return $this->request('get', $endpoint, [], $queryString);
114
    }
115
116
    /**
117
     * Get contacts in a list.

src/Api/BlogTopics.php 1 location

@@ 33-41 (lines=9) @@
30
     * @param array $params Array of optional parameters ['name','slug','limit', 'offset', 'active', 'blog']
31
     * @return \Fungku\HubSpot\Http\Response
32
     */
33
    public function search($query, $params = [])
34
    {
35
        $endpoint = '/blogs/v3/topics/search';
36
37
        $params['q'] = $query;
38
39
        $queryString = $this->buildQueryString($params);
40
41
        return $this->request('get', $endpoint, [], $queryString);
42
    }
43
44
    /**