disruptapi 0.2.0__py3-none-any.whl
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.
- disruptapi/__init__.py +63 -0
- disruptapi/__main__.py +6 -0
- disruptapi/_base_client.py +288 -0
- disruptapi/_client.py +117 -0
- disruptapi/_errors.py +154 -0
- disruptapi/_rate_limit.py +98 -0
- disruptapi/_version.py +1 -0
- disruptapi/cli.py +529 -0
- disruptapi/pagination.py +166 -0
- disruptapi/py.typed +0 -0
- disruptapi/resources/__init__.py +1 -0
- disruptapi/resources/_specs.py +236 -0
- disruptapi/resources/async_.py +315 -0
- disruptapi/resources/sync.py +307 -0
- disruptapi/types.py +455 -0
- disruptapi/webhooks.py +122 -0
- disruptapi-0.2.0.dist-info/METADATA +342 -0
- disruptapi-0.2.0.dist-info/RECORD +21 -0
- disruptapi-0.2.0.dist-info/WHEEL +4 -0
- disruptapi-0.2.0.dist-info/entry_points.txt +2 -0
- disruptapi-0.2.0.dist-info/licenses/LICENSE +21 -0
disruptapi/pagination.py
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"""Limit/offset pagination for ``GET /v1/signals`` and ``GET /v1/events``.
|
|
2
|
+
|
|
3
|
+
The API returns ``{"data": [...], "meta": {"total", "limit", "offset"}}``. The end is
|
|
4
|
+
reached when ``offset + len(data) >= total`` or a page is empty. Offset paging over
|
|
5
|
+
changing data can repeat an item, so the auto-iterators skip ids they have already seen.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import (
|
|
11
|
+
Any,
|
|
12
|
+
AsyncIterator,
|
|
13
|
+
Awaitable,
|
|
14
|
+
Callable,
|
|
15
|
+
Generator,
|
|
16
|
+
Generic,
|
|
17
|
+
Iterator,
|
|
18
|
+
List,
|
|
19
|
+
Optional,
|
|
20
|
+
Set,
|
|
21
|
+
TypeVar,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
from ._base_client import APIResponse
|
|
25
|
+
from ._rate_limit import RateLimitInfo
|
|
26
|
+
from .types import PageMeta
|
|
27
|
+
|
|
28
|
+
T = TypeVar("T")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class _PageBase(Generic[T]):
|
|
32
|
+
def __init__(self, response: APIResponse[Any]) -> None:
|
|
33
|
+
self.response = response
|
|
34
|
+
self.data: List[T] = list(response.data or [])
|
|
35
|
+
m = (response.body or {}).get("meta") or {} if isinstance(response.body, dict) else {}
|
|
36
|
+
self.meta: PageMeta = {
|
|
37
|
+
"total": int(m.get("total", len(self.data))),
|
|
38
|
+
"limit": int(m.get("limit", len(self.data))),
|
|
39
|
+
"offset": int(m.get("offset", 0)),
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def rate_limit(self) -> RateLimitInfo:
|
|
44
|
+
return self.response.rate_limit
|
|
45
|
+
|
|
46
|
+
def has_next_page(self) -> bool:
|
|
47
|
+
return bool(self.data) and self.meta["offset"] + len(self.data) < self.meta["total"]
|
|
48
|
+
|
|
49
|
+
def _next_offset(self) -> int:
|
|
50
|
+
return self.meta["offset"] + len(self.data)
|
|
51
|
+
|
|
52
|
+
def __len__(self) -> int:
|
|
53
|
+
return len(self.data)
|
|
54
|
+
|
|
55
|
+
def __repr__(self) -> str:
|
|
56
|
+
return f"<{type(self).__name__} items={len(self.data)} meta={self.meta}>"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _dedupe(seen: Set[Any], item: Any) -> bool:
|
|
60
|
+
"""True if the item is new."""
|
|
61
|
+
key = item.get("id") if isinstance(item, dict) else None
|
|
62
|
+
if key is None:
|
|
63
|
+
return True
|
|
64
|
+
if key in seen:
|
|
65
|
+
return False
|
|
66
|
+
seen.add(key)
|
|
67
|
+
return True
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class SyncPage(_PageBase[T]):
|
|
71
|
+
"""One page. Iterating it yields every item from this page to the last one."""
|
|
72
|
+
|
|
73
|
+
def __init__(self, response: APIResponse[Any], fetch: Callable[[int], APIResponse[Any]]) -> None:
|
|
74
|
+
super().__init__(response)
|
|
75
|
+
self._fetch = fetch
|
|
76
|
+
|
|
77
|
+
def next_page(self) -> "SyncPage[T]":
|
|
78
|
+
if not self.has_next_page():
|
|
79
|
+
raise StopIteration("no more pages; check has_next_page() first")
|
|
80
|
+
return SyncPage(self._fetch(self._next_offset()), self._fetch)
|
|
81
|
+
|
|
82
|
+
def iter_pages(self) -> Iterator["SyncPage[T]"]:
|
|
83
|
+
page: SyncPage[T] = self
|
|
84
|
+
yield page
|
|
85
|
+
while page.has_next_page():
|
|
86
|
+
page = page.next_page()
|
|
87
|
+
yield page
|
|
88
|
+
|
|
89
|
+
def auto_paging_iter(self) -> Iterator[T]:
|
|
90
|
+
seen: Set[Any] = set()
|
|
91
|
+
for page in self.iter_pages():
|
|
92
|
+
for item in page.data:
|
|
93
|
+
if _dedupe(seen, item):
|
|
94
|
+
yield item
|
|
95
|
+
|
|
96
|
+
def __iter__(self) -> Iterator[T]:
|
|
97
|
+
return self.auto_paging_iter()
|
|
98
|
+
|
|
99
|
+
def to_list(self, max_items: Optional[int] = None) -> List[T]:
|
|
100
|
+
out: List[T] = []
|
|
101
|
+
for item in self:
|
|
102
|
+
if max_items is not None and len(out) >= max_items:
|
|
103
|
+
break
|
|
104
|
+
out.append(item)
|
|
105
|
+
return out
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class AsyncPage(_PageBase[T]):
|
|
109
|
+
def __init__(self, response: APIResponse[Any], fetch: Callable[[int], Awaitable[APIResponse[Any]]]) -> None:
|
|
110
|
+
super().__init__(response)
|
|
111
|
+
self._fetch = fetch
|
|
112
|
+
|
|
113
|
+
async def next_page(self) -> "AsyncPage[T]":
|
|
114
|
+
if not self.has_next_page():
|
|
115
|
+
raise StopAsyncIteration("no more pages; check has_next_page() first")
|
|
116
|
+
return AsyncPage(await self._fetch(self._next_offset()), self._fetch)
|
|
117
|
+
|
|
118
|
+
async def iter_pages(self) -> AsyncIterator["AsyncPage[T]"]:
|
|
119
|
+
page: AsyncPage[T] = self
|
|
120
|
+
yield page
|
|
121
|
+
while page.has_next_page():
|
|
122
|
+
page = await page.next_page()
|
|
123
|
+
yield page
|
|
124
|
+
|
|
125
|
+
async def auto_paging_iter(self) -> AsyncIterator[T]:
|
|
126
|
+
seen: Set[Any] = set()
|
|
127
|
+
async for page in self.iter_pages():
|
|
128
|
+
for item in page.data:
|
|
129
|
+
if _dedupe(seen, item):
|
|
130
|
+
yield item
|
|
131
|
+
|
|
132
|
+
def __aiter__(self) -> AsyncIterator[T]:
|
|
133
|
+
return self.auto_paging_iter()
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class AsyncPaginator(Generic[T]):
|
|
137
|
+
"""What async list methods return: ``await`` it for the first page, or
|
|
138
|
+
``async for`` over it to iterate every item across pages."""
|
|
139
|
+
|
|
140
|
+
def __init__(self, start: Callable[[], Awaitable[AsyncPage[T]]]) -> None:
|
|
141
|
+
self._start = start
|
|
142
|
+
self._page: Optional[AsyncPage[T]] = None
|
|
143
|
+
|
|
144
|
+
async def _first(self) -> AsyncPage[T]:
|
|
145
|
+
if self._page is None:
|
|
146
|
+
self._page = await self._start()
|
|
147
|
+
return self._page
|
|
148
|
+
|
|
149
|
+
def __await__(self) -> Generator[Any, None, AsyncPage[T]]:
|
|
150
|
+
return self._first().__await__()
|
|
151
|
+
|
|
152
|
+
async def _iter(self) -> AsyncIterator[T]:
|
|
153
|
+
page = await self._first()
|
|
154
|
+
async for item in page:
|
|
155
|
+
yield item
|
|
156
|
+
|
|
157
|
+
def __aiter__(self) -> AsyncIterator[T]:
|
|
158
|
+
return self._iter()
|
|
159
|
+
|
|
160
|
+
async def to_list(self, max_items: Optional[int] = None) -> List[T]:
|
|
161
|
+
out: List[T] = []
|
|
162
|
+
async for item in self:
|
|
163
|
+
if max_items is not None and len(out) >= max_items:
|
|
164
|
+
break
|
|
165
|
+
out.append(item)
|
|
166
|
+
return out
|
disruptapi/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Resource classes for the sync and async clients."""
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"""Request specs for every endpoint, shared by the sync and async resources."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import uuid
|
|
6
|
+
from datetime import date, datetime
|
|
7
|
+
from typing import Any, Dict, Iterable, List, Optional, Sequence, Union
|
|
8
|
+
|
|
9
|
+
from .._base_client import RequestSpec, path_param as p
|
|
10
|
+
from ..types import ItemLike, WebhookFilters
|
|
11
|
+
|
|
12
|
+
Since = Union[str, datetime, date, None]
|
|
13
|
+
Types = Union[str, Sequence[str], None]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _opts(spec: RequestSpec, timeout: Optional[float], max_retries: Optional[int]) -> RequestSpec:
|
|
17
|
+
spec.timeout, spec.max_retries = timeout, max_retries
|
|
18
|
+
return spec
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _drop_none(d: Dict[str, Any]) -> Dict[str, Any]:
|
|
22
|
+
return {k: v for k, v in d.items() if v is not None}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _idempotent(spec: RequestSpec, key: Optional[str]) -> RequestSpec:
|
|
26
|
+
"""Send an Idempotency-Key (yours, or a new one per call). The same key goes with every
|
|
27
|
+
automatic retry of this call, and the API answers a repeat with the first result, so the
|
|
28
|
+
call is safe to retry."""
|
|
29
|
+
spec.headers["Idempotency-Key"] = key or str(uuid.uuid4())
|
|
30
|
+
spec.idempotent = True
|
|
31
|
+
return spec
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def signals_list(*, status: Optional[str], type: Types, min_severity: Optional[str], country: Optional[str],
|
|
35
|
+
airport: Optional[str], provider: Optional[str], since: Since, limit: Optional[int],
|
|
36
|
+
offset: int, include: Optional[str] = None) -> RequestSpec:
|
|
37
|
+
if isinstance(type, str) or type is None:
|
|
38
|
+
t: Any = type
|
|
39
|
+
else:
|
|
40
|
+
t = list(type)
|
|
41
|
+
return RequestSpec("GET", "/v1/signals", query={
|
|
42
|
+
"status": status, "type": t, "min_severity": min_severity, "country": country, "airport": airport,
|
|
43
|
+
"provider": provider, "since": since, "limit": limit, "offset": offset, "include": include})
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def signals_get(signal_id: str) -> RequestSpec:
|
|
47
|
+
return RequestSpec("GET", f"/v1/signals/{p(signal_id)}")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def events_list(*, provider: Optional[str], failure_layer: Optional[str], anchor_only: Optional[bool],
|
|
51
|
+
limit: Optional[int], offset: int) -> RequestSpec:
|
|
52
|
+
return RequestSpec("GET", "/v1/events", query={
|
|
53
|
+
"provider": provider, "failure_layer": failure_layer, "anchor_only": anchor_only,
|
|
54
|
+
"limit": limit, "offset": offset})
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def events_get(event_id: str) -> RequestSpec:
|
|
58
|
+
return RequestSpec("GET", f"/v1/events/{p(event_id)}")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def exposure_check(items: Optional[Iterable[ItemLike]], trips: Optional[Iterable[ItemLike]],
|
|
62
|
+
min_severity: Optional[str]) -> RequestSpec:
|
|
63
|
+
body = _drop_none({"items": list(items) if items is not None else None,
|
|
64
|
+
"trips": list(trips) if trips is not None else None, "min_severity": min_severity})
|
|
65
|
+
# Read-only: safe to retry like a GET.
|
|
66
|
+
return RequestSpec("POST", "/v1/exposure/check", body=body, idempotent=True)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def forecast_get(failure_layer: str, provider: Optional[str]) -> RequestSpec:
|
|
70
|
+
return RequestSpec("GET", "/v1/forecast", query={"failure_layer": failure_layer, "provider": provider})
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def failure_layers_list() -> RequestSpec:
|
|
74
|
+
return RequestSpec("GET", "/v1/failure-layers")
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def watchlists_list() -> RequestSpec:
|
|
78
|
+
return RequestSpec("GET", "/v1/watchlists")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def watchlists_create(name: str, description: Optional[str], items: Optional[Iterable[ItemLike]],
|
|
82
|
+
idempotency_key: Optional[str] = None) -> RequestSpec:
|
|
83
|
+
body = _drop_none({"name": name, "description": description,
|
|
84
|
+
"items": list(items) if items is not None else None})
|
|
85
|
+
return _idempotent(RequestSpec("POST", "/v1/watchlists", body=body), idempotency_key)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def watchlists_get(wl_id: str, limit: Optional[int], after: Optional[str] = None) -> RequestSpec:
|
|
89
|
+
return RequestSpec("GET", f"/v1/watchlists/{p(wl_id)}", query={"limit": limit, "after": after})
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def watchlists_update(wl_id: str, fields: Dict[str, Any]) -> RequestSpec:
|
|
93
|
+
return RequestSpec("PATCH", f"/v1/watchlists/{p(wl_id)}", body=fields)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def watchlists_delete(wl_id: str) -> RequestSpec:
|
|
97
|
+
return RequestSpec("DELETE", f"/v1/watchlists/{p(wl_id)}")
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def watchlists_exposure(wl_id: str, min_severity: Optional[str]) -> RequestSpec:
|
|
101
|
+
return RequestSpec("GET", f"/v1/watchlists/{p(wl_id)}/exposure", query={"min_severity": min_severity})
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def items_upsert(wl_id: str, items: Iterable[ItemLike], idempotency_key: Optional[str] = None) -> RequestSpec:
|
|
105
|
+
# Keyed by your id: safe to repeat anyway; the key also replays the first answer.
|
|
106
|
+
return _idempotent(RequestSpec("POST", f"/v1/watchlists/{p(wl_id)}/items", body={"items": list(items)}),
|
|
107
|
+
idempotency_key)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def items_remove(wl_id: str, ref: str) -> RequestSpec:
|
|
111
|
+
return RequestSpec("DELETE", f"/v1/watchlists/{p(wl_id)}/items/{p(ref)}")
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def airports_get(iata: str) -> RequestSpec:
|
|
115
|
+
return RequestSpec("GET", f"/v1/airports/{p(iata)}")
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def carriers_get(code: str) -> RequestSpec:
|
|
119
|
+
return RequestSpec("GET", f"/v1/carriers/{p(code)}")
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def sources_list() -> RequestSpec:
|
|
123
|
+
return RequestSpec("GET", "/v1/sources")
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def providers_list() -> RequestSpec:
|
|
127
|
+
return RequestSpec("GET", "/v1/providers")
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def webhooks_list() -> RequestSpec:
|
|
131
|
+
return RequestSpec("GET", "/v1/webhooks")
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def webhooks_create(url: str, filters: Optional[WebhookFilters], format: Optional[str] = None,
|
|
135
|
+
routing_key: Optional[str] = None, idempotency_key: Optional[str] = None) -> RequestSpec:
|
|
136
|
+
body = _drop_none({"url": url, "filters": filters, "format": format, "pagerduty_routing_key": routing_key})
|
|
137
|
+
return _idempotent(RequestSpec("POST", "/v1/webhooks", body=body), idempotency_key)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def webhooks_get(hook_id: str) -> RequestSpec:
|
|
141
|
+
return RequestSpec("GET", f"/v1/webhooks/{p(hook_id)}")
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def webhooks_rotate_secret(hook_id: str, idempotency_key: Optional[str] = None) -> RequestSpec:
|
|
145
|
+
return _idempotent(RequestSpec("POST", f"/v1/webhooks/{p(hook_id)}/rotate-secret", body={}), idempotency_key)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def webhooks_deliveries(hook_id: str, status: Optional[str], before: Optional[str],
|
|
149
|
+
limit: Optional[int]) -> RequestSpec:
|
|
150
|
+
return RequestSpec("GET", f"/v1/webhooks/{p(hook_id)}/deliveries",
|
|
151
|
+
query={"status": status, "before": before, "limit": limit})
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def webhooks_redeliver(hook_id: str, delivery_id: str) -> RequestSpec:
|
|
155
|
+
# Queues the same payload again; repeating it only queues it again, so not retried.
|
|
156
|
+
return RequestSpec("POST", f"/v1/webhooks/{p(hook_id)}/deliveries/{p(delivery_id)}/redeliver", body={})
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def webhooks_test(hook_id: str) -> RequestSpec:
|
|
160
|
+
return RequestSpec("POST", f"/v1/webhooks/{p(hook_id)}/test", body={})
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def changes_list(after: Optional[str], limit: Optional[int]) -> RequestSpec:
|
|
164
|
+
return RequestSpec("GET", "/v1/changes", query={"after": after, "limit": limit})
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def incidents_list(*, status: Optional[str], type: Types, min_severity: Optional[str], country: Optional[str],
|
|
168
|
+
airport: Optional[str], limit: Optional[int], offset: int) -> RequestSpec:
|
|
169
|
+
t: Any = type if isinstance(type, str) or type is None else list(type)
|
|
170
|
+
return RequestSpec("GET", "/v1/incidents", query={
|
|
171
|
+
"status": status, "type": t, "min_severity": min_severity, "country": country, "airport": airport,
|
|
172
|
+
"limit": limit, "offset": offset})
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def incidents_get(incident_id: str) -> RequestSpec:
|
|
176
|
+
return RequestSpec("GET", f"/v1/incidents/{p(incident_id)}")
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def severities_list() -> RequestSpec:
|
|
180
|
+
return RequestSpec("GET", "/v1/severities")
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def airports_faa_outlook(iata: str) -> RequestSpec:
|
|
184
|
+
return RequestSpec("GET", f"/v1/airports/{p(iata)}/faa-outlook")
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def airports_observed_weather(iata: str, start: Since, end: Since) -> RequestSpec:
|
|
188
|
+
return RequestSpec("GET", f"/v1/airports/{p(iata)}/observed-weather", query={"from": start, "to": end})
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def flights_outcome(carrier: str, flight_number: int, date_: Union[str, date], origin: Optional[str],
|
|
192
|
+
destination: Optional[str]) -> RequestSpec:
|
|
193
|
+
return RequestSpec("GET", "/v1/flights/outcome", query={
|
|
194
|
+
"carrier": carrier, "flight_number": flight_number, "date": _day(date_), "origin": origin,
|
|
195
|
+
"destination": destination})
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def flights_outlook(carrier: str, origin: str, destination: str, date_: Union[str, date],
|
|
199
|
+
departure_time: Optional[str]) -> RequestSpec:
|
|
200
|
+
return RequestSpec("GET", "/v1/flights/outlook", query={
|
|
201
|
+
"carrier": carrier, "origin": origin, "destination": destination, "date": _day(date_),
|
|
202
|
+
"departure_time": departure_time})
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def evidence_get(*, date_: Union[str, date], airport: Optional[str], origin: Optional[str],
|
|
206
|
+
destination: Optional[str], carrier: Optional[str], flight_number: Optional[int]) -> RequestSpec:
|
|
207
|
+
return RequestSpec("GET", "/v1/evidence", query={
|
|
208
|
+
"date": _day(date_), "airport": airport, "origin": origin, "destination": destination,
|
|
209
|
+
"carrier": carrier, "flight_number": flight_number})
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def _day(d: Union[str, date]) -> str:
|
|
213
|
+
return d.isoformat()[:10] if isinstance(d, (date, datetime)) else d
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def webhooks_update(hook_id: str, fields: Dict[str, Any]) -> RequestSpec:
|
|
217
|
+
return RequestSpec("PATCH", f"/v1/webhooks/{p(hook_id)}", body=fields)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def webhooks_delete(hook_id: str) -> RequestSpec:
|
|
221
|
+
return RequestSpec("DELETE", f"/v1/webhooks/{p(hook_id)}")
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def me() -> RequestSpec:
|
|
225
|
+
return RequestSpec("GET", "/v1/me")
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def usage(days: Optional[int]) -> RequestSpec:
|
|
229
|
+
return RequestSpec("GET", "/v1/usage", query={"days": days})
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def plans() -> RequestSpec:
|
|
233
|
+
return RequestSpec("GET", "/v1/plans")
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
__all__: List[str] = []
|