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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"cliVersion": "3.17.0",
"cliVersion": "3.37.6",
"generatorName": "fernapi/fern-typescript-node-sdk",
"generatorVersion": "3.39.3",
"generatorVersion": "3.42.8",
"generatorConfig": {
"namespaceExport": "Lattice"
}
},
"sdkVersion": "4.1.0"
}
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The Lattice SDK TypeScript library provides convenient access to the Lattice SDK
- [Support](#support)
- [Reference](#reference)
- [Usage](#usage)
- [Authentication](#authentication)
- [Request and Response Types](#request-and-response-types)
- [Exception Handling](#exception-handling)
- [Streaming Response](#streaming-response)
Expand Down Expand Up @@ -61,12 +62,43 @@ Instantiate and use the client with the following:
```typescript
import { LatticeClient } from "@anduril-industries/lattice-sdk";

const client = new LatticeClient({ token: "YOUR_TOKEN" });
const client = new LatticeClient({ clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET" });
await client.entities.longPollEntityEvents({
sessionToken: "sessionToken"
});
```

## Authentication

The SDK supports OAuth authentication with two options:

**Option 1: OAuth Client Credentials Flow**

Use this when you want the SDK to automatically handle OAuth token retrieval and refreshing:

```typescript
import { LatticeClient } from "@anduril-industries/lattice-sdk";

const client = new LatticeClient({
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
...
});
```

**Option 2: Token Override**

Use this when you already have a valid bearer token and want to skip the OAuth flow:

```typescript
import { LatticeClient } from "@anduril-industries/lattice-sdk";

const client = new LatticeClient({
token: "my-pre-generated-bearer-token",
...
});
```

## Request and Response Types

The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
Expand Down Expand Up @@ -108,7 +140,7 @@ The SDK uses async iterators, so you can consume the responses using a `for awai
```typescript
import { LatticeClient } from "@anduril-industries/lattice-sdk";

const client = new LatticeClient({ token: "YOUR_TOKEN" });
const client = new LatticeClient({ clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET" });
const response = await client.entities.streamEntities();
for await (const item of response) {
console.log(item);
Expand Down Expand Up @@ -556,7 +588,7 @@ List endpoints are paginated. The SDK provides an iterator so that you can simpl
```typescript
import { LatticeClient } from "@anduril-industries/lattice-sdk";

const client = new LatticeClient({ token: "YOUR_TOKEN" });
const client = new LatticeClient({ clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET" });
const pageableResponse = await client.objects.listObjects();
for await (const item of pageableResponse) {
console.log(item);
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"name": "@anduril-industries/lattice-sdk",
"version": "4.0.0",
"version": "4.1.0",
"private": false,
"repository": "github:anduril/lattice-sdk-javascript",
"repository": {
"type": "git",
"url": "git+https://github.com/anduril/lattice-sdk-javascript.git"
},
"license": "See LICENSE",
"type": "commonjs",
"main": "./dist/cjs/index.js",
Expand Down
Loading