hot-dev 1.1.1__tar.gz → 1.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hot-dev
3
- Version: 1.1.1
3
+ Version: 1.1.2
4
4
  Summary: Python SDK for the Hot Dev API
5
5
  Project-URL: Homepage, https://hot.dev
6
6
  Project-URL: Repository, https://github.com/hot-dev/hot-python
@@ -78,6 +78,8 @@ with HotClient(token=os.environ["HOT_API_KEY"]) as hot:
78
78
 
79
79
  Authenticated clients should run server-side. Browser apps and public notebooks
80
80
  should call your own backend route instead of exposing a Hot API key.
81
+ Most management endpoints require an API key. Sessions and service keys are
82
+ permission-scoped and are mainly for event publishing and stream reads.
81
83
 
82
84
  ## Async Usage
83
85
 
@@ -109,6 +111,8 @@ async with AsyncHotClient(token=os.environ["HOT_API_KEY"]) as hot:
109
111
  print(event["type"], event)
110
112
  ```
111
113
 
114
+ `AsyncHotClient` exposes the same resource namespaces as `HotClient`.
115
+
112
116
  ## Errors
113
117
 
114
118
  Non-2xx API responses raise `HotApiError` with structured fields:
@@ -119,15 +123,15 @@ from hot import HotApiError
119
123
  try:
120
124
  hot.projects.get("missing-project")
121
125
  except HotApiError as error:
122
- print(error.status_code, error.code, error.request_id)
126
+ print(error.status_code, error.code, error.request_id, error.retry_after)
123
127
  ```
124
128
 
125
129
  ## Resources
126
130
 
127
131
  `HotClient` mirrors the Hot API v1 resources:
128
132
 
129
- - `hot.events` — publish, list, get, and inspect event runs
130
- - `hot.streams` — subscribe to run streams and publish events atomically (reconnects automatically across the 5-minute SSE timeout; pass `reconnect=False` to opt out)
133
+ - `hot.events` — publish, list, get, inspect event runs, and call Hot functions with `call_hot(fn, args)`
134
+ - `hot.streams` — subscribe to run streams, wait for run results, and publish events atomically (reconnects automatically across the 5-minute SSE timeout; pass `reconnect=False` to opt out)
131
135
  - `hot.runs` — list, inspect, and view run stats
132
136
  - `hot.files` — upload, download, list, and delete files (including multipart uploads)
133
137
  - `hot.projects` — create, list, update, activate, deactivate, and delete projects
@@ -142,6 +146,12 @@ except HotApiError as error:
142
146
  Use `hot.request(...)` or `hot.request_raw(...)` as an escape hatch for API
143
147
  endpoints that do not yet have a resource helper.
144
148
 
149
+ `hot.env.subscribe()` requires API key credentials and a live API pub/sub
150
+ backend; local API servers without pub/sub return a 503. `subscribe_with_event`
151
+ reconnects across the API's 5-minute SSE timeout and stops after the first
152
+ terminal `run:*` event it sees, so keep using the stream directly if your app
153
+ expects multiple independent runs on the same stream.
154
+
145
155
  ## Customizing the HTTP Client
146
156
 
