Skip to content

Commit 3c6b1d3

Browse files
feat(api): manual updates
1 parent 078548f commit 3c6b1d3

File tree

9 files changed

+57
-66
lines changed

9 files changed

+57
-66
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 119
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-c850a6432597255fc1b788ba21a0494162e639f41dd80c0f9d07def239d31865.yml
3-
openapi_spec_hash: fba3f62e51d3ba39eea280abe29f39f1
4-
config_hash: 8e3b8fba844b78950ad4a13b75b7fffc
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-ca9a49ac7fbb63f55611fd7cd48a22a3ff8b38a797125c8513e891d9b7345550.yml
3+
openapi_spec_hash: fd6ffbdfaefcc555e61ca1c565e05214
4+
config_hash: bb9d0a0bdadbee0985dd7c1e4f0e9e8a

README.md

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,9 @@ const client = new Gitpod({
2626
bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
2727
});
2828

29-
async function main() {
30-
const response = await client.identity.getAuthenticatedIdentity();
29+
const response = await client.identity.getAuthenticatedIdentity();
3130

32-
console.log(response.organizationId);
33-
}
34-
35-
main();
31+
console.log(response.organizationId);
3632
```
3733

3834
### Request & Response types
@@ -47,12 +43,8 @@ const client = new Gitpod({
4743
bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
4844
});
4945

50-
async function main() {
51-
const response: Gitpod.IdentityGetAuthenticatedIdentityResponse =
52-
await client.identity.getAuthenticatedIdentity();
53-
}
54-
55-
main();
46+
const response: Gitpod.IdentityGetAuthenticatedIdentityResponse =
47+
await client.identity.getAuthenticatedIdentity();
5648
```
5749

5850
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -65,19 +57,15 @@ a subclass of `APIError` will be thrown:
6557

6658
<!-- prettier-ignore -->
6759
```ts
68-
async function main() {
69-
const response = await client.identity.getAuthenticatedIdentity().catch(async (err) => {
70-
if (err instanceof Gitpod.APIError) {
71-
console.log(err.status); // 400
72-
console.log(err.name); // BadRequestError
73-
console.log(err.headers); // {server: 'nginx', ...}
74-
} else {
75-
throw err;
76-
}
77-
});
78-
}
79-
80-
main();
60+
const response = await client.identity.getAuthenticatedIdentity().catch(async (err) => {
61+
if (err instanceof Gitpod.APIError) {
62+
console.log(err.status); // 400
63+
console.log(err.name); // BadRequestError
64+
console.log(err.headers); // {server: 'nginx', ...}
65+
} else {
66+
throw err;
67+
}
68+
});
8169
```
8270

8371
Error codes are as follows:

scripts/build

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ npm exec tsc-multi
3737
# when building .mjs
3838
node scripts/utils/fix-index-exports.cjs
3939
cp tsconfig.dist-src.json dist/src/tsconfig.json
40-
cp src/internal/shim-types.d.ts dist/internal/shim-types.d.ts
41-
cp src/internal/shim-types.d.ts dist/internal/shim-types.d.mts
4240

4341
node scripts/utils/postprocess-files.cjs
4442

src/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import type { HTTPMethod, PromiseOrValue, MergedRequestInit, FinalizedRequestIni
55
import { uuid4 } from './internal/utils/uuid';
66
import { validatePositiveInteger, isAbsoluteURL, safeJSON } from './internal/utils/values';
77
import { sleep } from './internal/utils/sleep';
8-
import { type Logger, type LogLevel, parseLogLevel } from './internal/utils/log';
9-
export type { Logger, LogLevel } from './internal/utils/log';
8+
import { type Logger, type LogLevel as LogLevelClient, parseLogLevel } from './internal/utils/log';
9+
export type { Logger, LogLevel as LogLevelClient } from './internal/utils/log';
1010
import { castToError, isAbortError } from './internal/errors';
1111
import type { APIResponseProps } from './internal/parse';
1212
import { getPlatformHeaders } from './internal/detect-platform';
@@ -318,7 +318,7 @@ export interface ClientOptions {
318318
*
319319
* Defaults to process.env['GITPOD_LOG'] or 'warn' if it isn't set.
320320
*/
321-
logLevel?: LogLevel | undefined;
321+
logLevel?: LogLevelClient | undefined;
322322

323323
/**
324324
* Set the logger.
@@ -338,7 +338,7 @@ export class Gitpod {
338338
maxRetries: number;
339339
timeout: number;
340340
logger: Logger | undefined;
341-
logLevel: LogLevel | undefined;
341+
logLevel: LogLevelClient | undefined;
342342
fetchOptions: MergedRequestInit | undefined;
343343

344344
private fetch: Fetch;

src/core/pagination.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class PagePromise<
9999
* console.log(item)
100100
* }
101101
*/
102-
async *[Symbol.asyncIterator]() {
102+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
103103
const page = await this;
104104
for await (const item of page) {
105105
yield item;

src/internal/shim-types.d.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/internal/shim-types.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
/**
4+
* Shims for types that we can't always rely on being available globally.
5+
*
6+
* Note: these only exist at the type-level, there is no corresponding runtime
7+
* version for any of these symbols.
8+
*/
9+
10+
type NeverToAny<T> = T extends never ? any : T;
11+
12+
/** @ts-ignore */
13+
type _DOMReadableStream<R = any> = globalThis.ReadableStream<R>;
14+
15+
/** @ts-ignore */
16+
type _NodeReadableStream<R = any> = import('stream/web').ReadableStream<R>;
17+
18+
type _ConditionalNodeReadableStream<R = any> =
19+
typeof globalThis extends { ReadableStream: any } ? never : _NodeReadableStream<R>;
20+
21+
type _ReadableStream<R = any> = NeverToAny<
22+
| ([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>)
23+
| ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)
24+
>;
25+
26+
export type { _ReadableStream as ReadableStream };

src/internal/shims.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* messages in cases where an environment isn't fully supported.
88
*/
99

10-
import { type Fetch } from './builtin-types';
11-
import { type ReadableStream } from './shim-types';
10+
import type { Fetch } from './builtin-types';
11+
import type { ReadableStream } from './shim-types';
1212

1313
export function getDefaultFetch(): Fetch {
1414
if (typeof fetch !== 'undefined') {

src/resources/environments/environments.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1474,12 +1474,19 @@ export interface EnvironmentUpdateParams {
14741474
*/
14751475
environmentId?: string;
14761476

1477-
metadata?: unknown | null;
1477+
metadata?: EnvironmentUpdateParams.Metadata | null;
14781478

14791479
spec?: EnvironmentUpdateParams.Spec | null;
14801480
}
14811481

14821482
export namespace EnvironmentUpdateParams {
1483+
export interface Metadata {
1484+
/**
1485+
* name is the user-defined display name of the environment
1486+
*/
1487+
name?: string | null;
1488+
}
1489+
14831490
export interface Spec {
14841491
/**
14851492
* automations_file is the automations file spec of the environment

0 commit comments

Comments
 (0)