@aloma.io/integration-sdk 3.8.51 → 3.8.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MULTI_RESOURCE_GUIDE.md +217 -0
- package/README.md +55 -2
- package/build/cli.mjs +162 -11
- package/build/openapi-to-connector.d.mts +23 -0
- package/build/openapi-to-connector.mjs +294 -11
- package/examples/api-without-servers.json +32 -0
- package/examples/companies-resource-class.mts +310 -0
- package/examples/companies-resource.mts +310 -0
- package/examples/complete-example.sh +116 -0
- package/examples/create-hubspot-connector.sh +33 -0
- package/examples/hubspot-companies.json +1889 -0
- package/examples/hubspot-contacts.json +1919 -0
- package/examples/hubspot-controller-individual-params.mts +323 -0
- package/examples/hubspot-controller-with-implementation.mts +315 -0
- package/examples/hubspot-controller.mts +192 -0
- package/examples/hubspot-lists.json +5525 -0
- package/examples/main-controller-with-resources.mts +35 -0
- package/examples/stripe.json +182829 -0
- package/examples/utility-click.json +8992 -0
- package/package.json +1 -1
- package/src/cli.mts +195 -11
- package/src/openapi-to-connector.mts +330 -11
@@ -0,0 +1,323 @@
|
|
1
|
+
import {AbstractController} from '@aloma.io/integration-sdk';
|
2
|
+
|
3
|
+
export default class Controller extends AbstractController {
|
4
|
+
private api: any;
|
5
|
+
|
6
|
+
protected async start(): Promise<void> {
|
7
|
+
const config = this.config;
|
8
|
+
|
9
|
+
this.api = this.getClient({
|
10
|
+
baseUrl: "https://api.hubapi.com",
|
11
|
+
customize(request) {
|
12
|
+
request.headers ||= {};
|
13
|
+
|
14
|
+
request.headers["Authorization"] = `Bearer ${config.apiToken}`;
|
15
|
+
},
|
16
|
+
});
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Retrieve a batch of companies
|
20
|
+
*
|
21
|
+
* Retrieve a batch of companies by ID (`companyId`) or by a unique property (`idProperty`). You can specify what is returned using the `properties` query parameter.
|
22
|
+
*
|
23
|
+
* @param {boolean} archived (optional) - Whether to return only results that have been archived. [query]
|
24
|
+
*
|
25
|
+
* @param {Object} body (required) - Request body
|
26
|
+
*
|
27
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/batch/read response
|
28
|
+
*/
|
29
|
+
async read(archived?: any, body?: any) {
|
30
|
+
const url = '/crm/v3/objects/companies/batch/read';
|
31
|
+
const options: any = {
|
32
|
+
method: 'POST',
|
33
|
+
params: {},
|
34
|
+
body,
|
35
|
+
};
|
36
|
+
|
37
|
+
// Add query parameters
|
38
|
+
if (archived !== undefined) {
|
39
|
+
options.params.archived = archived;
|
40
|
+
}
|
41
|
+
|
42
|
+
return this.api.fetch(url, options);
|
43
|
+
}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Retrieve companies
|
47
|
+
*
|
48
|
+
* Retrieve all companies, using query parameters to control the information that gets returned.
|
49
|
+
*
|
50
|
+
* @param {integer} limit (optional) - The maximum number of results to display per page. [query]
|
51
|
+
* @param {string} after (optional) - The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. [query]
|
52
|
+
* @param {array} properties (optional) - A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. [query]
|
53
|
+
* @param {array} propertiesWithHistory (optional) - A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of companies that can be read by a single request. [query]
|
54
|
+
* @param {array} associations (optional) - A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. [query]
|
55
|
+
* @param {boolean} archived (optional) - Whether to return only results that have been archived. [query]
|
56
|
+
*
|
57
|
+
* @returns {Promise<Object>} GET /crm/v3/objects/companies response
|
58
|
+
*/
|
59
|
+
async getPage(limit?: any, after?: any, properties?: any, propertiesWithHistory?: any, associations?: any, archived?: any) {
|
60
|
+
const url = '/crm/v3/objects/companies';
|
61
|
+
const options: any = {
|
62
|
+
method: 'GET',
|
63
|
+
params: {},
|
64
|
+
};
|
65
|
+
|
66
|
+
// Add query parameters
|
67
|
+
if (limit !== undefined) {
|
68
|
+
options.params.limit = limit;
|
69
|
+
}
|
70
|
+
if (after !== undefined) {
|
71
|
+
options.params.after = after;
|
72
|
+
}
|
73
|
+
if (properties !== undefined) {
|
74
|
+
options.params.properties = properties;
|
75
|
+
}
|
76
|
+
if (propertiesWithHistory !== undefined) {
|
77
|
+
options.params.propertiesWithHistory = propertiesWithHistory;
|
78
|
+
}
|
79
|
+
if (associations !== undefined) {
|
80
|
+
options.params.associations = associations;
|
81
|
+
}
|
82
|
+
if (archived !== undefined) {
|
83
|
+
options.params.archived = archived;
|
84
|
+
}
|
85
|
+
|
86
|
+
return this.api.fetch(url, options);
|
87
|
+
}
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Create a company
|
91
|
+
*
|
92
|
+
* Create a single company. Include a `properties` object to define [property values](https://developers.hubspot.com/docs/guides/api/crm/properties) for the company, along with an `associations` array to define [associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4) with other CRM records.
|
93
|
+
*
|
94
|
+
* @param {Object} body (required) - Request body
|
95
|
+
*
|
96
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies response
|
97
|
+
*/
|
98
|
+
async create(body?: any) {
|
99
|
+
const url = '/crm/v3/objects/companies';
|
100
|
+
const options: any = {
|
101
|
+
method: 'POST',
|
102
|
+
body,
|
103
|
+
};
|
104
|
+
|
105
|
+
return this.api.fetch(url, options);
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Search for companies
|
110
|
+
*
|
111
|
+
* Search for companies by filtering on properties, searching through associations, and sorting results. Learn more about [CRM search](https://developers.hubspot.com/docs/guides/api/crm/search#make-a-search-request).
|
112
|
+
*
|
113
|
+
* @param {Object} body (required) - Request body
|
114
|
+
*
|
115
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/search response
|
116
|
+
*/
|
117
|
+
async doSearch(body?: any) {
|
118
|
+
const url = '/crm/v3/objects/companies/search';
|
119
|
+
const options: any = {
|
120
|
+
method: 'POST',
|
121
|
+
body,
|
122
|
+
};
|
123
|
+
|
124
|
+
return this.api.fetch(url, options);
|
125
|
+
}
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Retrieve a company
|
129
|
+
*
|
130
|
+
* Retrieve a company by its ID (`companyId`) or by a unique property (`idProperty`). You can specify what is returned using the `properties` query parameter.
|
131
|
+
*
|
132
|
+
* @param {string} companyId (required) - The ID of the company [path]
|
133
|
+
* @param {array} properties (optional) - A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. [query]
|
134
|
+
* @param {array} propertiesWithHistory (optional) - A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. [query]
|
135
|
+
* @param {array} associations (optional) - A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. [query]
|
136
|
+
* @param {boolean} archived (optional) - Whether to return only results that have been archived. [query]
|
137
|
+
* @param {string} idProperty (optional) - The name of a property whose values are unique for this object [query]
|
138
|
+
*
|
139
|
+
* @returns {Promise<Object>} GET /crm/v3/objects/companies/{companyId} response
|
140
|
+
*/
|
141
|
+
async getById(companyId: string, properties?: any, propertiesWithHistory?: any, associations?: any, archived?: any, idProperty?: any) {
|
142
|
+
// Build URL with path parameters
|
143
|
+
let url = '/crm/v3/objects/companies/{companyId}';
|
144
|
+
if (companyId) {
|
145
|
+
url = url.replace('{companyId}', companyId);
|
146
|
+
}
|
147
|
+
|
148
|
+
const options: any = {
|
149
|
+
method: 'GET',
|
150
|
+
params: {},
|
151
|
+
};
|
152
|
+
|
153
|
+
// Add query parameters
|
154
|
+
if (properties !== undefined) {
|
155
|
+
options.params.properties = properties;
|
156
|
+
}
|
157
|
+
if (propertiesWithHistory !== undefined) {
|
158
|
+
options.params.propertiesWithHistory = propertiesWithHistory;
|
159
|
+
}
|
160
|
+
if (associations !== undefined) {
|
161
|
+
options.params.associations = associations;
|
162
|
+
}
|
163
|
+
if (archived !== undefined) {
|
164
|
+
options.params.archived = archived;
|
165
|
+
}
|
166
|
+
if (idProperty !== undefined) {
|
167
|
+
options.params.idProperty = idProperty;
|
168
|
+
}
|
169
|
+
|
170
|
+
return this.api.fetch(url, options);
|
171
|
+
}
|
172
|
+
|
173
|
+
/**
|
174
|
+
* Update a company
|
175
|
+
*
|
176
|
+
* Update a company by ID (`companyId`) or unique property value (`idProperty`). Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.
|
177
|
+
*
|
178
|
+
* @param {string} companyId (required) [path]
|
179
|
+
* @param {string} idProperty (optional) - The name of a property whose values are unique for this object [query]
|
180
|
+
*
|
181
|
+
* @param {Object} body (required) - Request body
|
182
|
+
*
|
183
|
+
* @returns {Promise<Object>} PATCH /crm/v3/objects/companies/{companyId} response
|
184
|
+
*/
|
185
|
+
async update(companyId: string, idProperty?: any, body?: any) {
|
186
|
+
// Build URL with path parameters
|
187
|
+
let url = '/crm/v3/objects/companies/{companyId}';
|
188
|
+
if (companyId) {
|
189
|
+
url = url.replace('{companyId}', companyId);
|
190
|
+
}
|
191
|
+
|
192
|
+
const options: any = {
|
193
|
+
method: 'PATCH',
|
194
|
+
params: {},
|
195
|
+
body,
|
196
|
+
};
|
197
|
+
|
198
|
+
// Add query parameters
|
199
|
+
if (idProperty !== undefined) {
|
200
|
+
options.params.idProperty = idProperty;
|
201
|
+
}
|
202
|
+
|
203
|
+
return this.api.fetch(url, options);
|
204
|
+
}
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Archive a company
|
208
|
+
*
|
209
|
+
* Delete a company by ID. Deleted companies can be restored within 90 days of deletion. Learn more about [restoring records](https://knowledge.hubspot.com/records/restore-deleted-records).
|
210
|
+
*
|
211
|
+
* @param {string} companyId (required) [path]
|
212
|
+
*
|
213
|
+
* @returns {Promise<Object>} DELETE /crm/v3/objects/companies/{companyId} response
|
214
|
+
*/
|
215
|
+
async archive(companyId: string) {
|
216
|
+
// Build URL with path parameters
|
217
|
+
let url = '/crm/v3/objects/companies/{companyId}';
|
218
|
+
if (companyId) {
|
219
|
+
url = url.replace('{companyId}', companyId);
|
220
|
+
}
|
221
|
+
|
222
|
+
const options: any = {
|
223
|
+
method: 'DELETE',
|
224
|
+
};
|
225
|
+
|
226
|
+
return this.api.fetch(url, options);
|
227
|
+
}
|
228
|
+
|
229
|
+
/**
|
230
|
+
* Create or update a batch of companies by unique property values
|
231
|
+
*
|
232
|
+
* Create or update companies identified by a unique property value as specified by the `idProperty` query parameter. `idProperty` query param refers to a property whose values are unique for the object.
|
233
|
+
*
|
234
|
+
* @param {Object} body (required) - Request body
|
235
|
+
*
|
236
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/batch/upsert response
|
237
|
+
*/
|
238
|
+
async upsert(body?: any) {
|
239
|
+
const url = '/crm/v3/objects/companies/batch/upsert';
|
240
|
+
const options: any = {
|
241
|
+
method: 'POST',
|
242
|
+
body,
|
243
|
+
};
|
244
|
+
|
245
|
+
return this.api.fetch(url, options);
|
246
|
+
}
|
247
|
+
|
248
|
+
/**
|
249
|
+
* Create a batch of companies
|
250
|
+
*
|
251
|
+
* Create a batch of companies. The `inputs` array can contain a `properties` object to define property values for each company, along with an `associations` array to define [associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4) with other CRM records.
|
252
|
+
*
|
253
|
+
* @param {Object} body (required) - Request body
|
254
|
+
*
|
255
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/batch/create response
|
256
|
+
*/
|
257
|
+
async create(body?: any) {
|
258
|
+
const url = '/crm/v3/objects/companies/batch/create';
|
259
|
+
const options: any = {
|
260
|
+
method: 'POST',
|
261
|
+
body,
|
262
|
+
};
|
263
|
+
|
264
|
+
return this.api.fetch(url, options);
|
265
|
+
}
|
266
|
+
|
267
|
+
/**
|
268
|
+
* Update a batch of companies
|
269
|
+
*
|
270
|
+
* Update a batch of companies by ID.
|
271
|
+
*
|
272
|
+
* @param {Object} body (required) - Request body
|
273
|
+
*
|
274
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/batch/update response
|
275
|
+
*/
|
276
|
+
async update(body?: any) {
|
277
|
+
const url = '/crm/v3/objects/companies/batch/update';
|
278
|
+
const options: any = {
|
279
|
+
method: 'POST',
|
280
|
+
body,
|
281
|
+
};
|
282
|
+
|
283
|
+
return this.api.fetch(url, options);
|
284
|
+
}
|
285
|
+
|
286
|
+
/**
|
287
|
+
* Archive a batch of companies
|
288
|
+
*
|
289
|
+
* Delete a batch of companies by ID. Deleted companies can be restored within 90 days of deletion. Learn more about [restoring records](https://knowledge.hubspot.com/records/restore-deleted-records).
|
290
|
+
*
|
291
|
+
* @param {Object} body (required) - Request body
|
292
|
+
*
|
293
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/batch/archive response
|
294
|
+
*/
|
295
|
+
async archive(body?: any) {
|
296
|
+
const url = '/crm/v3/objects/companies/batch/archive';
|
297
|
+
const options: any = {
|
298
|
+
method: 'POST',
|
299
|
+
body,
|
300
|
+
};
|
301
|
+
|
302
|
+
return this.api.fetch(url, options);
|
303
|
+
}
|
304
|
+
|
305
|
+
/**
|
306
|
+
* Merge two companies
|
307
|
+
*
|
308
|
+
* Merge two company records. Learn more about [merging records](https://knowledge.hubspot.com/records/merge-records).
|
309
|
+
*
|
310
|
+
* @param {Object} body (required) - Request body
|
311
|
+
*
|
312
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/merge response
|
313
|
+
*/
|
314
|
+
async merge(body?: any) {
|
315
|
+
const url = '/crm/v3/objects/companies/merge';
|
316
|
+
const options: any = {
|
317
|
+
method: 'POST',
|
318
|
+
body,
|
319
|
+
};
|
320
|
+
|
321
|
+
return this.api.fetch(url, options);
|
322
|
+
}
|
323
|
+
}
|
@@ -0,0 +1,315 @@
|
|
1
|
+
import {AbstractController} from '@aloma.io/integration-sdk';
|
2
|
+
|
3
|
+
export default class Controller extends AbstractController {
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Retrieve a batch of companies
|
7
|
+
*
|
8
|
+
* Retrieve a batch of companies by ID (`companyId`) or by a unique property (`idProperty`). You can specify what is returned using the `properties` query parameter.
|
9
|
+
*
|
10
|
+
* @param {Object} args - Request arguments
|
11
|
+
* @param {boolean} args.archived (optional) - Whether to return only results that have been archived. [query]
|
12
|
+
*
|
13
|
+
* @param {Object} args.body (required) - Request body
|
14
|
+
*
|
15
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/batch/read response
|
16
|
+
*/
|
17
|
+
async read(args: any = {}) {
|
18
|
+
const url = '/crm/v3/objects/companies/batch/read';
|
19
|
+
const options: any = {
|
20
|
+
method: 'POST',
|
21
|
+
params: {},
|
22
|
+
body: args.body,
|
23
|
+
};
|
24
|
+
|
25
|
+
// Add query parameters
|
26
|
+
if (args.archived !== undefined) {
|
27
|
+
options.params.archived = args.archived;
|
28
|
+
}
|
29
|
+
|
30
|
+
return this.fetcher.fetch(url, options);
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Retrieve companies
|
35
|
+
*
|
36
|
+
* Retrieve all companies, using query parameters to control the information that gets returned.
|
37
|
+
*
|
38
|
+
* @param {Object} args - Request arguments
|
39
|
+
* @param {integer} args.limit (optional) - The maximum number of results to display per page. [query]
|
40
|
+
* @param {string} args.after (optional) - The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. [query]
|
41
|
+
* @param {array} args.properties (optional) - A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. [query]
|
42
|
+
* @param {array} args.propertiesWithHistory (optional) - A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of companies that can be read by a single request. [query]
|
43
|
+
* @param {array} args.associations (optional) - A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. [query]
|
44
|
+
* @param {boolean} args.archived (optional) - Whether to return only results that have been archived. [query]
|
45
|
+
*
|
46
|
+
* @returns {Promise<Object>} GET /crm/v3/objects/companies response
|
47
|
+
*/
|
48
|
+
async getPage(args: any = {}) {
|
49
|
+
const url = '/crm/v3/objects/companies';
|
50
|
+
const options: any = {
|
51
|
+
method: 'GET',
|
52
|
+
params: {},
|
53
|
+
};
|
54
|
+
|
55
|
+
// Add query parameters
|
56
|
+
if (args.limit !== undefined) {
|
57
|
+
options.params.limit = args.limit;
|
58
|
+
}
|
59
|
+
if (args.after !== undefined) {
|
60
|
+
options.params.after = args.after;
|
61
|
+
}
|
62
|
+
if (args.properties !== undefined) {
|
63
|
+
options.params.properties = args.properties;
|
64
|
+
}
|
65
|
+
if (args.propertiesWithHistory !== undefined) {
|
66
|
+
options.params.propertiesWithHistory = args.propertiesWithHistory;
|
67
|
+
}
|
68
|
+
if (args.associations !== undefined) {
|
69
|
+
options.params.associations = args.associations;
|
70
|
+
}
|
71
|
+
if (args.archived !== undefined) {
|
72
|
+
options.params.archived = args.archived;
|
73
|
+
}
|
74
|
+
|
75
|
+
return this.fetcher.fetch(url, options);
|
76
|
+
}
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Create a company
|
80
|
+
*
|
81
|
+
* Create a single company. Include a `properties` object to define [property values](https://developers.hubspot.com/docs/guides/api/crm/properties) for the company, along with an `associations` array to define [associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4) with other CRM records.
|
82
|
+
*
|
83
|
+
* @param {Object} args.body (required) - Request body
|
84
|
+
*
|
85
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies response
|
86
|
+
*/
|
87
|
+
async create(args: any = {}) {
|
88
|
+
const url = '/crm/v3/objects/companies';
|
89
|
+
const options: any = {
|
90
|
+
method: 'POST',
|
91
|
+
body: args.body,
|
92
|
+
};
|
93
|
+
|
94
|
+
return this.fetcher.fetch(url, options);
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Search for companies
|
99
|
+
*
|
100
|
+
* Search for companies by filtering on properties, searching through associations, and sorting results. Learn more about [CRM search](https://developers.hubspot.com/docs/guides/api/crm/search#make-a-search-request).
|
101
|
+
*
|
102
|
+
* @param {Object} args.body (required) - Request body
|
103
|
+
*
|
104
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/search response
|
105
|
+
*/
|
106
|
+
async doSearch(args: any = {}) {
|
107
|
+
const url = '/crm/v3/objects/companies/search';
|
108
|
+
const options: any = {
|
109
|
+
method: 'POST',
|
110
|
+
body: args.body,
|
111
|
+
};
|
112
|
+
|
113
|
+
return this.fetcher.fetch(url, options);
|
114
|
+
}
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Retrieve a company
|
118
|
+
*
|
119
|
+
* Retrieve a company by its ID (`companyId`) or by a unique property (`idProperty`). You can specify what is returned using the `properties` query parameter.
|
120
|
+
*
|
121
|
+
* @param {Object} args - Request arguments
|
122
|
+
* @param {string} args.companyId (required) - The ID of the company [path]
|
123
|
+
* @param {array} args.properties (optional) - A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. [query]
|
124
|
+
* @param {array} args.propertiesWithHistory (optional) - A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. [query]
|
125
|
+
* @param {array} args.associations (optional) - A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. [query]
|
126
|
+
* @param {boolean} args.archived (optional) - Whether to return only results that have been archived. [query]
|
127
|
+
* @param {string} args.idProperty (optional) - The name of a property whose values are unique for this object [query]
|
128
|
+
*
|
129
|
+
* @returns {Promise<Object>} GET /crm/v3/objects/companies/{companyId} response
|
130
|
+
*/
|
131
|
+
async getById(args: any = {}) {
|
132
|
+
// Build URL with path parameters
|
133
|
+
let url = '/crm/v3/objects/companies/{companyId}';
|
134
|
+
if (args.companyId) {
|
135
|
+
url = url.replace('{companyId}', args.companyId);
|
136
|
+
}
|
137
|
+
|
138
|
+
const options: any = {
|
139
|
+
method: 'GET',
|
140
|
+
params: {},
|
141
|
+
};
|
142
|
+
|
143
|
+
// Add query parameters
|
144
|
+
if (args.properties !== undefined) {
|
145
|
+
options.params.properties = args.properties;
|
146
|
+
}
|
147
|
+
if (args.propertiesWithHistory !== undefined) {
|
148
|
+
options.params.propertiesWithHistory = args.propertiesWithHistory;
|
149
|
+
}
|
150
|
+
if (args.associations !== undefined) {
|
151
|
+
options.params.associations = args.associations;
|
152
|
+
}
|
153
|
+
if (args.archived !== undefined) {
|
154
|
+
options.params.archived = args.archived;
|
155
|
+
}
|
156
|
+
if (args.idProperty !== undefined) {
|
157
|
+
options.params.idProperty = args.idProperty;
|
158
|
+
}
|
159
|
+
|
160
|
+
return this.fetcher.fetch(url, options);
|
161
|
+
}
|
162
|
+
|
163
|
+
/**
|
164
|
+
* Update a company
|
165
|
+
*
|
166
|
+
* Update a company by ID (`companyId`) or unique property value (`idProperty`). Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.
|
167
|
+
*
|
168
|
+
* @param {Object} args - Request arguments
|
169
|
+
* @param {string} args.companyId (required) [path]
|
170
|
+
* @param {string} args.idProperty (optional) - The name of a property whose values are unique for this object [query]
|
171
|
+
*
|
172
|
+
* @param {Object} args.body (required) - Request body
|
173
|
+
*
|
174
|
+
* @returns {Promise<Object>} PATCH /crm/v3/objects/companies/{companyId} response
|
175
|
+
*/
|
176
|
+
async update(args: any = {}) {
|
177
|
+
// Build URL with path parameters
|
178
|
+
let url = '/crm/v3/objects/companies/{companyId}';
|
179
|
+
if (args.companyId) {
|
180
|
+
url = url.replace('{companyId}', args.companyId);
|
181
|
+
}
|
182
|
+
|
183
|
+
const options: any = {
|
184
|
+
method: 'PATCH',
|
185
|
+
params: {},
|
186
|
+
body: args.body,
|
187
|
+
};
|
188
|
+
|
189
|
+
// Add query parameters
|
190
|
+
if (args.idProperty !== undefined) {
|
191
|
+
options.params.idProperty = args.idProperty;
|
192
|
+
}
|
193
|
+
|
194
|
+
return this.fetcher.fetch(url, options);
|
195
|
+
}
|
196
|
+
|
197
|
+
/**
|
198
|
+
* Archive a company
|
199
|
+
*
|
200
|
+
* Delete a company by ID. Deleted companies can be restored within 90 days of deletion. Learn more about [restoring records](https://knowledge.hubspot.com/records/restore-deleted-records).
|
201
|
+
*
|
202
|
+
* @param {Object} args - Request arguments
|
203
|
+
* @param {string} args.companyId (required) [path]
|
204
|
+
*
|
205
|
+
* @returns {Promise<Object>} DELETE /crm/v3/objects/companies/{companyId} response
|
206
|
+
*/
|
207
|
+
async archive(args: any = {}) {
|
208
|
+
// Build URL with path parameters
|
209
|
+
let url = '/crm/v3/objects/companies/{companyId}';
|
210
|
+
if (args.companyId) {
|
211
|
+
url = url.replace('{companyId}', args.companyId);
|
212
|
+
}
|
213
|
+
|
214
|
+
const options: any = {
|
215
|
+
method: 'DELETE',
|
216
|
+
};
|
217
|
+
|
218
|
+
return this.fetcher.fetch(url, options);
|
219
|
+
}
|
220
|
+
|
221
|
+
/**
|
222
|
+
* Create or update a batch of companies by unique property values
|
223
|
+
*
|
224
|
+
* Create or update companies identified by a unique property value as specified by the `idProperty` query parameter. `idProperty` query param refers to a property whose values are unique for the object.
|
225
|
+
*
|
226
|
+
* @param {Object} args.body (required) - Request body
|
227
|
+
*
|
228
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/batch/upsert response
|
229
|
+
*/
|
230
|
+
async upsert(args: any = {}) {
|
231
|
+
const url = '/crm/v3/objects/companies/batch/upsert';
|
232
|
+
const options: any = {
|
233
|
+
method: 'POST',
|
234
|
+
body: args.body,
|
235
|
+
};
|
236
|
+
|
237
|
+
return this.fetcher.fetch(url, options);
|
238
|
+
}
|
239
|
+
|
240
|
+
/**
|
241
|
+
* Create a batch of companies
|
242
|
+
*
|
243
|
+
* Create a batch of companies. The `inputs` array can contain a `properties` object to define property values for each company, along with an `associations` array to define [associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4) with other CRM records.
|
244
|
+
*
|
245
|
+
* @param {Object} args.body (required) - Request body
|
246
|
+
*
|
247
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/batch/create response
|
248
|
+
*/
|
249
|
+
async create(args: any = {}) {
|
250
|
+
const url = '/crm/v3/objects/companies/batch/create';
|
251
|
+
const options: any = {
|
252
|
+
method: 'POST',
|
253
|
+
body: args.body,
|
254
|
+
};
|
255
|
+
|
256
|
+
return this.fetcher.fetch(url, options);
|
257
|
+
}
|
258
|
+
|
259
|
+
/**
|
260
|
+
* Update a batch of companies
|
261
|
+
*
|
262
|
+
* Update a batch of companies by ID.
|
263
|
+
*
|
264
|
+
* @param {Object} args.body (required) - Request body
|
265
|
+
*
|
266
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/batch/update response
|
267
|
+
*/
|
268
|
+
async update(args: any = {}) {
|
269
|
+
const url = '/crm/v3/objects/companies/batch/update';
|
270
|
+
const options: any = {
|
271
|
+
method: 'POST',
|
272
|
+
body: args.body,
|
273
|
+
};
|
274
|
+
|
275
|
+
return this.fetcher.fetch(url, options);
|
276
|
+
}
|
277
|
+
|
278
|
+
/**
|
279
|
+
* Archive a batch of companies
|
280
|
+
*
|
281
|
+
* Delete a batch of companies by ID. Deleted companies can be restored within 90 days of deletion. Learn more about [restoring records](https://knowledge.hubspot.com/records/restore-deleted-records).
|
282
|
+
*
|
283
|
+
* @param {Object} args.body (required) - Request body
|
284
|
+
*
|
285
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/batch/archive response
|
286
|
+
*/
|
287
|
+
async archive(args: any = {}) {
|
288
|
+
const url = '/crm/v3/objects/companies/batch/archive';
|
289
|
+
const options: any = {
|
290
|
+
method: 'POST',
|
291
|
+
body: args.body,
|
292
|
+
};
|
293
|
+
|
294
|
+
return this.fetcher.fetch(url, options);
|
295
|
+
}
|
296
|
+
|
297
|
+
/**
|
298
|
+
* Merge two companies
|
299
|
+
*
|
300
|
+
* Merge two company records. Learn more about [merging records](https://knowledge.hubspot.com/records/merge-records).
|
301
|
+
*
|
302
|
+
* @param {Object} args.body (required) - Request body
|
303
|
+
*
|
304
|
+
* @returns {Promise<Object>} POST /crm/v3/objects/companies/merge response
|
305
|
+
*/
|
306
|
+
async merge(args: any = {}) {
|
307
|
+
const url = '/crm/v3/objects/companies/merge';
|
308
|
+
const options: any = {
|
309
|
+
method: 'POST',
|
310
|
+
body: args.body,
|
311
|
+
};
|
312
|
+
|
313
|
+
return this.fetcher.fetch(url, options);
|
314
|
+
}
|
315
|
+
}
|