147
157
  `HotClient` and `AsyncHotClient` accept an `httpx.Client` (or
@@ -59,6 +59,8 @@ with HotClient(token=os.environ["HOT_API_KEY"]) as hot:
59
59
 
60
60
  Authenticated clients should run server-side. Browser apps and public notebooks
61
61
  should call your own backend route instead of exposing a Hot API key.
62
+ Most management endpoints require an API key. Sessions and service keys are
63
+ permission-scoped and are mainly for event publishing and stream reads.
62
64
 
63
65
  ## Async Usage
64
66
 
@@ -90,6 +92,8 @@ async with AsyncHotClient(token=os.environ["HOT_API_KEY"]) as hot:
90
92
  print(event["type"], event)
91
93
  ```
92
94
 
95
+ `AsyncHotClient` exposes the same resource namespaces as `HotClient`.
96
+
93
97
  ## Errors
94
98
 
95
99
  Non-2xx API responses raise `HotApiError` with structured fields:
@@ -100,15 +104,15 @@ from hot import HotApiError
100
104
  try:
101
105
  hot.projects.get("missing-project")
102
106
  except HotApiError as error:
103
- print(error.status_code, error.code, error.request_id)
107
+ print(error.status_code, error.code, error.request_id, error.retry_after)
104
108
  ```
105
109
 
106
110
  ## Resources
107
111
 
108
112
  `HotClient` mirrors the Hot API v1 resources:
109
113
 
110
- - `hot.events` — publish, list, get, and inspect event runs
111
- - `hot.streams` — subscribe to run streams and publish events atomically (reconnects automatically across the 5-minute SSE timeout; pass `reconnect=False` to opt out)
114
+ - `hot.events` — publish, list, get, inspect event runs, and call Hot functions with `call_hot(fn, args)`
115
+ - `hot.streams` — subscribe to run streams, wait for run results, and publish events atomically (reconnects automatically across the 5-minute SSE timeout; pass `reconnect=False` to opt out)
112
116
  - `hot.runs` — list, inspect, and view run stats
113
117
  - `hot.files` — upload, download, list, and delete files (including multipart uploads)
114
118
  - `hot.projects` — create, list, update, activate, deactivate, and delete projects
@@ -123,6 +127,12 @@ except HotApiError as error:
123
127
  Use `hot.request(...)` or `hot.request_raw(...)` as an escape hatch for API
124
128
  endpoints that do not yet have a resource helper.
125
129
 
130
+ `hot.env.subscribe()` requires API key credentials and a live API pub/sub
131
+ backend; local API servers without pub/sub return a 503. `subscribe_with_event`
132
+ reconnects across the API's 5-minute SSE timeout and stops after the first
133
+ terminal `run:*` event it sees, so keep using the stream directly if your app
134
+ expects multiple independent runs on the same stream.
135
+
126
136
  ## Customizing the HTTP Client
127
137
 
128
138
  `HotClient` and `AsyncHotClient` accept an `httpx.Client` (or
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "hot-dev"
7
- version = "1.1.1"
7
+ version = "1.1.2"
8
8
  description = "Python SDK for the Hot Dev API"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -7,7 +7,17 @@ import httpx
7
7
 
8
8
  from ._transport import AsyncTransport, SyncTransport
9
9
  from .resources import (
10
+ AsyncBuildsResource,
11
+ AsyncContextResource,
12
+ AsyncDomainsResource,
13
+ AsyncEnvResource,
10
14
  AsyncEventsResource,
15
+ AsyncFilesResource,
16
+ AsyncOrgResource,
17
+ AsyncProjectsResource,
18
+ AsyncRunsResource,
19
+ AsyncServiceKeysResource,
20
+ AsyncSessionsResource,
11
21
  AsyncStreamsResource,
12
22
  BuildsResource,
13
23
  ContextResource,
@@ -93,11 +103,7 @@ class HotClient:
93
103
 
94
104
 
95
105
  class AsyncHotClient:
96
- """Asynchronous Hot API client.
97
-
98
- Async support currently focuses on event publishing and stream consumption,
99
- where async is most valuable.
100
- """
106
+ """Asynchronous Hot API client."""
101
107
 
102
108
  def __init__(
103
109
  self,
@@ -113,7 +119,17 @@ class AsyncHotClient:
113
119
  timeout=timeout,
114
120
  client=client,
115
121
  )
122
+ self.builds = AsyncBuildsResource(self._transport)
123
+ self.context = AsyncContextResource(self._transport)
124
+ self.domains = AsyncDomainsResource(self._transport)
125
+ self.env = AsyncEnvResource(self._transport)
116
126
  self.events = AsyncEventsResource(self._transport)
127
+ self.files = AsyncFilesResource(self._transport)
128
+ self.org = AsyncOrgResource(self._transport)
129
+ self.projects = AsyncProjectsResource(self._transport)
130
+ self.runs = AsyncRunsResource(self._transport)
131
+ self.service_keys = AsyncServiceKeysResource(self._transport)
132
+ self.sessions = AsyncSessionsResource(self._transport)
117
133
  self.streams = AsyncStreamsResource(self._transport)
118
134
 
119
135
  @property
@@ -13,6 +13,7 @@ class HotApiError(Exception):
13
13
  message: str,
14
14
  code: str | None = None,
15
15
  request_id: str | None = None,
16
+ retry_after: int | None = None,
16
17
  headers: dict[str, str] | None = None,
17
18
  error: dict[str, Any] | None = None,
18
19
  ) -> None:
@@ -21,6 +22,7 @@ class HotApiError(Exception):
21
22
  self.message = message
22
23
  self.code = code
23
24
  self.request_id = request_id
25
+ self.retry_after = retry_after
24
26
  self.headers = headers or {}
25
27
  self.error = error
26
28
 
@@ -38,11 +40,13 @@ def parse_api_error(status_code: int, text: str, headers: dict[str, str]) -> Hot
38
40
  message = str(error.get("message") or f"Hot API error ({status_code})")
39
41
  code = str(error["code"]) if error.get("code") is not None else None
40
42
  request_id = str(error["request_id"]) if error.get("request_id") is not None else None
43
+ retry_after = _retry_after(error.get("retry_after"), headers)
41
44
  return HotApiError(
42
45
  status_code=status_code,
43
46
  message=message,
44
47
  code=code,
45
48
  request_id=request_id,
49
+ retry_after=retry_after,
46
50
  headers=headers,
47
51
  error=error,
48
52
  )
@@ -50,5 +54,18 @@ def parse_api_error(status_code: int, text: str, headers: dict[str, str]) -> Hot
50
54
  return HotApiError(
51
55
  status_code=status_code,
52
56
  message=text or f"Hot API error ({status_code})",
57
+ retry_after=_retry_after(None, headers),
53
58
  headers=headers,
54
59
  )
60
+
61
+
62
+ def _retry_after(value: Any, headers: dict[str, str]) -> int | None:
63
+ if isinstance(value, int):
64
+ return value
65
+ header_value = headers.get("retry-after") or headers.get("Retry-After")
66
+ if not header_value:
67
+ return None
68
+ try:
69
+ return int(header_value)
70
+ except ValueError:
71
+ return None
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import asyncio
4
4
  import time
5
- from collections.abc import AsyncIterator, Iterator, Mapping
5
+ from collections.abc import AsyncIterator, Callable, Iterator, Mapping
6
6
  from typing import Any
7
7
  from urllib.parse import quote
8
8
 
@@ -30,6 +30,49 @@ def _run_id_of(event: Any) -> str | None:
30
30
  return None
31
31
 
32
32
 
33
+ def _event_id_of_run(run: Any) -> str | None:
34
+ if not isinstance(run, dict):
35
+ return None
36
+ event_id = run.get("event_id")
37
+ return event_id if isinstance(event_id, str) else None
38
+
39
+
40
+ def _result_message(value: Any) -> str | None:
41
+ if isinstance(value, str) and value:
42
+ return value
43
+ if not isinstance(value, dict):
44
+ return None
45
+ for key in ("$err", "error", "message", "reason"):
46
+ message = _result_message(value.get(key))
47
+ if message:
48
+ return message
49
+ return None
50
+
51
+
52
+ def _run_result_message(run: Mapping[str, Any], fallback: str) -> str:
53
+ message = _result_message(run.get("result"))
54
+ if message:
55
+ return message
56
+ status = run.get("status")
57
+ return f"{fallback} ({status})" if isinstance(status, str) and status else fallback
58
+
59
+
60
+ def _extract_run_result(result: Any) -> Any:
61
+ if isinstance(result, dict) and "$ok" in result:
62
+ return result["$ok"]
63
+ return result
64
+
65
+
66
+ def _emit_chunk(event: StreamEvent, on_chunk: Callable[[str], None] | None) -> None:
67
+ if not on_chunk or event.get("type") != "stream:data":
68
+ return
69
+ payload = event.get("payload")
70
+ if isinstance(payload, dict):
71
+ text = payload.get("text")
72
+ if isinstance(text, str):
73
+ on_chunk(text)
74
+
75
+
33
76
  class EventsResource:
34
77
  def __init__(self, transport: SyncTransport) -> None:
35
78
  self._transport = transport
@@ -37,6 +80,32 @@ class EventsResource:
37
80
  def publish(self, body: Mapping[str, Any]) -> dict[str, Any]:
38
81
  return self._transport.request_json("POST", "/events", json=dict(body))["data"]
39
82
 
83
+ def call_hot(
84
+ self,
85
+ fn: str,
86
+ args: list[Any] | None = None,
87
+ *,
88
+ timeout: float = 60.0,
89
+ on_chunk: Callable[[str], None] | None = None,
90
+ ) -> Any:
91
+ published = self.publish(
92
+ {
93
+ "event_type": "hot:call",
94
+ "event_data": {
95
+ "fn": fn,
96
+ "args": args or [],
97
+ },
98
+ }
99
+ )
100
+ run = wait_for_run_result(
101
+ self._transport,
102
+ published["stream_id"],
103
+ published["event_id"],
104
+ timeout=timeout,
105
+ on_chunk=on_chunk,
106
+ )
107
+ return _extract_run_result(run.get("result"))
108
+
40
109
  def list(self, **query: Any) -> dict[str, Any]:
41
110
  return self._transport.request_json("GET", "/events", params=query)
42
111
 
@@ -105,6 +174,22 @@ class StreamsResource:
105
174
  params={"project": project},
106
175
  )
107
176
 
177
+ def wait_for_run_result(
178
+ self,
179
+ stream_id: str,
180
+ event_id: str,
181
+ *,
182
+ timeout: float = 60.0,
183
+ on_chunk: Callable[[str], None] | None = None,
184
+ ) -> dict[str, Any]:
185
+ return wait_for_run_result(
186
+ self._transport,
187
+ stream_id,
188
+ event_id,
189
+ timeout=timeout,
190
+ on_chunk=on_chunk,
191
+ )
192
+
108
193
  def subscribe_with_event(
109
194
  self,
110
195
  body: Mapping[str, Any],
@@ -471,6 +556,80 @@ def iter_stream(
471
556
  yield from events
472
557
 
473
558
 
559
+ def wait_for_run_result(
560
+ transport: SyncTransport,
561
+ stream_id: str,
562
+ event_id: str,
563
+ *,
564
+ timeout: float = 60.0,
565
+ on_chunk: Callable[[str], None] | None = None,
566
+ ) -> dict[str, Any]:
567
+ deadline = time.monotonic() + timeout
568
+ current_run_id: str | None = None
569
+
570
+ for event in iter_stream(transport, "GET", f"/streams/{enc(stream_id)}/subscribe"):
571
+ if time.monotonic() > deadline:
572
+ raise TimeoutError("Timeout waiting for run result")
573
+
574
+ if event.get("type") == "run:start":
575
+ run = event.get("run")
576
+ if _event_id_of_run(run) == event_id:
577
+ current_run_id = _run_id_of(event)
578
+
579
+ if current_run_id and event.get("type") == "stream:data":
580
+ if event.get("run_id") == current_run_id:
581
+ _emit_chunk(event, on_chunk)
582
+
583
+ if event.get("type") in ("run:stop", "run:fail", "run:cancel"):
584
+ run = event.get("run")
585
+ if not isinstance(run, dict) or _event_id_of_run(run) != event_id:
586
+ continue
587
+ if event.get("type") == "run:fail":
588
+ raise RuntimeError(_run_result_message(run, "Run failed"))
589
+ if event.get("type") == "run:cancel":
590
+ raise RuntimeError(_run_result_message(run, "Run cancelled"))
591
+ return run
592
+
593
+ raise RuntimeError("Stream ended before run completed")
594
+
595
+
596
+ async def async_wait_for_run_result(
597
+ transport: AsyncTransport,
598
+ stream_id: str,
599
+ event_id: str,
600
+ *,
601
+ timeout: float = 60.0,
602
+ on_chunk: Callable[[str], None] | None = None,
603
+ ) -> dict[str, Any]:
604
+ deadline = time.monotonic() + timeout
605
+ current_run_id: str | None = None
606
+
607
+ async for event in aiter_stream(transport, "GET", f"/streams/{enc(stream_id)}/subscribe"):
608
+ if time.monotonic() > deadline:
609
+ raise TimeoutError("Timeout waiting for run result")
610
+
611
+ if event.get("type") == "run:start":
612
+ run = event.get("run")
613
+ if _event_id_of_run(run) == event_id:
614
+ current_run_id = _run_id_of(event)
615
+
616
+ if current_run_id and event.get("type") == "stream:data":
617
+ if event.get("run_id") == current_run_id:
618
+ _emit_chunk(event, on_chunk)
619
+
620
+ if event.get("type") in ("run:stop", "run:fail", "run:cancel"):
621
+ run = event.get("run")
622
+ if not isinstance(run, dict) or _event_id_of_run(run) != event_id:
623
+ continue
624
+ if event.get("type") == "run:fail":
625
+ raise RuntimeError(_run_result_message(run, "Run failed"))
626
+ if event.get("type") == "run:cancel":
627
+ raise RuntimeError(_run_result_message(run, "Run cancelled"))
628
+ return run
629
+
630
+ raise RuntimeError("Stream ended before run completed")
631
+
632
+
474
633
  class AsyncEventsResource:
475
634
  def __init__(self, transport: AsyncTransport) -> None:
476
635
  self._transport = transport
@@ -478,6 +637,32 @@ class AsyncEventsResource:
478
637
  async def publish(self, body: Mapping[str, Any]) -> dict[str, Any]:
479
638
  return (await self._transport.request_json("POST", "/events", json=dict(body)))["data"]
480
639
 
640
+ async def call_hot(
641
+ self,
642
+ fn: str,
643
+ args: list[Any] | None = None,
644
+ *,
645
+ timeout: float = 60.0,
646
+ on_chunk: Callable[[str], None] | None = None,
647
+ ) -> Any:
648
+ published = await self.publish(
649
+ {
650
+ "event_type": "hot:call",
651
+ "event_data": {
652
+ "fn": fn,
653
+ "args": args or [],
654
+ },
655
+ }
656
+ )
657
+ run = await async_wait_for_run_result(
658
+ self._transport,
659
+ published["stream_id"],
660
+ published["event_id"],
661
+ timeout=timeout,
662
+ on_chunk=on_chunk,
663
+ )
664
+ return _extract_run_result(run.get("result"))
665
+
481
666
  async def list(self, **query: Any) -> dict[str, Any]:
482
667
  return await self._transport.request_json("GET", "/events", params=query)
483
668
 
@@ -488,6 +673,40 @@ class AsyncEventsResource:
488
673
  return await self._transport.request_json("GET", f"/events/{enc(event_id)}/runs")
489
674
 
490
675
 
676
+ class AsyncRunsResource:
677
+ def __init__(self, transport: AsyncTransport) -> None:
678
+ self._transport = transport
679
+
680
+ async def list(self, **query: Any) -> dict[str, Any]:
681
+ return await self._transport.request_json("GET", "/runs", params=query)
682
+
683
+ async def stats(self) -> dict[str, Any]:
684
+ return (await self._transport.request_json("GET", "/runs/stats"))["data"]
685
+
686
+ async def get(self, run_id: str) -> dict[str, Any]:
687
+ return (await self._transport.request_json("GET", f"/runs/{enc(run_id)}"))["data"]
688
+
689
+
690
+ class AsyncEnvResource:
691
+ def __init__(self, transport: AsyncTransport) -> None:
692
+ self._transport = transport
693
+
694
+ async def get(self) -> dict[str, Any]:
695
+ return (await self._transport.request_json("GET", "/env"))["data"]
696
+
697
+ async def subscribe(self) -> AsyncIterator[StreamEvent]:
698
+ async for event in aiter_stream(self._transport, "GET", "/env/subscribe"):
699
+ yield event
700
+
701
+
702
+ class AsyncOrgResource:
703
+ def __init__(self, transport: AsyncTransport) -> None:
704
+ self._transport = transport
705
+
706
+ async def usage(self) -> dict[str, Any]:
707
+ return (await self._transport.request_json("GET", "/org/usage"))["data"]
708
+
709
+
491
710
  class AsyncStreamsResource:
492
711
  def __init__(self, transport: AsyncTransport) -> None:
493
712
  self._transport = transport
@@ -506,6 +725,36 @@ class AsyncStreamsResource:
506
725
  ):
507
726
  yield event
508
727
 
728
+ async def subscribe_post(
729
+ self,
730
+ stream_id: str,
731
+ *,
732
+ project: str | None = None,
733
+ ) -> AsyncIterator[StreamEvent]:
734
+ async for event in aiter_stream(
735
+ self._transport,
736
+ "POST",
737
+ f"/streams/{enc(stream_id)}/subscribe",
738
+ params={"project": project},
739
+ ):
740
+ yield event
741
+
742
+ async def wait_for_run_result(
743
+ self,
744
+ stream_id: str,
745
+ event_id: str,
746
+ *,
747
+ timeout: float = 60.0,
748
+ on_chunk: Callable[[str], None] | None = None,
749
+ ) -> dict[str, Any]:
750
+ return await async_wait_for_run_result(
751
+ self._transport,
752
+ stream_id,
753
+ event_id,
754
+ timeout=timeout,
755
+ on_chunk=on_chunk,
756
+ )
757
+
509
758
  async def subscribe_with_event(
510
759
  self,
511
760
  body: Mapping[str, Any],
@@ -585,6 +834,294 @@ class AsyncStreamsResource:
585
834
  yield event
586
835
 
587
836
 
837
+ class AsyncFilesResource:
838
+ def __init__(self, transport: AsyncTransport) -> None:
839
+ self._transport = transport
840
+
841
+ async def list(self, **query: Any) -> dict[str, Any]:
842
+ return await self._transport.request_json("GET", "/files", params=query)
843
+
844
+ async def get(self, file_id: str) -> dict[str, Any]:
845
+ return (await self._transport.request_json("GET", f"/files/{enc(file_id)}"))["data"]
846
+
847
+ async def delete(self, file_id: str) -> None:
848
+ await self._transport.request_raw("DELETE", f"/files/{enc(file_id)}")
849
+
850
+ async def download(self, file_id: str):
851
+ return await self._transport.request_raw("GET", f"/files/{enc(file_id)}/download")
852
+
853
+ async def upload(
854
+ self,
855
+ path: str,
856
+ content: bytes | str,
857
+ *,
858
+ content_type: str | None = None,
859
+ ) -> dict[str, Any]:
860
+ response = await self._transport.request_raw(
861
+ "PUT",
862
+ f"/files/upload/{enc_path(path)}",
863
+ content=content,
864
+ headers={
865
+ "Accept": "application/json",
866
+ **({"Content-Type": content_type} if content_type else {}),
867
+ },
868
+ )
869
+ return response.json()["data"]
870
+
871
+ async def initiate_upload(self, body: Mapping[str, Any]) -> dict[str, Any]:
872
+ return (await self._transport.request_json("POST", "/files/uploads", json=dict(body)))[
873
+ "data"
874
+ ]
875
+
876
+ async def upload_part(
877
+ self,
878
+ upload_id: str,
879
+ part_number: int,
880
+ content: bytes | str,
881
+ ) -> dict[str, Any]:
882
+ response = await self._transport.request_raw(
883
+ "PUT",
884
+ f"/files/uploads/{enc(upload_id)}/{part_number}",
885
+ content=content,
886
+ headers={"Accept": "application/json"},
887
+ )
888
+ return response.json()["data"]
889
+
890
+ async def complete_upload(self, upload_id: str) -> dict[str, Any]:
891
+ return (
892
+ await self._transport.request_json(
893
+ "POST",
894
+ f"/files/uploads/{enc(upload_id)}/complete",
895
+ )
896
+ )["data"]
897
+
898
+ async def abort_upload(self, upload_id: str) -> None:
899
+ await self._transport.request_raw("DELETE", f"/files/uploads/{enc(upload_id)}")
900
+
901
+
902
+ class AsyncProjectsResource:
903
+ def __init__(self, transport: AsyncTransport) -> None:
904
+ self._transport = transport
905
+
906
+ async def list(self, **query: Any) -> dict[str, Any]:
907
+ return await self._transport.request_json("GET", "/projects", params=query)
908
+
909
+ async def create(self, body: Mapping[str, Any]) -> dict[str, Any]:
910
+ return (await self._transport.request_json("POST", "/projects", json=dict(body)))["data"]
911
+
912
+ async def get(self, project: str) -> dict[str, Any]:
913
+ return (await self._transport.request_json("GET", f"/projects/{enc(project)}"))["data"]
914
+
915
+ async def update(self, project: str, body: Mapping[str, Any]) -> dict[str, Any]:
916
+ return (
917
+ await self._transport.request_json(
918
+ "PATCH",
919
+ f"/projects/{enc(project)}",
920
+ json=dict(body),
921
+ )
922
+ )["data"]
923
+
924
+ async def delete(self, project: str) -> None:
925
+ await self._transport.request_raw("DELETE", f"/projects/{enc(project)}")
926
+
927
+ async def activate(self, project: str) -> dict[str, Any]:
928
+ return (
929
+ await self._transport.request_json("POST", f"/projects/{enc(project)}/activate")
930
+ )["data"]
931
+
932
+ async def deactivate(self, project: str) -> dict[str, Any]:
933
+ return (
934
+ await self._transport.request_json("POST", f"/projects/{enc(project)}/deactivate")
935
+ )["data"]
936
+
937
+ async def event_handlers(self, project: str) -> dict[str, Any]:
938
+ return await self._transport.request_json(
939
+ "GET",
940
+ f"/projects/{enc(project)}/event-handlers",
941
+ )
942
+
943
+ async def schedules(self, project: str) -> dict[str, Any]:
944
+ return await self._transport.request_json(
945
+ "GET",
946
+ f"/projects/{enc(project)}/schedules",
947
+ )
948
+
949
+
950
+ class AsyncBuildsResource:
951
+ def __init__(self, transport: AsyncTransport) -> None:
952
+ self._transport = transport
953
+
954
+ async def list(self, **query: Any) -> dict[str, Any]:
955
+ return await self._transport.request_json("GET", "/builds", params=query)
956
+
957
+ async def list_for_project(self, project: str, **query: Any) -> dict[str, Any]:
958
+ return await self._transport.request_json(
959
+ "GET",
960
+ f"/projects/{enc(project)}/builds",
961
+ params=query,
962
+ )
963
+
964
+ async def get(self, project: str, build_id: str) -> dict[str, Any]:
965
+ return (
966
+ await self._transport.request_json(
967
+ "GET",
968
+ f"/projects/{enc(project)}/builds/{enc(build_id)}",
969
+ )
970
+ )["data"]
971
+
972
+ async def deployed(self, project: str) -> dict[str, Any]:
973
+ return (
974
+ await self._transport.request_json(
975
+ "GET",
976
+ f"/projects/{enc(project)}/builds/deployed",
977
+ )
978
+ )["data"]
979
+
980
+ async def live(self, project: str) -> dict[str, Any]:
981
+ return (
982
+ await self._transport.request_json("GET", f"/projects/{enc(project)}/builds/live")
983
+ )["data"]
984
+
985
+ async def upload(
986
+ self,
987
+ project: str,
988
+ *,
989
+ file: Any,
990
+ hash: str,
991
+ build_id: str | None = None,
992
+ ) -> dict[str, Any]:
993
+ data = {"hash": hash, **({"build_id": build_id} if build_id else {})}
994
+ response = await self._transport.request_raw(
995
+ "POST",
996
+ f"/projects/{enc(project)}/builds",
997
+ data=data,
998
+ files={"file": file},
999
+ headers={"Accept": "application/json"},
1000
+ )
1001
+ return response.json()["data"]
1002
+
1003
+ async def download(self, project: str, build_id: str):
1004
+ return await self._transport.request_raw(
1005
+ "GET",
1006
+ f"/projects/{enc(project)}/builds/{enc(build_id)}/download",
1007
+ )
1008
+
1009
+ async def deploy(self, project: str, build_id: str) -> dict[str, Any]:
1010
+ return (
1011
+ await self._transport.request_json(
1012
+ "POST",
1013
+ f"/projects/{enc(project)}/builds/{enc(build_id)}/deploy",
1014
+ )
1015
+ )["data"]
1016
+
1017
+
1018
+ class AsyncContextResource:
1019
+ def __init__(self, transport: AsyncTransport) -> None:
1020
+ self._transport = transport
1021
+
1022
+ async def list(self, project: str) -> dict[str, Any]:
1023
+ return await self._transport.request_json("GET", f"/projects/{enc(project)}/context")
1024
+
1025
+ async def create(self, project: str, body: Mapping[str, Any]) -> dict[str, Any]:
1026
+ return (
1027
+ await self._transport.request_json(
1028
+ "POST",
1029
+ f"/projects/{enc(project)}/context",
1030
+ json=dict(body),
1031
+ )
1032
+ )["data"]
1033
+
1034
+ async def update(self, project: str, key: str, body: Mapping[str, Any]) -> dict[str, Any]:
1035
+ return (
1036
+ await self._transport.request_json(
1037
+ "PUT",
1038
+ f"/projects/{enc(project)}/context/{enc(key)}",
1039
+ json=dict(body),
1040
+ )
1041
+ )["data"]
1042
+
1043
+ async def delete(self, project: str, key: str) -> None:
1044
+ await self._transport.request_raw(
1045
+ "DELETE",
1046
+ f"/projects/{enc(project)}/context/{enc(key)}",
1047
+ )
1048
+
1049
+
1050
+ class AsyncDomainsResource:
1051
+ def __init__(self, transport: AsyncTransport) -> None:
1052
+ self._transport = transport
1053
+
1054
+ async def create(self, body: Mapping[str, Any]) -> dict[str, Any]:
1055
+ return (await self._transport.request_json("POST", "/domains", json=dict(body)))["data"]
1056
+
1057
+ async def list(self) -> dict[str, Any]:
1058
+ return await self._transport.request_json("GET", "/domains")
1059
+
1060
+ async def get(self, domain_id: str) -> dict[str, Any]:
1061
+ return (await self._transport.request_json("GET", f"/domains/{enc(domain_id)}"))["data"]
1062
+
1063
+ async def delete(self, domain_id: str) -> None:
1064
+ await self._transport.request_raw("DELETE", f"/domains/{enc(domain_id)}")
1065
+
1066
+ async def verify(self, domain_id: str) -> dict[str, Any]:
1067
+ return (
1068
+ await self._transport.request_json("POST", f"/domains/{enc(domain_id)}/verify")
1069
+ )["data"]
1070
+
1071
+
1072
+ class AsyncSessionsResource:
1073
+ def __init__(self, transport: AsyncTransport) -> None:
1074
+ self._transport = transport
1075
+
1076
+ async def create(self, body: Mapping[str, Any]) -> dict[str, Any]:
1077
+ return (await self._transport.request_json("POST", "/sessions", json=dict(body)))["data"]
1078
+
1079
+ async def list(self, **query: Any) -> dict[str, Any]:
1080
+ return await self._transport.request_json("GET", "/sessions", params=query)
1081
+
1082
+ async def revoke(self, session_id: str) -> None:
1083
+ await self._transport.request_raw("DELETE", f"/sessions/{enc(session_id)}")
1084
+
1085
+ async def revoke_all(self) -> dict[str, Any]:
1086
+ return (await self._transport.request_json("DELETE", "/sessions"))["data"]
1087
+
1088
+
1089
+ class AsyncServiceKeysResource:
1090
+ def __init__(self, transport: AsyncTransport) -> None:
1091
+ self._transport = transport
1092
+
1093
+ async def create(self, body: Mapping[str, Any]) -> dict[str, Any]:
1094
+ return (
1095
+ await self._transport.request_json("POST", "/service-keys", json=dict(body))
1096
+ )["data"]
1097
+
1098
+ async def list(self, **query: Any) -> dict[str, Any]:
1099
+ return await self._transport.request_json("GET", "/service-keys", params=query)
1100
+
1101
+ async def get(self, service_key_id: str) -> dict[str, Any]:
1102
+ return (
1103
+ await self._transport.request_json(
1104
+ "GET",
1105
+ f"/service-keys/{enc(service_key_id)}",
1106
+ )
1107
+ )["data"]
1108
+
1109
+ async def update(self, service_key_id: str, body: Mapping[str, Any]) -> dict[str, Any]:
1110
+ return (
1111
+ await self._transport.request_json(
1112
+ "PATCH",
1113
+ f"/service-keys/{enc(service_key_id)}",
1114
+ json=dict(body),
1115
+ )
1116
+ )["data"]
1117
+
1118
+ async def revoke(self, service_key_id: str) -> None:
1119
+ await self._transport.request_raw("DELETE", f"/service-keys/{enc(service_key_id)}")
1120
+
1121
+ async def revoke_all(self) -> dict[str, Any]:
1122
+ return (await self._transport.request_json("DELETE", "/service-keys"))["data"]
1123
+
1124
+
588
1125
  async def aiter_stream(
589
1126
  transport: AsyncTransport,
590
1127
  method: str,
@@ -0,0 +1,61 @@
1
+ [
2
+ { "method": "GET", "path": "/status" },
3
+ { "method": "GET", "path": "/v1/projects" },
4
+ { "method": "POST", "path": "/v1/projects" },
5
+ { "method": "GET", "path": "/v1/projects/{project_id_or_slug}" },
6
+ { "method": "PATCH", "path": "/v1/projects/{project_id_or_slug}" },
7
+ { "method": "DELETE", "path": "/v1/projects/{project_id_or_slug}" },
8
+ { "method": "POST", "path": "/v1/projects/{project_id_or_slug}/activate" },
9
+ { "method": "POST", "path": "/v1/projects/{project_id_or_slug}/deactivate" },
10
+ { "method": "GET", "path": "/v1/builds" },
11
+ { "method": "GET", "path": "/v1/projects/{project_id_or_slug}/builds" },
12
+ { "method": "POST", "path": "/v1/projects/{project_id_or_slug}/builds" },
13
+ { "method": "GET", "path": "/v1/projects/{project_id_or_slug}/builds/deployed" },
14
+ { "method": "GET", "path": "/v1/projects/{project_id_or_slug}/builds/live" },
15
+ { "method": "GET", "path": "/v1/projects/{project_id_or_slug}/builds/{build_id}" },
16
+ { "method": "GET", "path": "/v1/projects/{project_id_or_slug}/builds/{build_id}/download" },
17
+ { "method": "POST", "path": "/v1/projects/{project_id_or_slug}/builds/{build_id}/deploy" },
18
+ { "method": "GET", "path": "/v1/projects/{project_id_or_slug}/context" },
19
+ { "method": "POST", "path": "/v1/projects/{project_id_or_slug}/context" },
20
+ { "method": "PUT", "path": "/v1/projects/{project_id_or_slug}/context/{key}" },
21
+ { "method": "DELETE", "path": "/v1/projects/{project_id_or_slug}/context/{key}" },
22
+ { "method": "GET", "path": "/v1/runs" },
23
+ { "method": "GET", "path": "/v1/runs/stats" },
24
+ { "method": "GET", "path": "/v1/runs/{run_id}" },
25
+ { "method": "POST", "path": "/v1/events" },
26
+ { "method": "GET", "path": "/v1/events" },
27
+ { "method": "GET", "path": "/v1/events/{event_id}" },
28
+ { "method": "GET", "path": "/v1/events/{event_id}/runs" },
29
+ { "method": "GET", "path": "/v1/projects/{project_id_or_slug}/event-handlers" },
30
+ { "method": "GET", "path": "/v1/projects/{project_id_or_slug}/schedules" },
31
+ { "method": "POST", "path": "/v1/sessions" },
32
+ { "method": "GET", "path": "/v1/sessions" },
33
+ { "method": "DELETE", "path": "/v1/sessions" },
34
+ { "method": "DELETE", "path": "/v1/sessions/{session_id}" },
35
+ { "method": "POST", "path": "/v1/service-keys" },
36
+ { "method": "GET", "path": "/v1/service-keys" },
37
+ { "method": "DELETE", "path": "/v1/service-keys" },
38
+ { "method": "GET", "path": "/v1/service-keys/{service_key_id}" },
39
+ { "method": "PATCH", "path": "/v1/service-keys/{service_key_id}" },
40
+ { "method": "DELETE", "path": "/v1/service-keys/{service_key_id}" },
41
+ { "method": "POST", "path": "/v1/domains" },
42
+ { "method": "GET", "path": "/v1/domains" },
43
+ { "method": "GET", "path": "/v1/domains/{domain_id}" },
44
+ { "method": "DELETE", "path": "/v1/domains/{domain_id}" },
45
+ { "method": "POST", "path": "/v1/domains/{domain_id}/verify" },
46
+ { "method": "GET", "path": "/v1/env" },
47
+ { "method": "GET", "path": "/v1/env/subscribe" },
48
+ { "method": "GET", "path": "/v1/org/usage" },
49
+ { "method": "GET", "path": "/v1/streams/{stream_id}/subscribe" },
50
+ { "method": "POST", "path": "/v1/streams/{stream_id}/subscribe" },
51
+ { "method": "POST", "path": "/v1/streams/subscribe-with-event" },
52
+ { "method": "GET", "path": "/v1/files" },
53
+ { "method": "GET", "path": "/v1/files/{file_id}" },
54
+ { "method": "DELETE", "path": "/v1/files/{file_id}" },
55
+ { "method": "GET", "path": "/v1/files/{file_id}/download" },
56
+ { "method": "PUT", "path": "/v1/files/upload/{path}" },
57
+ { "method": "POST", "path": "/v1/files/uploads" },
58
+ { "method": "PUT", "path": "/v1/files/uploads/{upload_id}/{part_number}" },
59
+ { "method": "POST", "path": "/v1/files/uploads/{upload_id}/complete" },
60
+ { "method": "DELETE", "path": "/v1/files/uploads/{upload_id}" }
61
+ ]
@@ -5,7 +5,7 @@ import json
5
5
  import httpx
6
6
  import pytest
7
7
 
8
- from hot import HotApiError, HotClient
8
+ from hot import AsyncHotClient, HotApiError, HotClient
9
9
 
10
10
 
11
11
  def make_client(handler):
@@ -13,6 +13,11 @@ def make_client(handler):
13
13
  return HotClient(token="test-token", base_url="https://api.example.test", client=client)
14
14
 
15
15
 
16
+ def make_async_client(handler):
17
+ client = httpx.AsyncClient(transport=httpx.MockTransport(handler))
18
+ return AsyncHotClient(token="test-token", base_url="https://api.example.test", client=client)
19
+
20
+
16
21
  def envelope(data):
17
22
  return {"data": data, "meta": {"request_id": "req_123", "timestamp": "now"}}
18
23
 
@@ -101,8 +106,10 @@ def test_api_error_is_structured():
101
106
  "code": "unauthorized",
102
107
  "message": "Bad token",
103
108
  "request_id": "req_123",
109
+ "retry_after": 5,
104
110
  }
105
111
  },
112
+ headers={"Retry-After": "5"},
106
113
  )
107
114
 
108
115
  with make_client(handler) as hot:
@@ -112,3 +119,50 @@ def test_api_error_is_structured():
112
119
  assert exc.value.status_code == 401
113
120
  assert exc.value.code == "unauthorized"
114
121
  assert exc.value.request_id == "req_123"
122
+ assert exc.value.retry_after == 5
123
+
124
+ def test_call_hot_uses_nested_run_failure_result():
125
+ responses = iter(
126
+ [
127
+ httpx.Response(
128
+ 200,
129
+ json=envelope(
130
+ {
131
+ "event_id": "evt_123",
132
+ "stream_id": "str_123",
133
+ }
134
+ ),
135
+ ),
136
+ httpx.Response(
137
+ 200,
138
+ content=(
139
+ 'data: {"type":"run:start","run":{"run_id":"run_123",'
140
+ '"event_id":"evt_123"}}\n\n'
141
+ 'data: {"type":"run:fail","run":{"run_id":"run_123",'
142
+ '"event_id":"evt_123","status":"failed",'
143
+ '"result":{"$err":{"message":"boom"}}}}\n\n'
144
+ ),
145
+ headers={"content-type": "text/event-stream"},
146
+ ),
147
+ ]
148
+ )
149
+
150
+ def handler(request: httpx.Request) -> httpx.Response:
151
+ return next(responses)
152
+
153
+ with make_client(handler) as hot:
154
+ with pytest.raises(RuntimeError, match="boom"):
155
+ hot.events.call_hot("demo/fn")
156
+
157
+
158
+ def test_async_client_exposes_core_resources():
159
+ async def run():
160
+ async with make_async_client(lambda request: httpx.Response(200, json=envelope({}))) as hot:
161
+ assert hot.projects is not None
162
+ assert hot.files is not None
163
+ assert hot.env is not None
164
+ assert hot.streams is not None
165
+
166
+ import asyncio
167
+
168
+ asyncio.run(run())
@@ -0,0 +1,110 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from pathlib import Path
5
+ from typing import Any
6
+
7
+ from hot import HotClient
8
+
9
+ OPERATIONS_PATH = Path(__file__).with_name("openapi_operations.json")
10
+
11
+ COVERAGE: dict[str, dict[str, str | bool]] = {
12
+ "GET /status": {
13
+ "ignored": True,
14
+ "reason": "Public health endpoint, not part of authenticated SDK resources.",
15
+ },
16
+ "GET /v1/projects": {"sdk": "projects.list"},
17
+ "POST /v1/projects": {"sdk": "projects.create"},
18
+ "GET /v1/projects/{project_id_or_slug}": {"sdk": "projects.get"},
19
+ "PATCH /v1/projects/{project_id_or_slug}": {"sdk": "projects.update"},
20
+ "DELETE /v1/projects/{project_id_or_slug}": {"sdk": "projects.delete"},
21
+ "POST /v1/projects/{project_id_or_slug}/activate": {"sdk": "projects.activate"},
22
+ "POST /v1/projects/{project_id_or_slug}/deactivate": {"sdk": "projects.deactivate"},
23
+ "GET /v1/builds": {"sdk": "builds.list"},
24
+ "GET /v1/projects/{project_id_or_slug}/builds": {"sdk": "builds.list_for_project"},
25
+ "POST /v1/projects/{project_id_or_slug}/builds": {"sdk": "builds.upload"},
26
+ "GET /v1/projects/{project_id_or_slug}/builds/deployed": {"sdk": "builds.deployed"},
27
+ "GET /v1/projects/{project_id_or_slug}/builds/live": {"sdk": "builds.live"},
28
+ "GET /v1/projects/{project_id_or_slug}/builds/{build_id}": {"sdk": "builds.get"},
29
+ "GET /v1/projects/{project_id_or_slug}/builds/{build_id}/download": {
30
+ "sdk": "builds.download",
31
+ },
32
+ "POST /v1/projects/{project_id_or_slug}/builds/{build_id}/deploy": {
33
+ "sdk": "builds.deploy",
34
+ },
35
+ "GET /v1/projects/{project_id_or_slug}/context": {"sdk": "context.list"},
36
+ "POST /v1/projects/{project_id_or_slug}/context": {"sdk": "context.create"},
37
+ "PUT /v1/projects/{project_id_or_slug}/context/{key}": {"sdk": "context.update"},
38
+ "DELETE /v1/projects/{project_id_or_slug}/context/{key}": {"sdk": "context.delete"},
39
+ "GET /v1/runs": {"sdk": "runs.list"},
40
+ "GET /v1/runs/stats": {"sdk": "runs.stats"},
41
+ "GET /v1/runs/{run_id}": {"sdk": "runs.get"},
42
+ "POST /v1/events": {"sdk": "events.publish"},
43
+ "GET /v1/events": {"sdk": "events.list"},
44
+ "GET /v1/events/{event_id}": {"sdk": "events.get"},
45
+ "GET /v1/events/{event_id}/runs": {"sdk": "events.get_runs"},
46
+ "GET /v1/projects/{project_id_or_slug}/event-handlers": {
47
+ "sdk": "projects.event_handlers",
48
+ },
49
+ "GET /v1/projects/{project_id_or_slug}/schedules": {"sdk": "projects.schedules"},
50
+ "POST /v1/sessions": {"sdk": "sessions.create"},
51
+ "GET /v1/sessions": {"sdk": "sessions.list"},
52
+ "DELETE /v1/sessions": {"sdk": "sessions.revoke_all"},
53
+ "DELETE /v1/sessions/{session_id}": {"sdk": "sessions.revoke"},
54
+ "POST /v1/service-keys": {"sdk": "service_keys.create"},
55
+ "GET /v1/service-keys": {"sdk": "service_keys.list"},
56
+ "DELETE /v1/service-keys": {"sdk": "service_keys.revoke_all"},
57
+ "GET /v1/service-keys/{service_key_id}": {"sdk": "service_keys.get"},
58
+ "PATCH /v1/service-keys/{service_key_id}": {"sdk": "service_keys.update"},
59
+ "DELETE /v1/service-keys/{service_key_id}": {"sdk": "service_keys.revoke"},
60
+ "POST /v1/domains": {"sdk": "domains.create"},
61
+ "GET /v1/domains": {"sdk": "domains.list"},
62
+ "GET /v1/domains/{domain_id}": {"sdk": "domains.get"},
63
+ "DELETE /v1/domains/{domain_id}": {"sdk": "domains.delete"},
64
+ "POST /v1/domains/{domain_id}/verify": {"sdk": "domains.verify"},
65
+ "GET /v1/env": {"sdk": "env.get"},
66
+ "GET /v1/env/subscribe": {"sdk": "env.subscribe"},
67
+ "GET /v1/org/usage": {"sdk": "org.usage"},
68
+ "GET /v1/streams/{stream_id}/subscribe": {"sdk": "streams.subscribe"},
69
+ "POST /v1/streams/{stream_id}/subscribe": {"sdk": "streams.subscribe_post"},
70
+ "POST /v1/streams/subscribe-with-event": {"sdk": "streams.subscribe_with_event"},
71
+ "GET /v1/files": {"sdk": "files.list"},
72
+ "GET /v1/files/{file_id}": {"sdk": "files.get"},
73
+ "DELETE /v1/files/{file_id}": {"sdk": "files.delete"},
74
+ "GET /v1/files/{file_id}/download": {"sdk": "files.download"},
75
+ "PUT /v1/files/upload/{path}": {"sdk": "files.upload"},
76
+ "POST /v1/files/uploads": {"sdk": "files.initiate_upload"},
77
+ "PUT /v1/files/uploads/{upload_id}/{part_number}": {"sdk": "files.upload_part"},
78
+ "POST /v1/files/uploads/{upload_id}/complete": {"sdk": "files.complete_upload"},
79
+ "DELETE /v1/files/uploads/{upload_id}": {"sdk": "files.abort_upload"},
80
+ }
81
+
82
+
83
+ def test_openapi_operations_have_sdk_coverage_or_explicit_ignore():
84
+ operations = json.loads(OPERATIONS_PATH.read_text())
85
+ operation_keys = {operation_key(operation) for operation in operations}
86
+
87
+ assert set(COVERAGE) == operation_keys
88
+
89
+
90
+ def test_covered_operations_point_to_existing_sdk_methods():
91
+ with HotClient(token="test-token") as hot:
92
+ for key, entry in COVERAGE.items():
93
+ if entry.get("ignored") is True:
94
+ assert entry.get("reason"), key
95
+ continue
96
+
97
+ sdk = entry["sdk"]
98
+ assert isinstance(sdk, str)
99
+ assert callable(resolve_sdk_method(hot, sdk)), f"{key} -> hot.{sdk}"
100
+
101
+
102
+ def operation_key(operation: dict[str, Any]) -> str:
103
+ return f"{operation['method'].upper()} {operation['path']}"
104
+
105
+
106
+ def resolve_sdk_method(client: HotClient, path: str) -> Any:
107
+ value: Any = client
108
+ for part in path.split("."):
109
+ value = getattr(value, part)
110
+ return value
@@ -187,3 +187,22 @@ def test_async_subscribe_with_event_reconnects():
187
187
  ("POST", "/v1/streams/subscribe-with-event"),
188
188
  ("GET", "/v1/streams/s1/subscribe"),
189
189
  ]
