Code Duplication    Length = 7-10 lines in 47 locations

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/BlogTopics.php 2 locations

@@ 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
@@ 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

src/Resources/Companies.php 5 locations

@@ 76-83 (lines=8) @@
73
     *
74
     * @return \SevenShores\Hubspot\Http\Response
75
     */
76
    function all($params = [])
77
    {
78
        $endpoint = 'https://api.hubapi.com/companies/v2/companies/paged';
79
80
        $queryString = build_query_string($params);
81
82
        return $this->client->request('get', $endpoint, [], $queryString);
83
    }
84
85
    /**
86
     * Returns the recently modified companies
@@ 93-100 (lines=8) @@
90
     *
91
     * @return \SevenShores\Hubspot\Http\Response
92
     */
93
    function getRecentlyModified($params = [])
94
    {
95
        $endpoint = 'https://api.hubapi.com/companies/v2/companies/recent/modified';
96
97
        $queryString = build_query_string($params);
98
99
        return $this->client->request('get', $endpoint, [], $queryString);
100
    }
101
102
    /**
103
     * Returns the recently created companies
@@ 110-117 (lines=8) @@
107
     *
108
     * @return \SevenShores\Hubspot\Http\Response
109
     */
110
    function getRecentlyCreated($params = [])
111
    {
112
        $endpoint = 'https://api.hubapi.com/companies/v2/companies/recent/created';
113
114
        $queryString = build_query_string($params);
115
116
        return $this->client->request('get', $endpoint, [], $queryString);
117
    }
118
119
    /**
120
     * Returns an array of companies that have a matching domain
@@ 201-208 (lines=8) @@
198
     *
199
     * @return \SevenShores\Hubspot\Http\Response
200
     */
201
    function getAssociatedContacts($companyId, $params = [])
202
    {
203
        $endpoint = "https://api.hubapi.com/companies/v2/companies/{$companyId}/contacts";
204
205
        $queryString = build_query_string($params);
206
207
        return $this->client->request('get', $endpoint, [], $queryString);
208
    }
209
210
    /**
211
     * Returns all of the contact IDs who are associated with the given company
@@ 219-226 (lines=8) @@
216
     *
217
     * @return \SevenShores\Hubspot\Http\Response
218
     */
219
    function getAssociatedContactIds($companyId, $params = [])
220
    {
221
        $endpoint = "https://api.hubapi.com/companies/v2/companies/{$companyId}/vids";
222
223
        $queryString = build_query_string($params);
224
225
        return $this->client->request('get', $endpoint, [], $queryString);
226
    }
227
228
    /**
229
     * Removes a contact from a company

src/Resources/ContactLists.php 6 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
@@ 81-88 (lines=8) @@
78
     * @param array $ids
79
     * @return \SevenShores\Hubspot\Http\Response
80
     */
81
    function getBatchByIds($ids)
82
    {
83
        $endpoint = "https://api.hubapi.com/contacts/v1/lists/batch";
84
85
        $queryString = build_query_string(['listId' => $ids]);
86
87
        return $this->client->request('get', $endpoint, [], $queryString);
88
    }
89
90
    /**
91
     * @param array $params Optional parameters ['count', 'offset']
@@ 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/Contacts.php 10 locations

@@ 105-112 (lines=8) @@
102
     * @param array $params Array of optional parameters ['count', 'property', 'vidOffset']
103
     * @return \SevenShores\Hubspot\Http\Response
104
     */
105
    function all($params = [])
106
    {
107
        $endpoint = "https://api.hubapi.com/contacts/v1/lists/all/contacts/all";
108
109
        $queryString = build_query_string($params);
110
111
        return $this->client->request('get', $endpoint, [], $queryString);
112
    }
113
114
    /**
115
     * For a given portal, return all contacts that have been recently updated or created.
@@ 125-132 (lines=8) @@
122
     *                      'propertyMode', 'formSubmissionMode', 'showListMemberships']
123
     * @return \SevenShores\Hubspot\Http\Response
124
     */
125
    function recent($params = [])
126
    {
127
        $endpoint = "https://api.hubapi.com/contacts/v1/lists/recently_updated/contacts/recent";
128
129
        $queryString = build_query_string($params);
130
131
        return $this->client->request('get', $endpoint, [], $queryString);
132
    }
133
    
134
    /**
135
     * For a given portal, return all contacts that have been recently created.
@@ 145-152 (lines=8) @@
142
     *                      'propertyMode', 'formSubmissionMode', 'showListMemberships']
143
     * @return \SevenShores\Hubspot\Http\Response
144
     */
