Code Duplication    Length = 7-10 lines in 31 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/Workflows.php 1 location

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

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 3 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.

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 6 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
@@ 156-165 (lines=10) @@
153
     *                      'showListMemberships', 'includeDeletes']
154
     * @return \SevenShores\Hubspot\Http\Response
155
     */
156
    function getBatchByIds($vids, $params = [])
157
    {
158
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/vids/batch/";
159
160
        $params['vid'] = $vids;
161
162
        $queryString = build_query_string($params);
163
164
        return $this->client->request('get', $endpoint, [], $queryString);
165
    }
166
167
    /**
168
     * @param string $email
@@ 191-200 (lines=10) @@
188
     *                      'showListMemberships', 'includeDeletes']
189
     * @return \SevenShores\Hubspot\Http\Response
190
     */
191
    function getBatchByEmails($emails, $params = [])
192
    {
193
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/emails/batch/";
194
195
        $params['email'] = $emails;
196
197
        $queryString = build_query_string($params);
198
199
        return $this->client->request('get', $endpoint, [], $queryString);
200
    }
201
202
    /**
203
     * @param string $utk
@@ 230-239 (lines=10) @@
227
     *                      'showListMemberships', 'includeDeletes']
228
     * @return \SevenShores\Hubspot\Http\Response
229
     */
230
    function getBatchByTokens($utks, $params = [])
231
    {
232
        $endpoint = "https://api.hubapi.com/contacts/v1/contact/utks/batch/";
233
234
        $params['utk'] = $utks;
235
236
        $queryString = build_query_string($params);
237
238
        return $this->client->request('get', $endpoint, [], $queryString);
239
    }
240
241
    /**
242
     * For a given portal, return contacts and some data associated with
@@ 256-265 (lines=10) @@
253
     * @param array  $params Array of optional parameters ['count', 'offset']
254
     * @return \SevenShores\Hubspot\Http\Response
255
     */
256
    function search($query, $params = [])
257
    {
258
        $endpoint = "https://api.hubapi.com/contacts/v1/search/query";
259
260
        $params['q'] = $query;
261
262
        $queryString = build_query_string($params);
263
264
        return $this->client->request('get', $endpoint, [], $queryString);
265
    }
266
267
    /**
268
     * @return \SevenShores\Hubspot\Http\Response

src/Resources/Deals.php 6 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
@@ 155-162 (lines=8) @@
152
     * @param int|int[] $contactIds
153
     * @return mixed
154
     */
155
    function disassociateFromContact($dealId, $contactIds)
156
    {
157
        $endpoint = "https://api.hubapi.com/deals/v1/deal/{$dealId}/associations/CONTACT";
158
159
        $queryString = build_query_string(['id' => (array)$contactIds]);
160
161
        return $this->client->request('delete', $endpoint, [], $queryString);
162
    }
163
}
164