190
+
191
+
192
+ def test_async_subscribe_post_uses_post_stream_endpoint():
193
+ handler, calls = make_handler(
194
+ [
195
+ _sse('data: {"type":"stream:complete","stream_id":"s1"}'),
196
+ ]
197
+ )
198
+
199
+ async def run():
200
+ async with make_async_client(handler) as hot:
201
+ events = []
202
+ async for event in hot.streams.subscribe_post("s1"):
203
+ events.append(event)
204
+ return events
205
+
206
+ events = asyncio.run(run())
207
+ assert events == [{"type": "stream:complete", "stream_id": "s1"}]
208
+ assert calls == [("POST", "/v1/streams/s1/subscribe")]
@@ -22,7 +22,7 @@ def test_core_resource_methods_route_to_expected_api_paths():
22
22
  client=httpx.Client(transport=httpx.MockTransport(handler)),
23
23
  ) as hot:
24
24
  hot.projects.create({"name": "Demo"})
25
- hot.projects.update("demo", {"display_name": "Demo"})
25
+ hot.projects.update("demo", {"name": "Demo"})
26
26
  hot.projects.activate("demo")
27
27
  hot.projects.deactivate("demo")
28
28
  hot.projects.event_handlers("demo")
@@ -36,21 +36,21 @@ def test_core_resource_methods_route_to_expected_api_paths():
36
36
  hot.context.create("demo", {"key": "MODEL", "value": "gpt"})