145
    function recentNew($params = [])
146
    {
147
        $endpoint = "https://api.hubapi.com/contacts/v1/lists/all/contacts/recent";
148
149
        $queryString = build_query_string($params);
150
151
        return $this->client->request('get', $endpoint, [], $queryString);
152
    }
153
154
    /**
155
     * @param int $id
@@ 160-167 (lines=8) @@
157
     *                      'showListMemberships']
158
     * @return \SevenShores\Hubspot\Http\Response
159
     */
160
    function getById($id, $params = [])
161
    {
162
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/vid/{$id}/profile";
163
164
        $queryString = build_query_string($params);
165
166
        return $this->client->request('get', $endpoint, [], $queryString);
167
    }
168
169
    /**
170
     * For a given portal, return information about a group of contacts by their unique ID's. A contact's unique ID's
@@ 183-192 (lines=10) @@
180
     *                      'showListMemberships', 'includeDeletes']
181
     * @return \SevenShores\Hubspot\Http\Response
182
     */
183
    function getBatchByIds($vids, $params = [])
184
    {
185
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/vids/batch/";
186
187
        $params['vid'] = $vids;
188
189
        $queryString = build_query_string($params);
190
191
        return $this->client->request('get', $endpoint, [], $queryString);
192
    }
193
194
    /**
195
     * @param string $email
@@ 200-207 (lines=8) @@
197
     *                      'showListMemberships']
198
     * @return \SevenShores\Hubspot\Http\Response
199
     */
200
    function getByEmail($email, $params = [])
201
    {
202
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/email/{$email}/profile";
203
204
        $queryString = build_query_string($params);
205
206
        return $this->client->request('get', $endpoint, [], $queryString);
207
    }
208
209
    /**
210
     * For a given portal, return information about a group of contacts by their email addresses.
@@ 222-231 (lines=10) @@
219
     *                      'showListMemberships', 'includeDeletes']
220
     * @return \SevenShores\Hubspot\Http\Response
221
     */
222
    function getBatchByEmails($emails, $params = [])
223
    {
224
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/emails/batch/";
225
226
        $params['email'] = $emails;
227
228
        $queryString = build_query_string($params);
229
230
        return $this->client->request('get', $endpoint, [], $queryString);
231
    }
232
233
    /**
234
     * @param string $utk
@@ 239-246 (lines=8) @@
236
     *                      'showListMemberships']
237
     * @return \SevenShores\Hubspot\Http\Response
238
     */
239
    function getByToken($utk, $params = [])
240
    {
241
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/utk/{$utk}/profile";
242
243
        $queryString = build_query_string($params);
244
245
        return $this->client->request('get', $endpoint, [], $queryString);
246
    }
247
248
    /**
249
     * For a given portal, return information about a group of contacts by their user tokens (hubspotutk).
@@ 265-274 (lines=10) @@
262
     *                      'showListMemberships', 'includeDeletes']
263
     * @return \SevenShores\Hubspot\Http\Response
264
     */
265
    function getBatchByTokens($utks, $params = [])
266
    {
267
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/utks/batch/";
268
269
        $params['utk'] = $utks;
270
271
        $queryString = build_query_string($params);
272
273
        return $this->client->request('get', $endpoint, [], $queryString);
274
    }
275
276
    /**
277
     * For a given portal, return contacts and some data associated with
@@ 291-300 (lines=10) @@
288
     * @param array  $params Array of optional parameters ['count', 'offset']
289
     * @return \SevenShores\Hubspot\Http\Response
290
     */
291
    function search($query, $params = [])
292
    {
293
        $endpoint = "https://api.hubapi.com/contacts/v1/search/query";
294
295
        $params['q'] = $query;
296
297
        $queryString = build_query_string($params);
298
299
        return $this->client->request('get', $endpoint, [], $queryString);
300
    }
301
302
    /**
303
     * @return \SevenShores\Hubspot\Http\Response

src/Resources/Deals.php 5 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']
@@ 78-84 (lines=7) @@
75
     * @param array $params Optional parameters ['limit', 'offset']
76
     * @return mixed
77
     */
78
    function getRecentlyCreated(array $params = [])
79
    {
80
        $endpoint = "https://api.hubapi.com/deals/v1/deal/recent/created";
81
        $queryString = build_query_string($params);
82
83
        return $this->client->request('get', $endpoint, [], $queryString);
84
    }
85
86
    /**
87
     * @param int $id
@@ 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
@@ 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/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/Engagements.php 2 locations

@@ 37-44 (lines=8) @@
34
     *
35
     * @return \SevenShores\Hubspot\Http\Response
36
     */
