Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"noSerdeLayer": true,
"enableInlineTypes": true,
"inlinePathParameters": true,
"consolidateTypeFiles": true,
"timeoutInSeconds": 20,
"packageJson": {
"license": "Apache-2.0",
Expand Down
16 changes: 16 additions & 0 deletions .fern/replay.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ LICENSE
REPO_OWNER
tests/integration
.github/workflows/ci.yml
.github/workflows/publish.yml
.github/workflows/publish.yml
.fern/replay.lock
.fern/replay.yml
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* text=auto
.fern/replay.lock linguist-generated=true
76 changes: 0 additions & 76 deletions .github/workflows-disabled/ci.yml

This file was deleted.

43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,49 @@ try {
}
```

## File Uploads

You can upload files using the client:

```typescript
import { createReadStream } from "fs";
import { IntercomClient } from "intercom-client";

const client = new IntercomClient({ token: "YOUR_TOKEN" });
await client.preview.ecommerceConnectors.uploadEcommerceCatalog({
id: "42939"
});
```
The client accepts a variety of types for file upload parameters:
* Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream`
* Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array`

### Metadata

You can configure metadata when uploading a file:
```typescript
const file: Uploadable.WithMetadata = {
data: createReadStream("path/to/file"),
filename: "my-file", // optional
contentType: "audio/mpeg", // optional
contentLength: 1949, // optional
};
```

Alternatively, you can upload a file directly from a file path:
```typescript
const file : Uploadable.FromPath = {
path: "path/to/file",
filename: "my-file", // optional
contentType: "audio/mpeg", // optional
contentLength: 1949, // optional
};
```

The metadata is used to set the `Content-Length`, `Content-Type`, and `Content-Disposition` headers. If not provided, the client will attempt to determine them automatically.
For example, `fs.ReadStream` has a `path` property which the SDK uses to retrieve the file size from the filesystem without loading it into memory.


## Pagination

List endpoints are paginated. The SDK provides an iterator so that you can simply loop over the items:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intercom-client",
"version": "7.0.3",
"version": "7.0.5-beta.0",
"private": false,
"repository": "github:intercom/intercom-node",
"type": "commonjs",
Expand Down Expand Up @@ -46,7 +46,7 @@
"devDependencies": {
"webpack": "^5.97.1",
"ts-loader": "^9.5.1",
"vitest": "^4.1.0",
"vitest": "^3.2.4",
"msw": "2.11.2",
"@types/node": "^18.19.70",
"typescript": "~5.7.2",
Expand Down
Loading
Loading