37
37
  hot.context.update("demo", "MODEL", {"value": "claude"})
38
38
  hot.context.delete("demo", "MODEL")
39
- hot.domains.create({"domain": "example.com", "project": "demo"})
39
+ hot.domains.create({"domain": "example.com"})
40
40
  hot.domains.list()
41
41
  hot.domains.get("dom_123")
42
42
  hot.domains.verify("dom_123")
43
43
  hot.domains.delete("dom_123")
44
- hot.sessions.create({"name": "Web"})
44
+ hot.sessions.create({"permissions": {"event:*": ["create"]}})
45
45
  hot.sessions.revoke("ses_123")
46
46
  hot.sessions.revoke_all()
47
- hot.service_keys.create({"name": "CI"})
47
+ hot.service_keys.create({"name": "CI", "permissions": {"event:*": ["create"]}})
48
48
  hot.service_keys.get("key_123")
49
- hot.service_keys.update("key_123", {"name": "Deploy"})
49
+ hot.service_keys.update("key_123", {"metadata": {"purpose": "deploy"}})
50
50
  hot.service_keys.revoke("key_123")
51
51
  hot.service_keys.revoke_all()
52
52
  hot.files.upload("notes/today.txt", b"hello")
53
- hot.files.initiate_upload({"path": "large.bin", "size": 1024})
53
+ hot.files.initiate_upload({"path": "large.bin", "expected_size": 1024})
54
54
  hot.files.upload_part("upload_123", 1, b"part")
55
55
  hot.files.complete_upload("upload_123")
56
56
  hot.files.abort_upload("upload_123")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes