Files
openrouter-python-sdk-retry…/src/openrouter/operations/getanalyticsmeta.py
T

289 lines
7.9 KiB
Python

"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr
from openrouter.utils import FieldMetadata, HeaderMetadata
import pydantic
from pydantic import model_serializer
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
class GetAnalyticsMetaGlobalsTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetAnalyticsMetaGlobals(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(
["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"]
)
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
class GetAnalyticsMetaRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: NotRequired[str]
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: NotRequired[str]
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
class GetAnalyticsMetaRequest(BaseModel):
http_referer: Annotated[
Optional[str],
pydantic.Field(alias="HTTP-Referer"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
"""
x_open_router_title: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Title"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
"""
x_open_router_categories: Annotated[
Optional[str],
pydantic.Field(alias="X-OpenRouter-Categories"),
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(
["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"]
)
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
class DimensionTypedDict(TypedDict):
display_label: str
r"""Human-readable label"""
name: str
r"""Dimension identifier used in query requests"""
class Dimension(BaseModel):
display_label: str
r"""Human-readable label"""
name: str
r"""Dimension identifier used in query requests"""
GranularityName = Union[
Literal[
"minute",
"hour",
"day",
"week",
"month",
],
UnrecognizedStr,
]
r"""Granularity identifier"""
class GranularityTypedDict(TypedDict):
display_label: str
r"""Human-readable label"""
name: GranularityName
r"""Granularity identifier"""
class Granularity(BaseModel):
display_label: str
r"""Human-readable label"""
name: GranularityName
r"""Granularity identifier"""
DisplayFormat = Union[
Literal[
"number",
"currency",
"percent",
"latency",
"throughput",
],
UnrecognizedStr,
]
r"""How this metric value should be formatted for display (e.g. percent → multiply by 100 and append %, currency → prefix with $)"""
class MetricTypedDict(TypedDict):
display_format: DisplayFormat
r"""How this metric value should be formatted for display (e.g. percent → multiply by 100 and append %, currency → prefix with $)"""
display_label: str
r"""Human-readable label"""
is_rate: bool
r"""Whether this metric is a rate/ratio (averaged, not summed)"""
name: str
r"""Metric identifier used in query requests"""
class Metric(BaseModel):
display_format: DisplayFormat
r"""How this metric value should be formatted for display (e.g. percent → multiply by 100 and append %, currency → prefix with $)"""
display_label: str
r"""Human-readable label"""
is_rate: bool
r"""Whether this metric is a rate/ratio (averaged, not summed)"""
name: str
r"""Metric identifier used in query requests"""
OperatorName = Union[
Literal[
"eq",
"neq",
"in",
"not_in",
"gt",
"gte",
"lt",
"lte",
],
UnrecognizedStr,
]
r"""Operator identifier used in filter definitions"""
ValueType = Union[
Literal[
"scalar",
"array",
],
UnrecognizedStr,
]
r"""Whether the operator expects a single value or an array"""
class OperatorTypedDict(TypedDict):
name: OperatorName
r"""Operator identifier used in filter definitions"""
value_type: ValueType
r"""Whether the operator expects a single value or an array"""
class Operator(BaseModel):
name: OperatorName
r"""Operator identifier used in filter definitions"""
value_type: ValueType
r"""Whether the operator expects a single value or an array"""
class GetAnalyticsMetaDataTypedDict(TypedDict):
dimensions: List[DimensionTypedDict]
granularities: List[GranularityTypedDict]
metrics: List[MetricTypedDict]
operators: List[OperatorTypedDict]
class GetAnalyticsMetaData(BaseModel):
dimensions: List[Dimension]
granularities: List[Granularity]
metrics: List[Metric]
operators: List[Operator]
class GetAnalyticsMetaResponseTypedDict(TypedDict):
r"""Returns analytics query metadata"""
data: GetAnalyticsMetaDataTypedDict
class GetAnalyticsMetaResponse(BaseModel):
r"""Returns analytics query metadata"""
data: GetAnalyticsMetaData