Skip to content

Commit 974fb63

Browse files
feat(api): update via SDK Studio
1 parent 4e32701 commit 974fb63

File tree

100 files changed

+4234
-682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+4234
-682
lines changed

Diff for: README.md

+25-34
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ The full API of this library can be found in [api.md](api.md).
2929
```python
3030
from gitpod import Gitpod
3131

32-
client = Gitpod(
33-
connect_protocol_version=0,
34-
connect_timeout_header=0,
35-
)
32+
client = Gitpod()
3633

37-
runner = client.runners.create()
34+
runner = client.runners.create(
35+
connect_protocol_version=1,
36+
)
3837
print(runner.access_token)
3938
```
4039

@@ -51,14 +50,13 @@ Simply import `AsyncGitpod` instead of `Gitpod` and use `await` with each API ca
5150
import asyncio
5251
from gitpod import AsyncGitpod
5352

54-
client = AsyncGitpod(
55-
connect_protocol_version=0,
56-
connect_timeout_header=0,
57-
)
53+
client = AsyncGitpod()
5854

5955

6056
async def main() -> None:
61-
runner = await client.runners.create()
57+
runner = await client.runners.create(
58+
connect_protocol_version=1,
59+
)
6260
print(runner.access_token)
6361

6462

@@ -89,13 +87,12 @@ All errors inherit from `gitpod.APIError`.
8987
import gitpod
9088
from gitpod import Gitpod
9189

92-
client = Gitpod(
93-
connect_protocol_version=0,
94-
connect_timeout_header=0,
95-
)
90+
client = Gitpod()
9691

9792
try:
98-
client.runners.create()
93+
client.runners.create(
94+
connect_protocol_version=1,
95+
)
9996
except gitpod.APIConnectionError as e:
10097
print("The server could not be reached")
10198
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -135,12 +132,12 @@ from gitpod import Gitpod
135132
client = Gitpod(
136133
# default is 2
137134
max_retries=0,
138-
connect_protocol_version=0,
139-
connect_timeout_header=0,
140135
)
141136

142137
# Or, configure per-request:
143-
client.with_options(max_retries=5).runners.create()
138+
client.with_options(max_retries=5).runners.create(
139+
connect_protocol_version=1,
140+
)
144141
```
145142

146143
### Timeouts
@@ -155,19 +152,17 @@ from gitpod import Gitpod
155152
client = Gitpod(
156153
# 20 seconds (default is 1 minute)
157154
timeout=20.0,
158-
connect_protocol_version=0,
159-
connect_timeout_header=0,
160155
)
161156

162157
# More granular control:
163158
client = Gitpod(
164159
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
165-
connect_protocol_version=0,
166-
connect_timeout_header=0,
167160
)
168161

169162
# Override per-request:
170-
client.with_options(timeout=5.0).runners.create()
163+
client.with_options(timeout=5.0).runners.create(
164+
connect_protocol_version=1,
165+
)
171166
```
172167

173168
On timeout, an `APITimeoutError` is thrown.
@@ -207,11 +202,10 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
207202
```py
208203
from gitpod import Gitpod
209204

210-
client = Gitpod(
211-
connect_protocol_version=0,
212-
connect_timeout_header=0,
205+
client = Gitpod()
206+
response = client.runners.with_raw_response.create(
207+
connect_protocol_version=1,
213208
)
214-
response = client.runners.with_raw_response.create()
215209
print(response.headers.get('X-My-Header'))
216210

217211
runner = response.parse() # get the object that `runners.create()` would have returned
@@ -229,7 +223,9 @@ The above interface eagerly reads the full response body when you make the reque
229223
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
230224

231225
```python
232-
with client.runners.with_streaming_response.create() as response:
226+
with client.runners.with_streaming_response.create(
227+
connect_protocol_version=1,
228+
) as response:
233229
print(response.headers.get("X-My-Header"))
234230

235231
for line in response.iter_lines():
@@ -291,8 +287,6 @@ client = Gitpod(
291287
proxy="http://my.test.proxy.example.com",
292288
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
293289
),
294-
connect_protocol_version=0,
295-
connect_timeout_header=0,
296290
)
297291
```
298292

@@ -309,10 +303,7 @@ By default the library closes underlying HTTP connections whenever the client is
309303
```py
310304
from gitpod import Gitpod
311305

312-
with Gitpod(
313-
connect_protocol_version=0,
314-
connect_timeout_header=0,
315-
) as client:
306+
with Gitpod() as client:
316307
# make requests here
317308
...
318309

