Code Duplication    Length = 7-10 lines in 39 locations

src/Resources/BlogTopics.php 2 locations

@@ 33-42 (lines=10) @@
30
     * @param array $params Array of optional parameters ['name','slug','limit', 'offset', 'active', 'blog']
31
     * @return \SevenShores\Hubspot\Http\Response
32
     */
33
    function search($query, $params = [])
34
    {
35
        $endpoint = 'https://api.hubapi.com/blogs/v3/topics/search';
36
37
        $params['q'] = $query;
38
39
        $queryString = build_query_string($params);
40
41
        return $this->client->request('get', $endpoint, [], $queryString);
42
    }
43
44
    /**
45
     * @param int $id
@@ 14-22 (lines=9) @@
11
     * @param  array $params Optional parameters ['name','slug','limit','offset']
12
     * @return \SevenShores\Hubspot\Http\Response
13
     */
14
    function all($params = [])
15
    {
16
17
        $endpoint = 'https://api.hubapi.com/blogs/v3/topics';
18
19
        $queryString = build_query_string($params);
20
21
        return $this->client->request('get', $endpoint, [], $queryString);
22
    }
23
24
    /**
25
     * Search a topic by the query. $query will match name and slug partially

src/Resources/ContactProperties.php 1 location

@@ 109-116 (lines=8) @@
106
     * @param bool $includeProperties
107
     * @return \SevenShores\Hubspot\Http\Response
108
     */
109
    function getGroups($includeProperties = false)
110
    {
111
        $endpoint = "https://api.hubapi.com/contacts/v2/groups";
112
113
        $queryString = build_query_string(['includeProperties' => $includeProperties]);
114
115
        return $this->client->request('get', $endpoint, [], $queryString);
116
    }
117
118
    /**
119
     * Create a contact property group.

src/Resources/Keywords.php 1 location

@@ 13-20 (lines=8) @@
10
     * @param string $search Optional search query.
11
     * @return \SevenShores\Hubspot\Http\Response
12
     */
13
    function all($search = null)
14
    {
15
        $endpoint = 'https://api.hubapi.com/keywords/v1/keywords';
16
17
        $queryString = build_query_string(['search' => $search]);
18
19
        return $this->client->request('get', $endpoint, [], $queryString);
20
    }
21
22
    /**
23
     * Get a keyword.

src/Resources/BlogAuthors.php 1 location

@@ 28-35 (lines=8) @@
25
     * @param  array $params Optional parameters.
26
     * @return \SevenShores\Hubspot\Http\Response
27
     */
28
    function all($params = [])
29
    {
30
        $endpoint = 'https://api.hubapi.com/blogs/v3/blog-authors';
31
32
        $queryString = build_query_string($params);
33
34
        return $this->client->request('get', $endpoint, [], $queryString);
35
    }
36
37
    /**
38
     * Search blog authors.

src/Resources/BlogPosts.php 1 location

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

src/Resources/Blogs.php 1 location

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

src/Resources/Companies.php 2 locations

@@ 64-71 (lines=8) @@
61
     *
62
     * @return \SevenShores\Hubspot\Http\Response
63
     */
64
    function all($params = [])
65
    {
66
        $endpoint = 'https://api.hubapi.com/companies/v2/companies/paged';
67
68
        $queryString = build_query_string($params);
69
70
        return $this->client->request('get', $endpoint, [], $queryString);
71
    }
72
73
    /**
74
     * Returns the recently modified companies
@@ 81-88 (lines=8) @@
78
     *
79
     * @return \SevenShores\Hubspot\Http\Response
80
     */
81
    function getRecentlyModified($params = [])
82
    {
83
        $endpoint = 'https://api.hubapi.com/companies/v2/companies/recent/modified';
84
85
        $queryString = build_query_string($params);
86
87
        return $this->client->request('get', $endpoint, [], $queryString);
88
    }
89
90
    /**
91
     * Returns the recently created companies

src/Resources/ContactLists.php 5 locations

@@ 57-64 (lines=8) @@
54
     * @param array $params ['count', 'offset']
55
     * @return \SevenShores\Hubspot\Http\Response
56
     */
57
    function all($params = [])
58
    {
59
        $endpoint = "https://api.hubapi.com/contacts/v1/lists";
60
61
        $queryString = build_query_string($params);
62
63
        return $this->client->request('get', $endpoint, [], $queryString);
64
    }
65
66
    /**
67
     * @param int $id
@@ 94-101 (lines=8) @@
91
     * @param array $params Optional parameters ['count', 'offset']
92
     * @return \SevenShores\Hubspot\Http\Response
93
     */
94
    function getAllStatic($params = [])
