Skip to content

Commit e75ea61

Browse files
feat(api): manual updates
1 parent 4ae29fb commit e75ea61

8 files changed

Lines changed: 369 additions & 3 deletions

File tree

‎.stats.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 30
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-42c531dcf60b5d35e3996c1a669a3fe2de19d8caedf2bfd69e4864a1041c9bfa.yml
1+
configured_endpoints: 32
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d25300a20809f87d2069c1f4417b158b2e2d1cef3ca9b6bf7653e02233deba2c.yml
33
openapi_spec_hash: e43dd84c75e6d710c7346b9f12c34738
4-
config_hash: daabb160675d86b354711da1e77e5129
4+
config_hash: 70e7e80b5e87f94981bee396c6cd41e8

‎api.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ from context.dev.types import (
106106
MonitorUpdateResponse,
107107
MonitorListResponse,
108108
MonitorDeleteResponse,
109+
MonitorGetCreditUsageResponse,
110+
MonitorGetLimitsResponse,
109111
MonitorListAccountChangesResponse,
110112
MonitorListAccountRunsResponse,
111113
MonitorListChangesResponse,
@@ -122,6 +124,8 @@ Methods:
122124
- <code title="patch /monitors/{monitor_id}">client.monitors.<a href="./src/context/dev/resources/monitors.py">update</a>(monitor_id, \*\*<a href="src/context/dev/types/monitor_update_params.py">params</a>) -> <a href="./src/context/dev/types/monitor_update_response.py">MonitorUpdateResponse</a></code>
123125
- <code title="get /monitors">client.monitors.<a href="./src/context/dev/resources/monitors.py">list</a>(\*\*<a href="src/context/dev/types/monitor_list_params.py">params</a>) -> <a href="./src/context/dev/types/monitor_list_response.py">MonitorListResponse</a></code>
124126
- <code title="delete /monitors/{monitor_id}">client.monitors.<a href="./src/context/dev/resources/monitors.py">delete</a>(monitor_id) -> <a href="./src/context/dev/types/monitor_delete_response.py">MonitorDeleteResponse</a></code>
127+
- <code title="get /monitors/credit-usage">client.monitors.<a href="./src/context/dev/resources/monitors.py">get_credit_usage</a>(\*\*<a href="src/context/dev/types/monitor_get_credit_usage_params.py">params</a>) -> <a href="./src/context/dev/types/monitor_get_credit_usage_response.py">MonitorGetCreditUsageResponse</a></code>
128+
- <code title="get /monitors/limits">client.monitors.<a href="./src/context/dev/resources/monitors.py">get_limits</a>() -> <a href="./src/context/dev/types/monitor_get_limits_response.py">MonitorGetLimitsResponse</a></code>
125129
- <code title="get /monitors/changes">client.monitors.<a href="./src/context/dev/resources/monitors.py">list_account_changes</a>(\*\*<a href="src/context/dev/types/monitor_list_account_changes_params.py">params</a>) -> <a href="./src/context/dev/types/monitor_list_account_changes_response.py">MonitorListAccountChangesResponse</a></code>
126130
- <code title="get /monitors/runs">client.monitors.<a href="./src/context/dev/resources/monitors.py">list_account_runs</a>(\*\*<a href="src/context/dev/types/monitor_list_account_runs_params.py">params</a>) -> <a href="./src/context/dev/types/monitor_list_account_runs_response.py">MonitorListAccountRunsResponse</a></code>
127131
- <code title="get /monitors/{monitor_id}/changes">client.monitors.<a href="./src/context/dev/resources/monitors.py">list_changes</a>(monitor_id, \*\*<a href="src/context/dev/types/monitor_list_changes_params.py">params</a>) -> <a href="./src/context/dev/types/monitor_list_changes_response.py">MonitorListChangesResponse</a></code>

‎src/context/dev/resources/monitors.py‎

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
monitor_update_params,
1515
monitor_list_runs_params,
1616
monitor_list_changes_params,
17+
monitor_get_credit_usage_params,
1718
monitor_list_account_runs_params,
1819
monitor_list_account_changes_params,
1920
)
@@ -35,8 +36,10 @@
3536
from ..types.monitor_update_response import MonitorUpdateResponse
3637
from ..types.monitor_retrieve_response import MonitorRetrieveResponse
3738
from ..types.monitor_list_runs_response import MonitorListRunsResponse
39+
from ..types.monitor_get_limits_response import MonitorGetLimitsResponse
3840
from ..types.monitor_list_changes_response import MonitorListChangesResponse
3941
from ..types.monitor_retrieve_change_response import MonitorRetrieveChangeResponse
42+
from ..types.monitor_get_credit_usage_response import MonitorGetCreditUsageResponse
4043
from ..types.monitor_list_account_runs_response import MonitorListAccountRunsResponse
4144
from ..types.monitor_list_account_changes_response import MonitorListAccountChangesResponse
4245