37
    function recent($params = [])
38
    {
39
        $endpoint = 'https://api.hubapi.com/engagements/v1/engagements/recent/modified';
40
41
        $queryString = build_query_string($params);
42
43
        return $this->client->request('get', $endpoint, [], $queryString);
44
    }
45
46
    /**
47
     * @param int   $id         The engagement id.
@@ 95-102 (lines=8) @@
92
     *
93
     * @return \SevenShores\Hubspot\Http\Response
94
     */
95
    public function all($params = [])
96
    {
97
        $endpoint = 'https://api.hubapi.com/engagements/v1/engagements/paged';
98
99
        $queryString = build_query_string($params);
100
101
        return $this->client->request('get', $endpoint, [], $queryString);
102
    }
103
104
    /**
105
     * @param int $id

src/Resources/Files.php 2 locations

@@ 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
    /**
@@ 161-168 (lines=8) @@
158
     * @param array $params
159
     * @return \SevenShores\Hubspot\Http\Response
160
     */
161
    function folders($params = [])
162
    {
163
        $endpoint = "https://api.hubapi.com/filemanager/api/v2/folders";
164
165
        $queryString = build_query_string($params);
166
167
        return $this->client->request('get', $endpoint, [], $queryString);
168
    }
169
170
    /**
171
     * Update a folder.

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/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/SocialMedia.php 1 location

@@ 38-45 (lines=8) @@
35
     * @param array $params
36
     * @return \SevenShores\Hubspot\Http\Response
37
     */
38
    function broadcasts($params = [])
39
    {
40
        $endpoint = "https://api.hubapi.com/broadcast/v1/broadcasts";
41
42
        $queryString = build_query_string($params);
43
44
        return $this->client->request('get', $endpoint, [], $queryString);
45
    }
46
47
    /**
48
     * Get a broadcast.

src/Resources/Workflows.php 3 locations

@@ 81-88 (lines=8) @@
78
     * @param int $id
79
     * @return \SevenShores\Hubspot\Http\Response
80
     */
81
    function delete($id)
82
    {
83
        $endpoint = "https://api.hubapi.com/automation/v2/workflows/{$id}";
84
85
        $queryString = build_query_string(['updatedAt' => time()]);
86
87
        return $this->client->request('delete', $endpoint, [], $queryString);
88
    }
89
90
    /**
91
     * Get current enrollments for a contact.
@@ 111-118 (lines=8) @@
108
     * @param array $params Optional parameters.
109
     * @return \SevenShores\Hubspot\Http\Response
110
     */
111
    function pastEventsForContact($workflow_id, $contact_id, $params = [])
112
    {
113
        $endpoint = " /automation/v2/workflows/{$workflow_id}/logevents/contacts/{$contact_id}/past";
114
115
        $queryString = build_query_string($params);
116
117
        return $this->client->request('get', $endpoint, [], $queryString);
118
    }
119
120
    /**
121
     * Get upcoming (scheduled) events for a contact in a workflow.
@@ 128-135 (lines=8) @@
125
     * @param array $params
126
     * @return \SevenShores\Hubspot\Http\Response
127
     */
128
    function upcomingEventsForContact($workflow_id, $contact_id, $params = [])
129
    {
130
        $endpoint = "https://api.hubapi.com/automation/v2/workflows/{$workflow_id}/logevents/contacts/{$contact_id}/upcoming";
131
132
        $queryString = build_query_string($params);
133
134
        return $this->client->request('get', $endpoint, [], $queryString);
135
    }
136
137
}
138

src/Resources/Tickets.php 2 locations

@@ 45-51 (lines=7) @@
42
     *
43
     * @return \Psr\Http\Message\ResponseInterface|\SevenShores\Hubspot\Http\Response
44
     */
45
    public function getAll(array $params = [])
46
    {
47
        $endpoint = 'https://api.hubapi.com/crm-objects/v1/objects/tickets/paged';
48
49
        $queryString = build_query_string($params);
50
51
        return $this->client->request('get', $endpoint, [], $queryString);
52
    }
53
54
    /**
@@ 83-89 (lines=7) @@
80
     *
81
     * @return mixed
82
     */
83
    public function getChangelog(array $params = [])
84
    {
85
        $endpoint = 'https://api.hubapi.com/crm-objects/v1/change-log/tickets';
86
        $queryString = build_query_string($params);
87
88
        return $this->client->request('get', $endpoint, [], $queryString);
89
    }
90
}
91