Skip to content

Commit f104a26

Browse files
feat(api): update via SDK Studio (#13)
1 parent eb87919 commit f104a26

File tree

16 files changed

+95
-95
lines changed

16 files changed

+95
-95
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2025 Zeroentropy
189+
Copyright 2025 ZeroEntropy
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Zeroentropy Node API Library
1+
# ZeroEntropy Node API Library
22

33
[![NPM version](https://img.shields.io/npm/v/zeroentropy.svg)](https://npmjs.org/package/zeroentropy) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/zeroentropy)
44

5-
This library provides convenient access to the Zeroentropy REST API from server-side TypeScript or JavaScript.
5+
This library provides convenient access to the ZeroEntropy REST API from server-side TypeScript or JavaScript.
66

77
The REST API documentation can be found on [docs.zeroentropy.dev](https://docs.zeroentropy.dev/api-reference). The full API of this library can be found in [api.md](api.md).
88

@@ -18,9 +18,9 @@ The full API of this library can be found in [api.md](api.md).
1818

1919
<!-- prettier-ignore -->
2020
```js
21-
import Zeroentropy from 'zeroentropy';
21+
import ZeroEntropy from 'zeroentropy';
2222

23-
const client = new Zeroentropy({
23+
const client = new ZeroEntropy({
2424
apiKey: process.env['ZEROENTROPY_API_KEY'], // This is the default and can be omitted
2525
});
2626

@@ -43,14 +43,14 @@ This library includes TypeScript definitions for all request params and response
4343

4444
<!-- prettier-ignore -->
4545
```ts
46-
import Zeroentropy from 'zeroentropy';
46+
import ZeroEntropy from 'zeroentropy';
4747

48-
const client = new Zeroentropy({
48+
const client = new ZeroEntropy({
4949
apiKey: process.env['ZEROENTROPY_API_KEY'], // This is the default and can be omitted
5050
});
5151

5252
async function main() {
53-
const response: Zeroentropy.StatusGetStatusResponse = await client.status.getStatus();
53+
const response: ZeroEntropy.StatusGetStatusResponse = await client.status.getStatus();
5454
}
5555

5656
main();
@@ -68,7 +68,7 @@ a subclass of `APIError` will be thrown:
6868
```ts
6969
async function main() {
7070
const response = await client.status.getStatus().catch(async (err) => {
71-
if (err instanceof Zeroentropy.APIError) {
71+
if (err instanceof ZeroEntropy.APIError) {
7272
console.log(err.status); // 400
7373
console.log(err.name); // BadRequestError
7474
console.log(err.headers); // {server: 'nginx', ...}
@@ -105,7 +105,7 @@ You can use the `maxRetries` option to configure or disable this:
105105
<!-- prettier-ignore -->
106106
```js
107107
// Configure the default for all requests:
108-
const client = new Zeroentropy({
108+
const client = new ZeroEntropy({
109109
maxRetries: 0, // default is 2
110110
});
111111

@@ -122,7 +122,7 @@ Requests time out after 1 minute by default. You can configure this with a `time
122122
<!-- prettier-ignore -->
123123
```ts
124124
// Configure the default for all requests:
125-
const client = new Zeroentropy({
125+
const client = new ZeroEntropy({
126126
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
127127
});
128128

@@ -138,7 +138,7 @@ Note that requests which time out will be [retried twice by default](#retries).
138138

139139
## Auto-pagination
140140

141-
List methods in the Zeroentropy API are paginated.
141+
List methods in the ZeroEntropy API are paginated.
142142
You can use the `for await … of` syntax to iterate through items across all pages:
143143

144144
```ts
@@ -179,7 +179,7 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
179179

180180
<!-- prettier-ignore -->
181181
```ts
182-
const client = new Zeroentropy();
182+
const client = new ZeroEntropy();
183183

184184
const response = await client.status.getStatus().asResponse();
185185
console.log(response.headers.get('X-My-Header'));
@@ -240,13 +240,13 @@ By default, this library uses `node-fetch` in Node, and expects a global `fetch`
240240

241241
If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment,
242242
(for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`),
243-
add the following import before your first import `from "Zeroentropy"`:
243+
add the following import before your first import `from "ZeroEntropy"`:
244244

245245
```ts
246246
// Tell TypeScript and the package to use the global web fetch instead of node-fetch.
247247
// Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
248248
import 'zeroentropy/shims/web';
249-
import Zeroentropy from 'zeroentropy';
249+
import ZeroEntropy from 'zeroentropy';
250250
```
251251

252252
To do the inverse, add `import "zeroentropy/shims/node"` (which does import polyfills).
@@ -259,9 +259,9 @@ which can be used to inspect or alter the `Request` or `Response` before/after e
259259

260260
```ts
261261
import { fetch } from 'undici'; // as one example
262-
import Zeroentropy from 'zeroentropy';
262+
import ZeroEntropy from 'zeroentropy';
263263

264-
const client = new Zeroentropy({
264+
const client = new ZeroEntropy({
265265
fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
266266
console.log('About to make a request', url, init);
267267
const response = await fetch(url, init);
@@ -286,7 +286,7 @@ import http from 'http';
286286
import { HttpsProxyAgent } from 'https-proxy-agent';
287287

288288
// Configure the default for all requests:
289-
const client = new Zeroentropy({
289+
const client = new ZeroEntropy({
290290
httpAgent: new HttpsProxyAgent(process.env.PROXY_URL),
291291
});
292292

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ before making any information public.
1616
## Reporting Non-SDK Related Security Issues
1717

1818
If you encounter security issues that are not directly related to SDKs but pertain to the services
19-
or products provided by Zeroentropy please follow the respective company's security reporting guidelines.
19+
or products provided by ZeroEntropy please follow the respective company's security reporting guidelines.
2020

21-
### Zeroentropy Terms and Policies
21+
### ZeroEntropy Terms and Policies
2222

2323
Please contact founders@zeroentropy.dev for any questions or concerns regarding security of our services.
2424

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "zeroentropy",
33
"version": "0.1.0-alpha.1",
4-
"description": "The official TypeScript library for the Zeroentropy API",
5-
"author": "Zeroentropy <founders@zeroentropy.dev>",
4+
"description": "The official TypeScript library for the ZeroEntropy API",
5+
"author": "ZeroEntropy <founders@zeroentropy.dev>",
66
"types": "dist/index.d.ts",
77
"main": "dist/index.js",
88
"type": "commonjs",

scripts/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ npm exec tsc-multi
3232
# copy over handwritten .js/.mjs/.d.ts files
3333
cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims
3434
cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto
35-
# we need to add exports = module.exports = Zeroentropy to index.js;
35+
# we need to add exports = module.exports = ZeroEntropy to index.js;
3636
# No way to get that from index.ts because it would cause compile errors
3737
# when building .mjs
3838
node scripts/utils/fix-index-exports.cjs

src/core.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VERSION } from './version';
22
import {
3-
ZeroentropyError,
3+
ZeroEntropyError,
44
APIError,
55
APIConnectionError,
66
APIConnectionTimeoutError,
@@ -504,7 +504,7 @@ export abstract class APIClient {
504504
if (value === null) {
505505
return `${encodeURIComponent(key)}=`;
506506
}
507-
throw new ZeroentropyError(
507+
throw new ZeroEntropyError(
508508
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
509509
);
510510
})
@@ -654,7 +654,7 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
654654
async getNextPage(): Promise<this> {
655655
const nextInfo = this.nextPageInfo();
656656
if (!nextInfo) {
657-
throw new ZeroentropyError(
657+
throw new ZeroEntropyError(
658658
'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.',
659659
);
660660
}
@@ -990,10 +990,10 @@ export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve
990990

991991
const validatePositiveInteger = (name: string, n: unknown): number => {
992992
if (typeof n !== 'number' || !Number.isInteger(n)) {
993-
throw new ZeroentropyError(`${name} must be an integer`);
993+
throw new ZeroEntropyError(`${name} must be an integer`);
994994
}
995995
if (n < 0) {
996-
throw new ZeroentropyError(`${name} must be a positive integer`);
996+
throw new ZeroEntropyError(`${name} must be a positive integer`);
997997
}
998998
return n;
999999
};
@@ -1010,7 +1010,7 @@ export const castToError = (err: any): Error => {
10101010

10111011
export const ensurePresent = <T>(value: T | null | undefined): T => {
10121012
if (value == null)
1013-
throw new ZeroentropyError(`Expected a value to be given but received ${value} instead.`);
1013+
throw new ZeroEntropyError(`Expected a value to be given but received ${value} instead.`);
10141014
return value;
10151015
};
10161016

@@ -1035,14 +1035,14 @@ export const coerceInteger = (value: unknown): number => {
10351035
if (typeof value === 'number') return Math.round(value);
10361036
if (typeof value === 'string') return parseInt(value, 10);
10371037

1038-
throw new ZeroentropyError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
1038+
throw new ZeroEntropyError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
10391039
};
10401040

10411041
export const coerceFloat = (value: unknown): number => {
10421042
if (typeof value === 'number') return value;
10431043
if (typeof value === 'string') return parseFloat(value);
10441044

1045-
throw new ZeroentropyError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
1045+
throw new ZeroEntropyError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
10461046
};
10471047

10481048
export const coerceBoolean = (value: unknown): boolean => {
@@ -1108,7 +1108,7 @@ function applyHeadersMut(targetHeaders: Headers, newHeaders: Headers): void {
11081108

11091109
export function debug(action: string, ...args: any[]) {
11101110
if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') {
1111-
console.log(`Zeroentropy:DEBUG:${action}`, ...args);
1111+
console.log(`ZeroEntropy:DEBUG:${action}`, ...args);
11121112
}
11131113
}
11141114

@@ -1193,7 +1193,7 @@ export const toBase64 = (str: string | null | undefined): string => {
11931193
return btoa(str);
11941194
}
11951195

1196-
throw new ZeroentropyError('Cannot generate b64 string; Expected `Buffer` or `btoa` to be defined');
1196+
throw new ZeroEntropyError('Cannot generate b64 string; Expected `Buffer` or `btoa` to be defined');
11971197
};
11981198

11991199
export function isObj(obj: unknown): obj is Record<string, unknown> {

src/error.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import { castToError, Headers } from './core';
44

5-
export class ZeroentropyError extends Error {}
5+
export class ZeroEntropyError extends Error {}
66

77
export class APIError<
88
TStatus extends number | undefined = number | undefined,
99
THeaders extends Headers | undefined = Headers | undefined,
1010
TError extends Object | undefined = Object | undefined,
11-
> extends ZeroentropyError {
11+
> extends ZeroEntropyError {
1212
/** HTTP status for the response that caused the error */
1313
readonly status: TStatus;
1414
/** HTTP headers for the response that caused the error */

src/index.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ export interface ClientOptions {
106106
}
107107

108108
/**
109-
* API Client for interfacing with the Zeroentropy API.
109+
* API Client for interfacing with the ZeroEntropy API.
110110
*/
111-
export class Zeroentropy extends Core.APIClient {
111+
export class ZeroEntropy extends Core.APIClient {
112112
apiKey: string;
113113

114114
private _options: ClientOptions;
115115

116116
/**
117-
* API Client for interfacing with the Zeroentropy API.
117+
* API Client for interfacing with the ZeroEntropy API.
118118
*
119119
* @param {string | undefined} [opts.apiKey=process.env['ZEROENTROPY_API_KEY'] ?? undefined]
120120
* @param {string} [opts.baseURL=process.env['ZEROENTROPY_BASE_URL'] ?? https://api.zeroentropy.dev/v1] - Override the default base URL for the API.
@@ -131,8 +131,8 @@ export class Zeroentropy extends Core.APIClient {
131131
...opts
132132
}: ClientOptions = {}) {
133133
if (apiKey === undefined) {
134-
throw new Errors.ZeroentropyError(
135-
"The ZEROENTROPY_API_KEY environment variable is missing or empty; either provide it, or instantiate the Zeroentropy client with an apiKey option, like new Zeroentropy({ apiKey: 'My API Key' }).",
134+
throw new Errors.ZeroEntropyError(
135+
"The ZEROENTROPY_API_KEY environment variable is missing or empty; either provide it, or instantiate the ZeroEntropy client with an apiKey option, like new ZeroEntropy({ apiKey: 'My API Key' }).",
136136
);
137137
}
138138

@@ -176,10 +176,10 @@ export class Zeroentropy extends Core.APIClient {
176176
return { Authorization: `Bearer ${this.apiKey}` };
177177
}
178178

179-
static Zeroentropy = this;
179+
static ZeroEntropy = this;
180180
static DEFAULT_TIMEOUT = 60000; // 1 minute
181181

182-
static ZeroentropyError = Errors.ZeroentropyError;
182+
static ZeroEntropyError = Errors.ZeroEntropyError;
183183
static APIError = Errors.APIError;
184184
static APIConnectionError = Errors.APIConnectionError;
185185
static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
@@ -197,14 +197,14 @@ export class Zeroentropy extends Core.APIClient {
197197
static fileFromPath = Uploads.fileFromPath;
198198
}
199199

200-
Zeroentropy.Status = Status;
201-
Zeroentropy.Collections = Collections;
202-
Zeroentropy.Documents = Documents;
203-
Zeroentropy.DocumentGetInfoListResponsesGetDocumentInfoListCursor =
200+
ZeroEntropy.Status = Status;
201+
ZeroEntropy.Collections = Collections;
202+
ZeroEntropy.Documents = Documents;
203+
ZeroEntropy.DocumentGetInfoListResponsesGetDocumentInfoListCursor =
204204
DocumentGetInfoListResponsesGetDocumentInfoListCursor;
205-
Zeroentropy.Queries = Queries;
206-
Zeroentropy.Parsers = Parsers;
207-
export declare namespace Zeroentropy {
205+
ZeroEntropy.Queries = Queries;
206+
ZeroEntropy.Parsers = Parsers;
207+
export declare namespace ZeroEntropy {
208208
export type RequestOptions = Core.RequestOptions;
209209

210210
export import GetDocumentInfoListCursor = Pagination.GetDocumentInfoListCursor;
@@ -263,7 +263,7 @@ export declare namespace Zeroentropy {
263263

264264
export { toFile, fileFromPath } from './uploads';
265265
export {
266-
ZeroentropyError,
266+
ZeroEntropyError,
267267
APIError,
268268
APIConnectionError,
269269
APIConnectionTimeoutError,
@@ -278,4 +278,4 @@ export {
278278
UnprocessableEntityError,
279279
} from './error';
280280

281-
export default Zeroentropy;
281+
export default ZeroEntropy;

src/resource.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import type { Zeroentropy } from './index';
3+
import type { ZeroEntropy } from './index';
44

55
export class APIResource {
6-
protected _client: Zeroentropy;
6+
protected _client: ZeroEntropy;
77

8-
constructor(client: Zeroentropy) {
8+
constructor(client: ZeroEntropy) {
99
this._client = client;
1010
}
1111
}

tests/api-resources/collections.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import Zeroentropy from 'zeroentropy';
3+
import ZeroEntropy from 'zeroentropy';
44
import { Response } from 'node-fetch';
55

6-
const client = new Zeroentropy({
6+
const client = new ZeroEntropy({
77
apiKey: 'My API Key',
88
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
99
});
@@ -53,7 +53,7 @@ describe('resource collections', () => {
5353
test('getList: request options and params are passed correctly', async () => {
5454
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
5555
await expect(client.collections.getList({}, { path: '/_stainless_unknown_path' })).rejects.toThrow(
56-
Zeroentropy.NotFoundError,
56+
ZeroEntropy.NotFoundError,
5757
);
5858
});
5959
});

0 commit comments

Comments
 (0)