Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): update via SDK Studio #185

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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