Skip to content

Commit

Permalink
release: 6.0.0-beta.2 (#427)
Browse files Browse the repository at this point in the history
* feat(api): update via SDK Studio (#426)

* chore(tests): update prism version (#428)

* feat(api): update via SDK Studio (#429)

* chore(tests): update prism version (#430)

* fix(compat): remove ReadableStream polyfill redundant since node v16 (#431)

Note that this breaks streaming in Node v14, which has been unsupported since v4.0.0 of this library.

* chore(internal): codegen related update (#432)

* chore(docs): fix incorrect client var names (#433)

* chore(internal): add constant for default timeout (#434)

* feat(api): update via SDK Studio (#435)

* release: 6.0.0-beta.2

---------

Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
  • Loading branch information
stainless-app[bot] authored Jul 30, 2024
1 parent f0bba56 commit 8f7c33e
Show file tree
Hide file tree
Showing 63 changed files with 522 additions and 446 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "6.0.0-beta.1"
".": "6.0.0-beta.2"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 108
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/intercom%2Fintercom-61fd2f21fb0fb6a94c5e87ea423d828bf37d1dd90ca1511eda9b91d58ccb5d39.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/intercom%2Fintercom-a52cc0e4313a38d4329e6c2f40afa341d800389762fc643b9bf5b13248f8c5da.yml
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## 6.0.0-beta.2 (2024-07-30)

Full Changelog: [v6.0.0-beta.1...v6.0.0-beta.2](https://github.com/intercom/intercom-node/compare/v6.0.0-beta.1...v6.0.0-beta.2)

### Features

* **api:** update via SDK Studio ([#426](https://github.com/intercom/intercom-node/issues/426)) ([ef7e2da](https://github.com/intercom/intercom-node/commit/ef7e2da5db3c43bc5c418d2d225152824f1fee98))
* **api:** update via SDK Studio ([#429](https://github.com/intercom/intercom-node/issues/429)) ([87e2fc5](https://github.com/intercom/intercom-node/commit/87e2fc5a69de4ff9cbcd965dee87c116ffa0351c))
* **api:** update via SDK Studio ([#435](https://github.com/intercom/intercom-node/issues/435)) ([00dfaa7](https://github.com/intercom/intercom-node/commit/00dfaa769e2e82e30824b7530fb10dca0074a29e))


### Bug Fixes

* **compat:** remove ReadableStream polyfill redundant since node v16 ([#431](https://github.com/intercom/intercom-node/issues/431)) ([063c487](https://github.com/intercom/intercom-node/commit/063c487e24daafd0c062ebf76802c4a63e0e81b8))


### Chores

* **docs:** fix incorrect client var names ([#433](https://github.com/intercom/intercom-node/issues/433)) ([4a0ad83](https://github.com/intercom/intercom-node/commit/4a0ad830f2f68faa88aaa614e625776a19310092))
* **internal:** add constant for default timeout ([#434](https://github.com/intercom/intercom-node/issues/434)) ([0a41a59](https://github.com/intercom/intercom-node/commit/0a41a59c08f3c3225113464ee1fa336179e740c9))
* **internal:** codegen related update ([#432](https://github.com/intercom/intercom-node/issues/432)) ([c76e487](https://github.com/intercom/intercom-node/commit/c76e48745a679b3155c22736e14b61af6df8aaf4))
* **tests:** update prism version ([#428](https://github.com/intercom/intercom-node/issues/428)) ([425939f](https://github.com/intercom/intercom-node/commit/425939f4145d533621e53c36b786caebb8a1932f))
* **tests:** update prism version ([#430](https://github.com/intercom/intercom-node/issues/430)) ([d123ec9](https://github.com/intercom/intercom-node/commit/d123ec9ea199e56b76f8ae9cc9f4cc31318659f8))

## 6.0.0-beta.1 (2024-07-19)

Full Changelog: [v6.0.0-beta.0...v6.0.0-beta.1](https://github.com/intercom/intercom-node/compare/v6.0.0-beta.0...v6.0.0-beta.1)
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const client = new Intercom({
});

async function main() {
const adminWithApp = await intercom.me.retrieve();
const adminWithApp = await client.me.retrieve();

console.log(adminWithApp.id);
}
Expand All @@ -50,7 +50,7 @@ const client = new Intercom({
});

async function main() {
const adminWithApp: Intercom.AdminWithApp | null = await intercom.me.retrieve();
const adminWithApp: Intercom.AdminWithApp | null = await client.me.retrieve();
}

main();
Expand All @@ -67,7 +67,7 @@ a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```ts
async function main() {
const adminWithApp = await intercom.me.retrieve().catch(async (err) => {
const adminWithApp = await client.me.retrieve().catch(async (err) => {
if (err instanceof Intercom.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
Expand Down Expand Up @@ -110,7 +110,7 @@ const client = new Intercom({
});

// Or, configure per-request:
await intercom.me.retrieve({
await client.me.retrieve({
maxRetries: 5,
});
```
Expand All @@ -127,7 +127,7 @@ const client = new Intercom({
});

// Override per-request:
await intercom.me.retrieve({
await client.me.retrieve({
timeout: 5 * 1000,
});
```
Expand All @@ -148,11 +148,11 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
```ts
const client = new Intercom();

const response = await intercom.me.retrieve().asResponse();
const response = await client.me.retrieve().asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: adminWithApp, response: raw } = await intercom.me.retrieve().withResponse();
const { data: adminWithApp, response: raw } = await client.me.retrieve().withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(adminWithApp.id);
```
Expand Down Expand Up @@ -258,7 +258,7 @@ const client = new Intercom({
});

// Override per-request:
await intercom.me.retrieve({
await client.me.retrieve({
httpAgent: new http.Agent({ keepAlive: false }),
});
```
Expand Down
17 changes: 11 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Types:
- <code><a href="./src/resources/shared.ts">Message</a></code>
- <code><a href="./src/resources/shared.ts">MultipleFilterSearchRequest</a></code>
- <code><a href="./src/resources/shared.ts">Note</a></code>
- <code><a href="./src/resources/shared.ts">PaginatedResponse</a></code>
- <code><a href="./src/resources/shared.ts">PartAttachment</a></code>
- <code><a href="./src/resources/shared.ts">Reference</a></code>
- <code><a href="./src/resources/shared.ts">SearchRequest</a></code>
Expand Down Expand Up @@ -223,8 +222,8 @@ Methods:

Types:

- <code><a href="./src/resources/conversations/conversations.ts">ConversationList</a></code>
- <code><a href="./src/resources/conversations/conversations.ts">ConversationListResponse</a></code>
- <code><a href="./src/resources/conversations/conversations.ts">ConversationSearchResponse</a></code>

Methods:

Expand All @@ -234,7 +233,7 @@ Methods:
- <code title="get /conversations">client.conversations.<a href="./src/resources/conversations/conversations.ts">list</a>({ ...params }) -> ConversationListResponsesCursorPagination</code>
- <code title="post /conversations/{id}/convert">client.conversations.<a href="./src/resources/conversations/conversations.ts">convert</a>(id, { ...params }) -> Ticket | null</code>
- <code title="post /conversations/redact">client.conversations.<a href="./src/resources/conversations/conversations.ts">redact</a>({ ...params }) -> Conversation</code>
- <code title="post /conversations/search">client.conversations.<a href="./src/resources/conversations/conversations.ts">search</a>({ ...params }) -> ConversationList</code>
- <code title="post /conversations/search">client.conversations.<a href="./src/resources/conversations/conversations.ts">search</a>({ ...params }) -> ConversationSearchResponse</code>

## Tags

Expand Down Expand Up @@ -340,32 +339,38 @@ Methods:
Types:

- <code><a href="./src/resources/news/news-items.ts">NewsItem</a></code>
- <code><a href="./src/resources/news/news-items.ts">NewsItemListResponse</a></code>
- <code><a href="./src/resources/news/news-items.ts">NewsItemDeleteResponse</a></code>

Methods:

- <code title="post /news/news_items">client.news.newsItems.<a href="./src/resources/news/news-items.ts">create</a>({ ...params }) -> NewsItem</code>
- <code title="get /news/news_items/{id}">client.news.newsItems.<a href="./src/resources/news/news-items.ts">retrieve</a>(id, { ...params }) -> NewsItem</code>
- <code title="put /news/news_items/{id}">client.news.newsItems.<a href="./src/resources/news/news-items.ts">update</a>(id, { ...params }) -> NewsItem</code>
- <code title="get /news/news_items">client.news.newsItems.<a href="./src/resources/news/news-items.ts">list</a>({ ...params }) -> PaginatedResponse</code>
- <code title="get /news/news_items">client.news.newsItems.<a href="./src/resources/news/news-items.ts">list</a>({ ...params }) -> NewsItemListResponse</code>
- <code title="delete /news/news_items/{id}">client.news.newsItems.<a href="./src/resources/news/news-items.ts">delete</a>(id, { ...params }) -> NewsItemDeleteResponse</code>

## Newsfeeds

Types:

- <code><a href="./src/resources/news/newsfeeds/newsfeeds.ts">Newsfeed</a></code>
- <code><a href="./src/resources/news/newsfeeds/newsfeeds.ts">NewsfeedListResponse</a></code>

Methods:

- <code title="get /news/newsfeeds/{id}">client.news.newsfeeds.<a href="./src/resources/news/newsfeeds/newsfeeds.ts">retrieve</a>(id, { ...params }) -> Newsfeed</code>
- <code title="get /news/newsfeeds">client.news.newsfeeds.<a href="./src/resources/news/newsfeeds/newsfeeds.ts">list</a>({ ...params }) -> PaginatedResponse</code>
- <code title="get /news/newsfeeds">client.news.newsfeeds.<a href="./src/resources/news/newsfeeds/newsfeeds.ts">list</a>({ ...params }) -> NewsfeedListResponse</code>

### Items

Types:

- <code><a href="./src/resources/news/newsfeeds/items.ts">ItemListResponse</a></code>

Methods:

- <code title="get /news/newsfeeds/{id}/items">client.news.newsfeeds.items.<a href="./src/resources/news/newsfeeds/items.ts">list</a>(id, { ...params }) -> PaginatedResponse</code>
- <code title="get /news/newsfeeds/{id}/items">client.news.newsfeeds.items.<a href="./src/resources/news/newsfeeds/items.ts">list</a>(id, { ...params }) -> ItemListResponse</code>

# Notes

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intercom-client",
"version": "6.0.0-beta.1",
"version": "6.0.0-beta.2",
"description": "The official TypeScript library for the Intercom API",
"author": "Intercom <[email protected]>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -32,8 +32,7 @@
"form-data-encoder": "1.7.2",
"formdata-node": "^4.3.2",
"node-fetch": "^2.6.7",
"qs": "^6.10.3",
"web-streams-polyfill": "^3.2.1"
"qs": "^6.10.3"
},
"devDependencies": {
"@swc/core": "^1.3.102",
Expand Down
4 changes: 2 additions & 2 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log &
npm exec --package=@stainless-api/[email protected].4 -- prism mock "$URL" &> .prism.log &

# Wait for server to come online
echo -n "Waiting for server"
Expand All @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then

echo
else
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL"
npm exec --package=@stainless-api/[email protected].4 -- prism mock "$URL"
fi
4 changes: 1 addition & 3 deletions src/_shims/node-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import { Readable } from 'node:stream';
import { type RequestOptions } from '../core';
import { MultipartBody } from './MultipartBody';
import { type Shims } from './registry';

// @ts-ignore (this package does not have proper export maps for this export)
import { ReadableStream } from 'web-streams-polyfill/dist/ponyfill.es2018.js';
import { ReadableStream } from 'node:stream/web';

type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;

Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export class Intercom extends Core.APIClient {
}

static Intercom = this;
static DEFAULT_TIMEOUT = 60000; // 1 minute

static IntercomError = Errors.IntercomError;
static APIError = Errors.APIError;
Expand Down Expand Up @@ -289,8 +290,9 @@ export namespace Intercom {
export import ContactUnarchiveParams = API.ContactUnarchiveParams;

export import Conversations = API.Conversations;
export import ConversationList = API.ConversationList;
export import ConversationListResponse = API.ConversationListResponse;
export import ConversationSearchResponse = API.ConversationSearchResponse;
export import ConversationListResponsesCursorPagination = API.ConversationListResponsesCursorPagination;
export import ConversationCreateParams = API.ConversationCreateParams;
export import ConversationRetrieveParams = API.ConversationRetrieveParams;
export import ConversationUpdateParams = API.ConversationUpdateParams;
Expand Down Expand Up @@ -391,7 +393,6 @@ export namespace Intercom {
export import Message = API.Message;
export import MultipleFilterSearchRequest = API.MultipleFilterSearchRequest;
export import Note = API.Note;
export import PaginatedResponse = API.PaginatedResponse;
export import PartAttachment = API.PartAttachment;
export import Reference = API.Reference;
export import SearchRequest = API.SearchRequest;
Expand Down
29 changes: 16 additions & 13 deletions src/resources/conversations/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import { isRequestOptions } from '../../core';
import * as Core from '../../core';
import * as ConversationsAPI from './conversations';
import * as Shared from '../shared';
import { ConversationListResponsesCursorPagination } from '../shared';
import * as CustomersAPI from './customers';
import * as PartsAPI from './parts';
import * as ReplyAPI from './reply';
import * as RunAssignmentRulesAPI from './run-assignment-rules';
import * as TagsAPI from './tags';
import * as NewsItemsAPI from '../news/news-items';
import * as NewsfeedsAPI from '../news/newsfeeds/newsfeeds';
import { type CursorPaginationParams } from '../../pagination';
import { CursorPagination, type CursorPaginationParams } from '../../pagination';

export class Conversations extends APIResource {
tags: TagsAPI.Tags = new TagsAPI.Tags(this._client);
Expand Down Expand Up @@ -324,7 +323,10 @@ export class Conversations extends APIResource {
* | ^ | String | Starts With |
* | $ | String | Ends With |
*/
search(params: ConversationSearchParams, options?: Core.RequestOptions): Core.APIPromise<ConversationList> {
search(
params: ConversationSearchParams,
options?: Core.RequestOptions,
): Core.APIPromise<ConversationSearchResponse> {
const { 'Intercom-Version': intercomVersion, ...body } = params;
return this._client.post('/conversations/search', {
body,
Expand All @@ -339,12 +341,20 @@ export class Conversations extends APIResource {
}
}

export class ConversationListResponsesCursorPagination extends CursorPagination<ConversationListResponse> {}

/**
* A News Item is a content type in Intercom enabling you to announce product
* updates, company news, promotions, events and more with your customers.
*/
export type ConversationListResponse = NewsItemsAPI.NewsItem | NewsfeedsAPI.Newsfeed;

/**
* Conversations are how you can communicate with users in Intercom. They are
* created when a contact replies to an outbound message, or when one admin
* directly sends a message to a single contact.
*/
export interface ConversationList {
export interface ConversationSearchResponse {
/**
* The list of conversation objects
*/
Expand All @@ -369,12 +379,6 @@ export interface ConversationList {
type?: 'conversation.list';
}

/**
* A News Item is a content type in Intercom enabling you to announce product
* updates, company news, promotions, events and more with your customers.
*/
export type ConversationListResponse = NewsItemsAPI.NewsItem | NewsfeedsAPI.Newsfeed;

export interface ConversationCreateParams {
/**
* Body param: The content of the message. HTML is not supported.
Expand Down Expand Up @@ -725,8 +729,9 @@ export interface ConversationSearchParams {
}

export namespace Conversations {
export import ConversationList = ConversationsAPI.ConversationList;
export import ConversationListResponse = ConversationsAPI.ConversationListResponse;
export import ConversationSearchResponse = ConversationsAPI.ConversationSearchResponse;
export import ConversationListResponsesCursorPagination = ConversationsAPI.ConversationListResponsesCursorPagination;
export import ConversationCreateParams = ConversationsAPI.ConversationCreateParams;
export import ConversationRetrieveParams = ConversationsAPI.ConversationRetrieveParams;
export import ConversationUpdateParams = ConversationsAPI.ConversationUpdateParams;
Expand All @@ -747,5 +752,3 @@ export namespace Conversations {
export import CustomerCreateParams = CustomersAPI.CustomerCreateParams;
export import CustomerDeleteParams = CustomersAPI.CustomerDeleteParams;
}

export { ConversationListResponsesCursorPagination };
2 changes: 1 addition & 1 deletion src/resources/conversations/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export {
ConversationList,
ConversationListResponse,
ConversationSearchResponse,
ConversationCreateParams,
ConversationRetrieveParams,
ConversationUpdateParams,
Expand Down
2 changes: 1 addition & 1 deletion src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export {
Contacts,
} from './contacts/contacts';
export {
ConversationList,
ConversationListResponse,
ConversationSearchResponse,
ConversationCreateParams,
ConversationRetrieveParams,
ConversationUpdateParams,
Expand Down
9 changes: 8 additions & 1 deletion src/resources/news/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
export { News } from './news';
export {
NewsItem,
NewsItemListResponse,
NewsItemDeleteResponse,
NewsItemCreateParams,
NewsItemRetrieveParams,
Expand All @@ -11,4 +12,10 @@ export {
NewsItemDeleteParams,
NewsItems,
} from './news-items';
export { Newsfeed, NewsfeedRetrieveParams, NewsfeedListParams, Newsfeeds } from './newsfeeds/index';
export {
Newsfeed,
NewsfeedListResponse,
NewsfeedRetrieveParams,
NewsfeedListParams,
Newsfeeds,
} from './newsfeeds/index';
Loading

0 comments on commit 8f7c33e

Please sign in to comment.