Diff for: src/gitpod/_client.py

-32
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,11 @@ class Gitpod(SyncAPIClient):
5454

5555
# client options
5656
bearer_token: str
57-
connect_protocol_version: float
58-
connect_timeout_header: float
5957

6058
def __init__(
6159
self,
6260
*,
6361
bearer_token: str | None = None,
64-
connect_protocol_version: float | None = 1,
65-
connect_timeout_header: float,
6662
base_url: str | httpx.URL | None = None,
6763
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
6864
max_retries: int = DEFAULT_MAX_RETRIES,
@@ -94,12 +90,6 @@ def __init__(
9490
)
9591
self.bearer_token = bearer_token
9692

97-
if connect_protocol_version is None:
98-
connect_protocol_version = 1
99-
self.connect_protocol_version = connect_protocol_version
100-
101-
self.connect_timeout_header = connect_timeout_header
102-
10393
if base_url is None:
10494
base_url = os.environ.get("GITPOD_BASE_URL")
10595
if base_url is None:
@@ -144,17 +134,13 @@ def default_headers(self) -> dict[str, str | Omit]:
144134
return {
145135
**super().default_headers,
146136
"X-Stainless-Async": "false",
147-
"Connect-Protocol-Version": str(self.connect_protocol_version),
148-
"Connect-Timeout-Ms": str(self.connect_timeout_header),
149137
**self._custom_headers,
150138
}
151139

152140
def copy(
153141
self,
154142
*,
155143
bearer_token: str | None = None,
156-
connect_protocol_version: float | None = None,
157-
connect_timeout_header: float | None = None,
158144
base_url: str | httpx.URL | None = None,
159145
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
160146
http_client: httpx.Client | None = None,
@@ -189,8 +175,6 @@ def copy(
189175
http_client = http_client or self._client
190176
return self.__class__(
191177
bearer_token=bearer_token or self.bearer_token,
192-
connect_protocol_version=connect_protocol_version or self.connect_protocol_version,
193-
connect_timeout_header=connect_timeout_header or self.connect_timeout_header,
194178
base_url=base_url or self.base_url,
195179
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
196180
http_client=http_client,
@@ -252,15 +236,11 @@ class AsyncGitpod(AsyncAPIClient):
252236

253237
# client options
254238
bearer_token: str
255-
connect_protocol_version: float
256-
connect_timeout_header: float
257239

258240
def __init__(
259241
self,
260242
*,
261243
bearer_token: str | None = None,
262-
connect_protocol_version: float | None = 1,
263-
connect_timeout_header: float,
264244
base_url: str | httpx.URL | None = None,
265245
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
266246
max_retries: int = DEFAULT_MAX_RETRIES,
@@ -292,12 +272,6 @@ def __init__(
292272
)
293273
self.bearer_token = bearer_token
294274

295-
if connect_protocol_version is None:
296-
connect_protocol_version = 1
297-
self.connect_protocol_version = connect_protocol_version
298-
299-
self.connect_timeout_header = connect_timeout_header
300-
301275
if base_url is None:
302276
base_url = os.environ.get("GITPOD_BASE_URL")
303277
if base_url is None:
@@ -342,17 +316,13 @@ def default_headers(self) -> dict[str, str | Omit]:
342316
return {
343317
**super().default_headers,
344318
"X-Stainless-Async": f"async:{get_async_library()}",
345-
"Connect-Protocol-Version": str(self.connect_protocol_version),
346-
"Connect-Timeout-Ms": str(self.connect_timeout_header),
347319
**self._custom_headers,
348320
}
349321

350322
def copy(
351323
self,
352324
*,
353325
bearer_token: str | None = None,
354-
connect_protocol_version: float | None = None,
355-
connect_timeout_header: float | None = None,
356326
base_url: str | httpx.URL | None = None,
357327
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
358328
http_client: httpx.AsyncClient | None = None,
@@ -387,8 +357,6 @@ def copy(
387357
http_client = http_client or self._client
388358
return self.__class__(
389359
bearer_token=bearer_token or self.bearer_token,
390-
connect_protocol_version=connect_protocol_version or self.connect_protocol_version,
391-
connect_timeout_header=connect_timeout_header or self.connect_timeout_header,
392360
base_url=base_url or self.base_url,
393361
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
394362
http_client=http_client,

0 commit comments

Comments
 (0)