Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Mar 28, 2024
1 parent f0b4983 commit 2df49c1
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4167,7 +4167,7 @@ Methods:
Types:

```python
from cloudflare.types.request_tracers import RequestTracerTrace, TraceCreateResponse
from cloudflare.types.request_tracers import Trace, TraceCreateResponse
```

Methods:
Expand Down
25 changes: 24 additions & 1 deletion src/cloudflare/pagination.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Generic, TypeVar, Optional, cast
from typing import Any, List, Type, Generic, Mapping, TypeVar, Optional, cast
from typing_extensions import override

from httpx import Response

from ._utils import is_mapping
from ._models import BaseModel, GenericModel
from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage

Expand All @@ -24,6 +27,8 @@
"AsyncSinglePage",
]

_BaseModelT = TypeVar("_BaseModelT", bound=BaseModel)

_T = TypeVar("_T")


Expand Down Expand Up @@ -269,6 +274,15 @@ def next_page_info(self) -> None:
"""
return None

@classmethod
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
return cls.construct(
None,
**{
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
},
)


class AsyncSinglePage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
items: List[_T]
Expand All @@ -287,3 +301,12 @@ def next_page_info(self) -> None:
so there will never be a next page.
"""
return None

@classmethod
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
return cls.construct(
None,
**{
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
},
)
2 changes: 1 addition & 1 deletion src/cloudflare/types/request_tracers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

from __future__ import annotations

from .trace import Trace as Trace
from .trace_create_params import TraceCreateParams as TraceCreateParams
from .request_tracer_trace import RequestTracerTrace as RequestTracerTrace
from .trace_create_response import TraceCreateResponse as TraceCreateResponse
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from ..._compat import PYDANTIC_V2
from ..._models import BaseModel

__all__ = ["RequestTracerTrace", "RequestTracerTraceItem"]
__all__ = ["Trace", "TraceItem"]


class RequestTracerTraceItem(BaseModel):
class TraceItem(BaseModel):
action: Optional[str] = None
"""If step type is rule, then action performed by this rule"""

Expand All @@ -35,15 +35,15 @@ class RequestTracerTraceItem(BaseModel):
step_name: Optional[str] = None
"""Tracing step identifying name"""

trace: Optional[RequestTracerTrace] = None
trace: Optional[Trace] = None

type: Optional[str] = None
"""Tracing step type"""


RequestTracerTrace = List[RequestTracerTraceItem]
Trace = List[TraceItem]

if PYDANTIC_V2:
RequestTracerTraceItem.model_rebuild()
TraceItem.model_rebuild()
else:
RequestTracerTraceItem.update_forward_refs() # type: ignore
TraceItem.update_forward_refs() # type: ignore
4 changes: 2 additions & 2 deletions src/cloudflare/types/request_tracers/trace_create_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class TraceCreateResponse(BaseModel):
status_code: Optional[int] = None
"""HTTP Status code of zone response"""

trace: Optional["RequestTracerTrace"] = None
trace: Optional["Trace"] = None


from .request_tracer_trace import RequestTracerTrace
from .trace import Trace

if PYDANTIC_V2:
TraceCreateResponse.model_rebuild()
Expand Down

0 comments on commit 2df49c1

Please sign in to comment.