Skip to content

Commit 62e438d

Browse files
committed
feat(api): update via SDK Studio
1 parent 29c13ed commit 62e438d

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 108
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/intercom%2Fintercom-52f67643df9a7d7b1390beca7892a18bd840aaedd848c5f8ee79d9fd9a666c99.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/intercom%2Fintercom-74554ca4b1e947254782b93352448c7a35a528fc0f88e9686e91f77e682b1669.yml

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Types:
168168

169169
Methods:
170170

171-
- <code title="post /contacts/{id}/companies">client.contacts.companies.<a href="./src/resources/contacts/companies.ts">create</a>({ ...params }) -> Company</code>
171+
- <code title="post /contacts/{id}/companies">client.contacts.companies.<a href="./src/resources/contacts/companies.ts">create</a>(id, { ...params }) -> Company</code>
172172
- <code title="get /contacts/{id}/companies">client.contacts.companies.<a href="./src/resources/contacts/companies.ts">list</a>(id, { ...params }) -> ContactAttachedCompanies</code>
173173
- <code title="delete /contacts/{contact_id}/companies/{id}">client.contacts.companies.<a href="./src/resources/contacts/companies.ts">delete</a>(contactId, id, { ...params }) -> Company</code>
174174

src/resources/contacts/companies.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ export class Companies extends APIResource {
1010
/**
1111
* You can attach a company to a single contact.
1212
*/
13-
create(params: CompanyCreateParams, options?: Core.RequestOptions): Core.APIPromise<Shared.Company> {
14-
const { path_id, body_id, 'Intercom-Version': intercomVersion, ...body } = params;
15-
return this._client.post(`/contacts/${path_id}/companies`, {
16-
body: { id: body_id, ...body },
13+
create(
14+
id: string,
15+
params: CompanyCreateParams,
16+
options?: Core.RequestOptions,
17+
): Core.APIPromise<Shared.Company> {
18+
const { company_id, 'Intercom-Version': intercomVersion, ...body } = params;
19+
return this._client.post(`/contacts/${id}/companies`, {
20+
body: { id: company_id, ...body },
1721
...options,
1822
headers: {
1923
...(intercomVersion?.toString() != null ?
@@ -142,15 +146,10 @@ export namespace ContactAttachedCompanies {
142146
}
143147

144148
export interface CompanyCreateParams {
145-
/**
146-
* Path param: The unique identifier for the contact which is given by Intercom
147-
*/
148-
path_id: string;
149-
150149
/**
151150
* Body param: The unique identifier for the company which is given by Intercom
152151
*/
153-
body_id: string;
152+
company_id: string;
154153

155154
/**
156155
* Header param: Intercom API version.By default, it's equal to the version set in

tests/api-resources/contacts/companies.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ const intercom = new Intercom({
1010

1111
describe('resource companies', () => {
1212
test('create: only required params', async () => {
13-
const responsePromise = intercom.contacts.companies.create({
14-
path_id: 'string',
15-
body_id: '6657add46abd0167d9419cd2',
13+
const responsePromise = intercom.contacts.companies.create('string', {
14+
company_id: '6657add46abd0167d9419cd2',
1615
});
1716
const rawResponse = await responsePromise.asResponse();
1817
expect(rawResponse).toBeInstanceOf(Response);
@@ -24,9 +23,8 @@ describe('resource companies', () => {
2423
});
2524

2625
test('create: required and optional params', async () => {
27-
const response = await intercom.contacts.companies.create({
28-
path_id: 'string',
29-
body_id: '6657add46abd0167d9419cd2',
26+
const response = await intercom.contacts.companies.create('string', {
27+
company_id: '6657add46abd0167d9419cd2',
3028
'Intercom-Version': '2.11',
3129
});
3230
});

0 commit comments

Comments
 (0)