@@ -348,6 +351,72 @@ def delete(
348351
cast_to=MonitorDeleteResponse,
349352
)
350353

354+
def get_credit_usage(
355+
self,
356+
*,
357+
since: Union[str, datetime] | Omit = omit,
358+
until: Union[str, datetime] | Omit = omit,
359+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
360+
# The extra values given here take precedence over values defined on the client or passed to this method.
361+
extra_headers: Headers | None = None,
362+
extra_query: Query | None = None,
363+
extra_body: Body | None = None,
364+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
365+
) -> MonitorGetCreditUsageResponse:
366+
"""
367+
Returns credits charged per monitor over an optional [since, until] window,
368+
newest spenders first.
369+
370+
Args:
371+
since: Only include items at or after this ISO 8601 timestamp.
372+
373+
until: Only include items before this ISO 8601 timestamp.
374+
375+
extra_headers: Send extra headers
376+
377+
extra_query: Add additional query parameters to the request
378+
379+
extra_body: Add additional JSON properties to the request
380+
381+
timeout: Override the client-level default timeout for this request, in seconds
382+
"""
383+
return self._get(
384+
"/monitors/credit-usage",
385+
options=make_request_options(
386+
extra_headers=extra_headers,
387+
extra_query=extra_query,
388+
extra_body=extra_body,
389+
timeout=timeout,
390+
query=maybe_transform(
391+
{
392+
"since": since,
393+
"until": until,
394+
},
395+
monitor_get_credit_usage_params.MonitorGetCreditUsageParams,
396+
),
397+
),
398+
cast_to=MonitorGetCreditUsageResponse,
399+
)
400+
401+
def get_limits(
402+
self,
403+
*,
404+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
405+
# The extra values given here take precedence over values defined on the client or passed to this method.
406+
extra_headers: Headers | None = None,
407+
extra_query: Query | None = None,
408+
extra_body: Body | None = None,
409+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
410+
) -> MonitorGetLimitsResponse:
411+
"""Returns how many monitors the account has and the maximum it allows."""
412+
return self._get(
413+
"/monitors/limits",
414+
options=make_request_options(
415+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
416+
),
417+
cast_to=MonitorGetLimitsResponse,
418+
)
419+
351420
def list_account_changes(
352421
self,
353422
*,
@@ -956,6 +1025,72 @@ async def delete(
9561025
cast_to=MonitorDeleteResponse,
9571026
)
9581027

1028+
async def get_credit_usage(
1029+
self,
1030+
*,
1031+
since: Union[str, datetime] | Omit = omit,
1032+
until: Union[str, datetime] | Omit = omit,
1033+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1034+
# The extra values given here take precedence over values defined on the client or passed to this method.
1035+
extra_headers: Headers | None = None,
1036+
extra_query: Query | None = None,
1037+
extra_body: Body | None = None,
1038+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
1039+
) -> MonitorGetCreditUsageResponse:
1040+
"""
1041+
Returns credits charged per monitor over an optional [since, until] window,
1042+
newest spenders first.
1043+
1044+
Args:
1045+
since: Only include items at or after this ISO 8601 timestamp.
1046+
1047+
until: Only include items before this ISO 8601 timestamp.
1048+
1049+
extra_headers: Send extra headers
1050+
1051+
extra_query: Add additional query parameters to the request
1052+
1053+
extra_body: Add additional JSON properties to the request
1054+
1055+
timeout: Override the client-level default timeout for this request, in seconds
1056+
"""
1057+
return await self._get(
1058+
"/monitors/credit-usage",
1059+
options=make_request_options(
1060+
extra_headers=extra_headers,
1061+
extra_query=extra_query,
1062+
extra_body=extra_body,
1063+
timeout=timeout,
1064+
query=await async_maybe_transform(
1065+
{
1066+
"since": since,
1067+
"until": until,
1068+
},
1069+
monitor_get_credit_usage_params.MonitorGetCreditUsageParams,
1070+
),
1071+
),
1072+
cast_to=MonitorGetCreditUsageResponse,
1073+
)
1074+
1075+
async def get_limits(
1076+
self,
1077+
*,
1078+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1079+
# The extra values given here take precedence over values defined on the client or passed to this method.
1080+
extra_headers: Headers | None = None,
1081+
extra_query: Query | None = None,
1082+
extra_body: Body | None = None,
1083+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
1084+
) -> MonitorGetLimitsResponse:
1085+
"""Returns how many monitors the account has and the maximum it allows."""
1086+
return await self._get(
1087+
"/monitors/limits",
1088+
options=make_request_options(
1089+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1090+
),
1091+
cast_to=MonitorGetLimitsResponse,
1092+
)
1093+
9591094
async def list_account_changes(
9601095
self,
9611096
*,
@@ -1278,6 +1413,12 @@ def __init__(self, monitors: MonitorsResource) -> None:
12781413
self.delete = to_raw_response_wrapper(
12791414
monitors.delete,
12801415
)
1416+
self.get_credit_usage = to_raw_response_wrapper(
1417+
monitors.get_credit_usage,
1418+
)
1419+
self.get_limits = to_raw_response_wrapper(
1420+
monitors.get_limits,
1421+
)
12811422
self.list_account_changes = to_raw_response_wrapper(
12821423
monitors.list_account_changes,
12831424
)
@@ -1317,6 +1458,12 @@ def __init__(self, monitors: AsyncMonitorsResource) -> None:
13171458
self.delete = async_to_raw_response_wrapper(
13181459
monitors.delete,
13191460
)
1461+
self.get_credit_usage = async_to_raw_response_wrapper(
1462+
monitors.get_credit_usage,
1463+
)
1464+
self.get_limits = async_to_raw_response_wrapper(
1465+
monitors.get_limits,
1466+
)
13201467
self.list_account_changes = async_to_raw_response_wrapper(
13211468
monitors.list_account_changes,
13221469
)
@@ -1356,6 +1503,12 @@ def __init__(self, monitors: MonitorsResource) -> None:
13561503
self.delete = to_streamed_response_wrapper(
13571504
monitors.delete,
13581505
)
1506+
self.get_credit_usage = to_streamed_response_wrapper(
1507+
monitors.get_credit_usage,
1508+
)
1509+
self.get_limits = to_streamed_response_wrapper(
1510+
monitors.get_limits,
1511+
)
13591512
self.list_account_changes = to_streamed_response_wrapper(
13601513
monitors.list_account_changes,
13611514
)
@@ -1395,6 +1548,12 @@ def __init__(self, monitors: AsyncMonitorsResource) -> None:
13951548
self.delete = async_to_streamed_response_wrapper(
13961549
monitors.delete,
13971550
)
1551+
self.get_credit_usage = async_to_streamed_response_wrapper(
1552+
monitors.get_credit_usage,
1553+
)
1554+
self.get_limits = async_to_streamed_response_wrapper(
1555+
monitors.get_limits,
1556+
)
13981557
self.list_account_changes = async_to_streamed_response_wrapper(
13991558
monitors.list_account_changes,
14001559
)

‎src/context/dev/types/__init__.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from .web_web_scrape_html_params import WebWebScrapeHTMLParams as WebWebScrapeHTMLParams
3636
from .web_web_scrape_md_response import WebWebScrapeMdResponse as WebWebScrapeMdResponse
3737
from .ai_extract_product_response import AIExtractProductResponse as AIExtractProductResponse
38+
from .monitor_get_limits_response import MonitorGetLimitsResponse as MonitorGetLimitsResponse
3839
from .monitor_list_changes_params import MonitorListChangesParams as MonitorListChangesParams
3940
from .ai_extract_products_response import AIExtractProductsResponse as AIExtractProductsResponse
4041
from .industry_retrieve_sic_params import IndustryRetrieveSicParams as IndustryRetrieveSicParams
@@ -47,13 +48,15 @@
4748
from .industry_retrieve_sic_response import IndustryRetrieveSicResponse as IndustryRetrieveSicResponse
4849
from .web_extract_competitors_params import WebExtractCompetitorsParams as WebExtractCompetitorsParams
4950
from .web_web_scrape_images_response import WebWebScrapeImagesResponse as WebWebScrapeImagesResponse
51+
from .monitor_get_credit_usage_params import MonitorGetCreditUsageParams as MonitorGetCreditUsageParams
5052
from .web_extract_styleguide_response import WebExtractStyleguideResponse as WebExtractStyleguideResponse
5153
from .web_web_scrape_sitemap_response import WebWebScrapeSitemapResponse as WebWebScrapeSitemapResponse
5254
from .brand_retrieve_simplified_params import BrandRetrieveSimplifiedParams as BrandRetrieveSimplifiedParams
5355
from .industry_retrieve_naics_response import IndustryRetrieveNaicsResponse as IndustryRetrieveNaicsResponse
5456
from .monitor_list_account_runs_params import MonitorListAccountRunsParams as MonitorListAccountRunsParams
5557
from .monitor_retrieve_change_response import MonitorRetrieveChangeResponse as MonitorRetrieveChangeResponse
5658
from .web_extract_competitors_response import WebExtractCompetitorsResponse as WebExtractCompetitorsResponse
59+
from .monitor_get_credit_usage_response import MonitorGetCreditUsageResponse as MonitorGetCreditUsageResponse
5760
from .brand_retrieve_simplified_response import BrandRetrieveSimplifiedResponse as BrandRetrieveSimplifiedResponse
5861
from .monitor_list_account_runs_response import MonitorListAccountRunsResponse as MonitorListAccountRunsResponse
5962
from .monitor_list_account_changes_params import MonitorListAccountChangesParams as MonitorListAccountChangesParams
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Union
6+
from datetime import datetime
7+
from typing_extensions import Annotated, TypedDict
8+
9+
from .._utils import PropertyInfo
10+
11+
__all__ = ["MonitorGetCreditUsageParams"]
12+
13+
14+
class MonitorGetCreditUsageParams(TypedDict, total=False):
15+
since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
16+
"""Only include items at or after this ISO 8601 timestamp."""
17+
18+
until: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
19+
"""Only include items before this ISO 8601 timestamp."""
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List
4+
5+
from .._models import BaseModel
6+
7+
__all__ = ["MonitorGetCreditUsageResponse", "Data"]
8+
9+
10+
class Data(BaseModel):
11+
credits: int
12+
"""Credits charged to this monitor over the window."""
13+
14+
monitor_id: str
15+
16+
name: str
17+
"""Monitor name (falls back to the id when the monitor was deleted)."""
18+
19+
runs: int
20+
"""Number of billed runs over the window."""
21+
22+
23+
class MonitorGetCreditUsageResponse(BaseModel):
24+
data: List[Data]
25+
26+
total_credits: int
27+
"""Sum of credits across all monitors in the window."""
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing_extensions import Literal
4+
5+
from .._models import BaseModel
6+
7+
__all__ = ["MonitorGetLimitsResponse"]
8+
9+
10+
class MonitorGetLimitsResponse(BaseModel):
11+
monitors_limit: int
12+
"""Maximum number of monitors allowed for the account.
13+
14+
Defaults to the plan allowance unless a custom limit is set for the
15+
organization.
16+
"""
17+
18+
monitors_used: int
19+
"""Number of monitors the account currently has."""
20+
21+
plan: Literal["free", "starter", "pro", "scale"]
22+
"""The plan tier the limit was resolved from."""

0 commit comments

Comments
 (0)