Skip to content
Closed
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
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ tests
.fernignore
.prettierrc.yml
tsconfig.json
yarn.lock
yarn.lock
pnpm-lock.yaml
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

![](https://www.anduril.com/lattice-sdk/)

[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fanduril%2Flattice-sdk-javascript)
[![npm shield](https://img.shields.io/npm/v/@anduril-industries/lattice-sdk)](https://www.npmjs.com/package/@anduril-industries/lattice-sdk)

The Lattice SDK TypeScript library provides convenient access to the Lattice API from TypeScript.
The Anduril TypeScript library provides convenient access to the Anduril APIs from TypeScript.

## Documentation

Expand Down Expand Up @@ -548,6 +549,18 @@ const response = await client.entities.longPollEntityEvents(..., {
});
```

### Additional Query String Parameters

If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.

```typescript
const response = await client.entities.longPollEntityEvents(..., {
queryParams: {
'customQueryParamKey': 'custom query param value'
}
});
```

### Retries

The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
Expand Down Expand Up @@ -626,3 +639,13 @@ const client = new LatticeClient({
fetcher: // provide your implementation here
});
```

## Contributing

While we value open-source contributions to this SDK, this library is generated programmatically.
Additions made directly to this library would have to be moved over to our generation code,
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@anduril-industries/lattice-sdk",
"version": "2.2.0",
"version": "2.3.0",
"private": false,
"repository": "github:anduril/lattice-sdk-javascript",
"license": "See LICENSE",
Expand Down
71 changes: 71 additions & 0 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,77 @@ while (page.hasNextPage()) {
</dl>
</details>

<details><summary><code>client.objects.<a href="/src/api/resources/objects/client/Client.ts">getObject</a>(objectPath, { ...params }) -> core.BinaryResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Fetches an object from your environment using the objectPath path parameter.

</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.objects.getObject("objectPath");
```

</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**objectPath:** `string` — The path of the object to fetch.

</dd>
</dl>

<dl>
<dd>

**request:** `Lattice.GetObjectRequest`

</dd>
</dl>

<dl>
<dd>

**requestOptions:** `Objects.RequestOptions`

</dd>
</dl>
</dd>
</dl>

</dd>
</dl>
</details>

<details><summary><code>client.objects.<a href="/src/api/resources/objects/client/Client.ts">deleteObject</a>(objectPath) -> void</code></summary>
<dl>
<dd>
Expand Down
10 changes: 6 additions & 4 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export declare namespace LatticeClient {
baseUrl?: core.Supplier<string>;
token?: core.Supplier<core.BearerToken | undefined>;
/** Additional headers to include in requests. */
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
}

export interface RequestOptions {
Expand All @@ -26,8 +26,10 @@ export declare namespace LatticeClient {
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Additional query string parameters to include in the request. */
queryParams?: Record<string, unknown>;
/** Additional headers to include in the request. */
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
}
}

Expand All @@ -44,8 +46,8 @@ export class LatticeClient {
{
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@anduril-industries/lattice-sdk",
"X-Fern-SDK-Version": "2.2.0",
"User-Agent": "@anduril-industries/lattice-sdk/2.2.0",
"X-Fern-SDK-Version": "2.3.0",
"User-Agent": "@anduril-industries/lattice-sdk/2.3.0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
78 changes: 46 additions & 32 deletions src/api/resources/entities/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export declare namespace Entities {
baseUrl?: core.Supplier<string>;
token?: core.Supplier<core.BearerToken | undefined>;
/** Additional headers to include in requests. */
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
}

export interface RequestOptions {
Expand All @@ -25,8 +25,10 @@ export declare namespace Entities {
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Additional query string parameters to include in the request. */
queryParams?: Record<string, unknown>;
/** Additional headers to include in the request. */
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
}
}

Expand Down Expand Up @@ -69,6 +71,11 @@ export class Entities {
request: Lattice.Entity,
requestOptions?: Entities.RequestOptions,
): Promise<core.WithRawResponse<Lattice.Entity>> {
let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
);
const _response = await core.fetcher({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
Expand All @@ -77,12 +84,9 @@ export class Entities {
"api/v1/entities",
),
method: "PUT",
headers: mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
),
headers: _headers,
contentType: "application/json",
queryParameters: requestOptions?.queryParams,
requestType: "json",
body: request,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down Expand Up @@ -147,6 +151,11 @@ export class Entities {
entityId: string,
requestOptions?: Entities.RequestOptions,
): Promise<core.WithRawResponse<Lattice.Entity>> {
let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
);
const _response = await core.fetcher({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
Expand All @@ -155,11 +164,8 @@ export class Entities {
`api/v1/entities/${encodeURIComponent(entityId)}`,
),
method: "GET",
headers: mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
),
headers: _headers,
queryParameters: requestOptions?.queryParams,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
Expand Down Expand Up @@ -240,6 +246,11 @@ export class Entities {
request: Lattice.EntityOverride = {},
requestOptions?: Entities.RequestOptions,
): Promise<core.WithRawResponse<Lattice.Entity>> {
let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
);
const _response = await core.fetcher({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
Expand All @@ -248,12 +259,9 @@ export class Entities {
`api/v1/entities/${encodeURIComponent(entityId)}/override/${encodeURIComponent(fieldPath)}`,
),
method: "PUT",
headers: mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
),
headers: _headers,
contentType: "application/json",
queryParameters: requestOptions?.queryParams,
requestType: "json",
body: request,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down Expand Up @@ -327,6 +335,11 @@ export class Entities {
fieldPath: string,
requestOptions?: Entities.RequestOptions,
): Promise<core.WithRawResponse<Lattice.Entity>> {
let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
);
const _response = await core.fetcher({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
Expand All @@ -335,11 +348,8 @@ export class Entities {
`api/v1/entities/${encodeURIComponent(entityId)}/override/${encodeURIComponent(fieldPath)}`,
),
method: "DELETE",
headers: mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
),
headers: _headers,
queryParameters: requestOptions?.queryParams,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
Expand Down Expand Up @@ -420,6 +430,11 @@ export class Entities {
request: Lattice.EntityEventRequest,
requestOptions?: Entities.RequestOptions,
): Promise<core.WithRawResponse<Lattice.EntityEventResponse>> {
let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
);
const _response = await core.fetcher({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
Expand All @@ -428,12 +443,9 @@ export class Entities {
"api/v1/entities/events",
),
method: "POST",
headers: mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
),
headers: _headers,
contentType: "application/json",
queryParameters: requestOptions?.queryParams,
requestType: "json",
body: request,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down Expand Up @@ -496,6 +508,11 @@ export class Entities {
request: Lattice.EntityStreamRequest = {},
requestOptions?: Entities.RequestOptions,
): Promise<core.WithRawResponse<core.Stream<Lattice.StreamEntitiesResponse>>> {
let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
);
const _response = await core.fetcher<ReadableStream>({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
Expand All @@ -504,12 +521,9 @@ export class Entities {
"api/v1/entities/stream",
),
method: "POST",
headers: mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
requestOptions?.headers,
),
headers: _headers,
contentType: "application/json",
queryParameters: requestOptions?.queryParams,
requestType: "json",
body: request,
responseType: "sse",
Expand Down
Loading