95
    {
96
        $endpoint = "https://api.hubapi.com/contacts/v1/lists/static";
97
98
        $queryString = build_query_string($params);
99
100
        return $this->client->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 \SevenShores\Hubspot\Http\Response
106
     */
107
    function getAllDynamic($params = [])
108
    {
109
        $endpoint = "https://api.hubapi.com/contacts/v1/lists/dynamic";
110
111
        $queryString = build_query_string($params);
112
113
        return $this->client->request('get', $endpoint, [], $queryString);
114
    }
115
116
    /**
117
     * Get contacts in a list.
@@ 124-131 (lines=8) @@
121
     *                      { count, vidOffset, property, propertyMode, formSubmissionMode, showListMemberships }
122
     * @return \SevenShores\Hubspot\Http\Response
123
     */
124
    function contacts($id, $params = [])
125
    {
126
        $endpoint = "https://api.hubapi.com/contacts/v1/lists/{$id}/contacts/all";
127
128
        $queryString = build_query_string($params);
129
130
        return $this->client->request('get', $endpoint, [], $queryString);
131
    }
132
133
    /**
134
     * Get recently added contact from a list.
@@ 140-147 (lines=8) @@
137
     * @param array $params
138
     * @return \SevenShores\Hubspot\Http\Response
139
     */
140
    function recentContacts($id, $params = [])
141
    {
142
        $endpoint = "https://api.hubapi.com/contacts/v1/lists/{$id}/contacts/recent";
143
144
        $queryString = build_query_string($params);
145
146
        return $this->client->request('get', $endpoint, [], $queryString);
147
    }
148
149
    /**
150
     * Refresh a list.

src/Resources/Email.php 1 location

@@ 28-35 (lines=8) @@
25
     * @param array $params Optional parameters
26
     * @return \SevenShores\Hubspot\Http\Response
27
     */
28
    function subscriptionsTimeline($params = [])
29
    {
30
        $endpoint = "https://api.hubapi.com/email/public/v1/subscriptions/timeline";
31
32
        $queryString = build_query_string($params);
33
34
        return $this->client->request('get', $endpoint, [], $queryString);
35
    }
36
37
    /**
38
     * Get email subscription status for an email address.

src/Resources/EmailEvents.php 2 locations

@@ 13-20 (lines=8) @@
10
     * @param array $params Optional parameters
11
     * @return \SevenShores\Hubspot\Http\Response
12
     */
13
    function getCampaignIds($params = [])
14
    {
15
        $endpoint = "https://api.hubapi.com/email/public/v1/campaigns";
16
17
        $queryString = build_query_string($params);
18
19
        return $this->client->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 \SevenShores\Hubspot\Http\Response
43
     */
44
    function all($params = [])
45
    {
46
        $endpoint = "https://api.hubapi.com/email/public/v1/events";
47
48
        $queryString = build_query_string($params);
49
50
        return $this->client->request('get', $endpoint, [], $queryString);
51
    }
52
53
    /**
54
     * Get event data for a specific event.

src/Resources/Owners.php 1 location

@@ 51-58 (lines=8) @@
48
     * @param array $params
49
     * @return \SevenShores\Hubspot\Http\Response
50
     */
51
    function all($params = [])
52
    {
53
        $endpoint = 'https://api.hubapi.com/owners/v2/owners';
54
55
        $queryString = build_query_string($params);
56
57
        return $this->client->request('get', $endpoint, [], $queryString);
58
    }
59
}
60

src/Resources/Pages.php 1 location

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

src/Resources/Files.php 1 location

@@ 45-52 (lines=8) @@
42
     * @param array $params Optional parameters
43
     * @return \SevenShores\Hubspot\Http\Response
44
     */
45
    function all($params = [])
46
    {
47
        $endpoint = "https://api.hubapi.com/filemanager/api/v2/files";
48
49
        $queryString = build_query_string($params);
50
51
        return $this->client->request('get', $endpoint, [], $queryString);
52
    }
53
54
55
    /**

src/Resources/Contacts.php 9 locations

@@ 102-109 (lines=8) @@
99
     * @param array $params Array of optional parameters ['count', 'property', 'vidOffset']
100
     * @return \SevenShores\Hubspot\Http\Response
101
     */
102
    function all($params = [])
103
    {
104
        $endpoint = "https://api.hubapi.com/contacts/v1/lists/all/contacts/all";
105
106
        $queryString = build_query_string($params);
107
108
        return $this->client->request('get', $endpoint, [], $queryString);
109
    }
110
111
    /**
112
     * For a given portal, return all contacts that have been recently updated or created.
@@ 122-129 (lines=8) @@
119
     *                      'propertyMode', 'formSubmissionMode', 'showListMemberships']
120
     * @return \SevenShores\Hubspot\Http\Response
121
     */
122
    function recent($params = [])
123
    {
124
        $endpoint = "https://api.hubapi.com/contacts/v1/lists/recently_updated/contacts/recent";
125
126
        $queryString = build_query_string($params);
127
128
        return $this->client->request('get', $endpoint, [], $queryString);
129
    }
130
131
    /**
132
     * @param int $id
@@ 137-144 (lines=8) @@
134
     *                      'showListMemberships']
135
     * @return \SevenShores\Hubspot\Http\Response
136
     */
137
    function getById($id, $params = [])
138
    {
139
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/vid/{$id}/profile";
140
141
        $queryString = build_query_string($params);
142
143
        return $this->client->request('get', $endpoint, [], $queryString);
144
    }
145
146
    /**
147
     * For a given portal, return information about a group of contacts by their unique ID's. A contact's unique ID's
@@ 160-169 (lines=10) @@
157
     *                      'showListMemberships', 'includeDeletes']
158
     * @return \SevenShores\Hubspot\Http\Response
159
     */
160
    function getBatchByIds($vids, $params = [])
161
    {
162
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/vids/batch/";
163
164
        $params['vid'] = $vids;
165
166
        $queryString = build_query_string($params);
167
168
        return $this->client->request('get', $endpoint, [], $queryString);
169
    }
170
171
    /**
172
     * @param string $email
@@ 177-184 (lines=8) @@
174
     *                      'showListMemberships']
175
     * @return \SevenShores\Hubspot\Http\Response
176
     */
177
    function getByEmail($email, $params = [])
178
    {
179
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/email/{$email}/profile";
180
181
        $queryString = build_query_string($params);
182
183
        return $this->client->request('get', $endpoint, [], $queryString);
184
    }
185
186
    /**
187
     * For a given portal, return information about a group of contacts by their email addresses.
@@ 199-208 (lines=10) @@
196
     *                      'showListMemberships', 'includeDeletes']
197
     * @return \SevenShores\Hubspot\Http\Response
198
     */
199
    function getBatchByEmails($emails, $params = [])
200
    {
201
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/emails/batch/";
202
203
        $params['email'] = $emails;
204
205
        $queryString = build_query_string($params);
206
207
        return $this->client->request('get', $endpoint, [], $queryString);
208
    }
209
210
    /**
211
     * @param string $utk
@@ 216-223 (lines=8) @@
213
     *                      'showListMemberships']
214
     * @return \SevenShores\Hubspot\Http\Response
215
     */
216
    function getByToken($utk, $params = [])
217
    {
218
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/utk/{$utk}/profile";
219
220
        $queryString = build_query_string($params);
221
222
        return $this->client->request('get', $endpoint, [], $queryString);
223
    }
224
225
    /**
226
     * For a given portal, return information about a group of contacts by their user tokens (hubspotutk).
@@ 242-251 (lines=10) @@
239
     *                      'showListMemberships', 'includeDeletes']
240
     * @return \SevenShores\Hubspot\Http\Response
241
     */
242
    function getBatchByTokens($utks, $params = [])
243
    {
244
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/utks/batch/";
245
246
        $params['utk'] = $utks;
247
248
        $queryString = build_query_string($params);
249
250
        return $this->client->request('get', $endpoint, [], $queryString);
251
    }
252
253
    /**
254
     * For a given portal, return contacts and some data associated with
@@ 268-277 (lines=10) @@
265
     * @param array  $params Array of optional parameters ['count', 'offset']
266
     * @return \SevenShores\Hubspot\Http\Response
267
     */
268
    function search($query, $params = [])
269
    {
270
        $endpoint = "https://api.hubapi.com/contacts/v1/search/query";
271
272
        $params['q'] = $query;
273
274
        $queryString = build_query_string($params);
275
276
        return $this->client->request('get', $endpoint, [], $queryString);
277
    }
278
279
    /**
280
     * @return \SevenShores\Hubspot\Http\Response

src/Resources/Deals.php 8 locations

@@ 42-48 (lines=7) @@
39
     * @return \Psr\Http\Message\ResponseInterface|\SevenShores\Hubspot\Http\Response
40
     * @throws \SevenShores\Hubspot\Exceptions\BadRequest
41
     */
42
    function getAll(array $params = []){
43
        $endpoint = "https://api.hubapi.com/deals/v1/deal/paged";
44
45
        $queryString = build_query_string($params);
46
47
        return $this->client->request('get', $endpoint, [], $queryString);
48
    }
49
50
51
    /**
@@ 66-72 (lines=7) @@
63
     * @param array $params Optional parameters ['limit', 'offset']
64
     * @return mixed
65
     */
66
    function getRecentlyModified(array $params = [])
67
    {
68
        $endpoint = "https://api.hubapi.com/deals/v1/deal/recent/modified";
69
        $queryString = build_query_string($params);
70
71
        return $this->client->request('get', $endpoint, [], $queryString);
72
    }
73
74
    /**
75
     * @param array $params Optional parameters ['limit', 'offset']
@@ 102-109 (lines=8) @@
99
     * @param int|int[] $companyIds
100
     * @return mixed
101
     */
102
    function associateWithCompany($dealId, $companyIds)
103
    {
104
        $endpoint = "https://api.hubapi.com/deals/v1/deal/{$dealId}/associations/COMPANY";
105
106
        $queryString = build_query_string(['id' => (array)$companyIds]);
107
108
        return $this->client->request('put', $endpoint, [], $queryString);
109
    }
110
111
    /**
112
     * @param int $dealId
@@ 116-123 (lines=8) @@
113
     * @param int|int[] $companyIds
114
     * @return mixed
115
     */
116
    function disassociateFromCompany($dealId, $companyIds)
117
    {
118
        $endpoint = "https://api.hubapi.com/deals/v1/deal/{$dealId}/associations/COMPANY";
119
120
        $queryString = build_query_string(['id' => (array)$companyIds]);
121
122
        return $this->client->request('delete', $endpoint, [], $queryString);
123
    }
124
125
    /**
126
     * @param int $dealId
@@ 130-137 (lines=8) @@
127
     * @param int|int[] $contactIds
128
     * @return mixed
129
     */
130
    function associateWithContact($dealId, $contactIds)
131
    {
132
        $endpoint = "https://api.hubapi.com/deals/v1/deal/{$dealId}/associations/CONTACT";
133
134
        $queryString = build_query_string(['id' => (array)$contactIds]);
135
136
        return $this->client->request('put', $endpoint, [], $queryString);
137
    }
138
    
139
    /**
140
     * @param int $contactId
@@ 144-151 (lines=8) @@
141
     * @param array $params Optional parameters ['limit', 'offset']
142
     * @return mixed
143
     */
144
    function associatedWithContact($contactId, $params = [])
145
    {
146
        $endpoint = "https://api.hubapi.com/deals/v1/deal/associated/contact/{$contactId}/paged";
147
148
        $queryString = build_query_string($params);
149
150
        return $this->client->request('get', $endpoint, [], $queryString);
151
    }
152
153
    /**
154
     * @param int $dealId
@@ 158-165 (lines=8) @@
155
     * @param int|int[] $contactIds
156
     * @return mixed
157
     */
158
    function disassociateFromContact($dealId, $contactIds)
159
    {
160
        $endpoint = "https://api.hubapi.com/deals/v1/deal/{$dealId}/associations/CONTACT";
161
162
        $queryString = build_query_string(['id' => (array)$contactIds]);
163
164
        return $this->client->request('delete', $endpoint, [], $queryString);
165
    }
166
167
    /**
168
     * @param string $objectType
@@ 175-182 (lines=8) @@
172
     *
173
     * @see https://developers.hubspot.com/docs/methods/deals/get-associated-deals
174
     */
175
    public function getAssociatedDeals($objectType, $objectId, $params = [])
176
    {
177
        $endpoint = "https://api.hubapi.com/deals/v1/deal/associated/{$objectType}/{$objectId}/paged";
178
179
        $queryString = build_query_string($params);
180
181
        return $this->client->request('get', $endpoint, [], $queryString);
182
    }
183
}
184

src/Resources/HubDB.php 1 location

@@ 30-36 (lines=7) @@
27
     *
28
     * @return \Psr\Http\Message\ResponseInterface|\SevenShores\Hubspot\Http\Response
29
     */
30
    public function tableInfo($portalId, $tableId) {
31
        $endpoint = 'https://api.hubapi.com/hubdb/api/v1/tables/'.$tableId;
32
33
        $queryString = build_query_string(['portalId' => $portalId]);
34
35
        return $this->client->request('get', $endpoint, [], $queryString);
36
    }
37
38
    /**
39
     * Delete a table

src/Resources/Workflows.php 1 location

@@ 110-119 (lines=10) @@
107
     * @param array $params Optional parameters.
108
     * @return \SevenShores\Hubspot\Http\Response
109
     */
110
    public function logEvents($workflow_id, $filter, $params = [])
111
    {
112
        $endpoint = "https://api.hubapi.com/automation/v3/logevents/workflows/{$workflow_id}/filter";
113
114
        $options['json'] = $filter;
115
116
        $queryString = build_query_string($params);
117
118
        return $this->client->request('put', $endpoint, $options, $queryString);
119
    }
120
}
121