|
| 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 Type, Union, cast |
| 6 | +from datetime import date |
| 7 | +from typing_extensions import Literal |
| 8 | + |
| 9 | +import httpx |
| 10 | + |
| 11 | +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given |
| 12 | +from ..._utils import maybe_transform, async_maybe_transform |
| 13 | +from ..._compat import cached_property |
| 14 | +from ..._resource import SyncAPIResource, AsyncAPIResource |
| 15 | +from ..._response import ( |
| 16 | + to_raw_response_wrapper, |
| 17 | + to_streamed_response_wrapper, |
| 18 | + async_to_raw_response_wrapper, |
| 19 | + async_to_streamed_response_wrapper, |
| 20 | +) |
| 21 | +from ..._wrappers import ResultWrapper |
| 22 | +from ...types.radar import agent_readiness_summary_params |
| 23 | +from ..._base_client import make_request_options |
| 24 | +from ...types.radar.agent_readiness_summary_response import AgentReadinessSummaryResponse |
| 25 | + |
| 26 | +__all__ = ["AgentReadinessResource", "AsyncAgentReadinessResource"] |
| 27 | + |
| 28 | + |
| 29 | +class AgentReadinessResource(SyncAPIResource): |
| 30 | + @cached_property |
| 31 | + def with_raw_response(self) -> AgentReadinessResourceWithRawResponse: |
| 32 | + """ |
| 33 | + This property can be used as a prefix for any HTTP method call to return |
| 34 | + the raw response object instead of the parsed content. |
| 35 | +
|
| 36 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers |
| 37 | + """ |
| 38 | + return AgentReadinessResourceWithRawResponse(self) |
| 39 | + |
| 40 | + @cached_property |
| 41 | + def with_streaming_response(self) -> AgentReadinessResourceWithStreamingResponse: |
| 42 | + """ |
| 43 | + An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 44 | +
|
| 45 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response |
| 46 | + """ |
| 47 | + return AgentReadinessResourceWithStreamingResponse(self) |
| 48 | + |
| 49 | + def summary( |
| 50 | + self, |
| 51 | + dimension: Literal["CHECK"], |
| 52 | + *, |
| 53 | + date: Union[str, date] | Omit = omit, |
| 54 | + domain_category: SequenceNotStr[str] | Omit = omit, |
| 55 | + format: Literal["JSON", "CSV"] | Omit = omit, |
| 56 | + name: SequenceNotStr[str] | Omit = omit, |
| 57 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 58 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 59 | + extra_headers: Headers | None = None, |
| 60 | + extra_query: Query | None = None, |
| 61 | + extra_body: Body | None = None, |
| 62 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 63 | + ) -> AgentReadinessSummaryResponse: |
| 64 | + """ |
| 65 | + Returns a summary of AI agent readiness scores across scanned domains, grouped |
| 66 | + by the specified dimension. Data is sourced from weekly bulk scans. All values |
| 67 | + are raw domain counts. |
| 68 | +
|
| 69 | + Args: |
| 70 | + dimension: Specifies the agent readiness data dimension by which to group the results. |
| 71 | +
|
| 72 | + date: Filters results by the specified date. |
| 73 | +
|
| 74 | + domain_category: Filters results by domain category. |
| 75 | +
|
| 76 | + format: Format in which results will be returned. |
| 77 | +
|
| 78 | + name: Array of names used to label the series in the response. |
| 79 | +
|
| 80 | + extra_headers: Send extra headers |
| 81 | +
|
| 82 | + extra_query: Add additional query parameters to the request |
| 83 | +
|
| 84 | + extra_body: Add additional JSON properties to the request |
| 85 | +
|
| 86 | + timeout: Override the client-level default timeout for this request, in seconds |
| 87 | + """ |
| 88 | + if not dimension: |
| 89 | + raise ValueError(f"Expected a non-empty value for `dimension` but received {dimension!r}") |
| 90 | + return self._get( |
| 91 | + f"/radar/agent_readiness/summary/{dimension}", |
| 92 | + options=make_request_options( |
| 93 | + extra_headers=extra_headers, |
| 94 | + extra_query=extra_query, |
| 95 | + extra_body=extra_body, |
| 96 | + timeout=timeout, |
| 97 | + query=maybe_transform( |
| 98 | + { |
| 99 | + "date": date, |
| 100 | + "domain_category": domain_category, |
| 101 | + "format": format, |
| 102 | + "name": name, |
| 103 | + }, |
| 104 | + agent_readiness_summary_params.AgentReadinessSummaryParams, |
| 105 | + ), |
| 106 | + post_parser=ResultWrapper[AgentReadinessSummaryResponse]._unwrapper, |
| 107 | + ), |
| 108 | + cast_to=cast(Type[AgentReadinessSummaryResponse], ResultWrapper[AgentReadinessSummaryResponse]), |
| 109 | + ) |
| 110 | + |
| 111 | + |
| 112 | +class AsyncAgentReadinessResource(AsyncAPIResource): |
| 113 | + @cached_property |
| 114 | + def with_raw_response(self) -> AsyncAgentReadinessResourceWithRawResponse: |
| 115 | + """ |
| 116 | + This property can be used as a prefix for any HTTP method call to return |
| 117 | + the raw response object instead of the parsed content. |
| 118 | +
|
| 119 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers |
| 120 | + """ |
| 121 | + return AsyncAgentReadinessResourceWithRawResponse(self) |
| 122 | + |
| 123 | + @cached_property |
| 124 | + def with_streaming_response(self) -> AsyncAgentReadinessResourceWithStreamingResponse: |
| 125 | + """ |
| 126 | + An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 127 | +
|
| 128 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response |
| 129 | + """ |
| 130 | + return AsyncAgentReadinessResourceWithStreamingResponse(self) |
| 131 | + |
| 132 | + async def summary( |
| 133 | + self, |
| 134 | + dimension: Literal["CHECK"], |
| 135 | + *, |
| 136 | + date: Union[str, date] | Omit = omit, |
| 137 | + domain_category: SequenceNotStr[str] | Omit = omit, |
| 138 | + format: Literal["JSON", "CSV"] | Omit = omit, |
| 139 | + name: SequenceNotStr[str] | Omit = omit, |
| 140 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 141 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 142 | + extra_headers: Headers | None = None, |
| 143 | + extra_query: Query | None = None, |
| 144 | + extra_body: Body | None = None, |
| 145 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 146 | + ) -> AgentReadinessSummaryResponse: |
| 147 | + """ |
| 148 | + Returns a summary of AI agent readiness scores across scanned domains, grouped |
| 149 | + by the specified dimension. Data is sourced from weekly bulk scans. All values |
| 150 | + are raw domain counts. |
| 151 | +
|
| 152 | + Args: |
| 153 | + dimension: Specifies the agent readiness data dimension by which to group the results. |
| 154 | +
|
| 155 | + date: Filters results by the specified date. |
| 156 | +
|
| 157 | + domain_category: Filters results by domain category. |
| 158 | +
|
| 159 | + format: Format in which results will be returned. |
| 160 | +
|
| 161 | + name: Array of names used to label the series in the response. |
| 162 | +
|
| 163 | + extra_headers: Send extra headers |
| 164 | +
|
| 165 | + extra_query: Add additional query parameters to the request |
| 166 | +
|
| 167 | + extra_body: Add additional JSON properties to the request |
| 168 | +
|
| 169 | + timeout: Override the client-level default timeout for this request, in seconds |
| 170 | + """ |
| 171 | + if not dimension: |
| 172 | + raise ValueError(f"Expected a non-empty value for `dimension` but received {dimension!r}") |
| 173 | + return await self._get( |
| 174 | + f"/radar/agent_readiness/summary/{dimension}", |
| 175 | + options=make_request_options( |
| 176 | + extra_headers=extra_headers, |
| 177 | + extra_query=extra_query, |
| 178 | + extra_body=extra_body, |
| 179 | + timeout=timeout, |
| 180 | + query=await async_maybe_transform( |
| 181 | + { |
| 182 | + "date": date, |
| 183 | + "domain_category": domain_category, |
| 184 | + "format": format, |
| 185 | + "name": name, |
| 186 | + }, |
| 187 | + agent_readiness_summary_params.AgentReadinessSummaryParams, |
| 188 | + ), |
| 189 | + post_parser=ResultWrapper[AgentReadinessSummaryResponse]._unwrapper, |
| 190 | + ), |
| 191 | + cast_to=cast(Type[AgentReadinessSummaryResponse], ResultWrapper[AgentReadinessSummaryResponse]), |
| 192 | + ) |
| 193 | + |
| 194 | + |
| 195 | +class AgentReadinessResourceWithRawResponse: |
| 196 | + def __init__(self, agent_readiness: AgentReadinessResource) -> None: |
| 197 | + self._agent_readiness = agent_readiness |
| 198 | + |
| 199 | + self.summary = to_raw_response_wrapper( |
| 200 | + agent_readiness.summary, |
| 201 | + ) |
| 202 | + |
| 203 | + |
| 204 | +class AsyncAgentReadinessResourceWithRawResponse: |
| 205 | + def __init__(self, agent_readiness: AsyncAgentReadinessResource) -> None: |
| 206 | + self._agent_readiness = agent_readiness |
| 207 | + |
| 208 | + self.summary = async_to_raw_response_wrapper( |
| 209 | + agent_readiness.summary, |
| 210 | + ) |
| 211 | + |
| 212 | + |
| 213 | +class AgentReadinessResourceWithStreamingResponse: |
| 214 | + def __init__(self, agent_readiness: AgentReadinessResource) -> None: |
| 215 | + self._agent_readiness = agent_readiness |
| 216 | + |
| 217 | + self.summary = to_streamed_response_wrapper( |
| 218 | + agent_readiness.summary, |
| 219 | + ) |
| 220 | + |
| 221 | + |
| 222 | +class AsyncAgentReadinessResourceWithStreamingResponse: |
| 223 | + def __init__(self, agent_readiness: AsyncAgentReadinessResource) -> None: |
| 224 | + self._agent_readiness = agent_readiness |
| 225 | + |
| 226 | + self.summary = async_to_streamed_response_wrapper( |
| 227 | + agent_readiness.summary, |
| 228 | + ) |
0 commit comments