Source code for avatars.models

# This file has been generated - DO NOT MODIFY
# API Version : 2.81.0

# generated by datamodel-codegen:
#   filename:  input.json
from __future__ import annotations

from enum import IntEnum, StrEnum
from typing import Annotated, Any, Protocol, runtime_checkable
from uuid import UUID

import pandas as pd
from pydantic import AwareDatetime, BaseModel, Field, RootModel, SecretStr


[docs] class ApiKey(BaseModel): """ Response model for an API key. """ id: Annotated[UUID, Field(title="Id")] name: Annotated[str, Field(title="Name")] created_at: Annotated[AwareDatetime, Field(title="Created At")] expires_at: Annotated[AwareDatetime, Field(title="Expires At")] revoked_at: Annotated[AwareDatetime | None, Field(title="Revoked At")] = None last_used_at: Annotated[AwareDatetime | None, Field(title="Last Used At")] = None
[docs] class ApiKeyWithPlaintext(BaseModel): """ API Key response model that includes the secret for creation. """ id: Annotated[UUID, Field(title="Id")] name: Annotated[str, Field(title="Name")] created_at: Annotated[AwareDatetime, Field(title="Created At")] expires_at: Annotated[AwareDatetime, Field(title="Expires At")] revoked_at: Annotated[AwareDatetime | None, Field(title="Revoked At")] = None last_used_at: Annotated[AwareDatetime | None, Field(title="Last Used At")] = None plaintext: Annotated[str, Field(title="Plaintext")]
[docs] class BulkDeleteRequest(BaseModel): """ Request model for bulk job deletion. """ job_names: Annotated[list[str], Field(max_length=100, title="Job Names")]
[docs] class CompatibilityStatus(StrEnum): compatible = "compatible" incompatible = "incompatible" unknown = "unknown"
[docs] class ExpirationDays(IntEnum): """ Expiration preset in days (choose from 30/60/120/365/3650) """ integer_30 = 30 integer_60 = 60 integer_120 = 120 integer_365 = 365 integer_3650 = 3650
[docs] class CreateApiKeyRequest(BaseModel): """ Request body for creating an API key. """ name: Annotated[ str, Field( description="Human-readable label for the API key", max_length=255, min_length=1, title="Name", ), ] expiration_days: Annotated[ ExpirationDays, Field( description="Expiration preset in days (choose from 30/60/120/365/3650)", title="Expiration Days", ), ]
[docs] class CreateApiKeyResponse(BaseModel): """ Response for API key creation. """ api_key: ApiKeyWithPlaintext message: Annotated[str, Field(title="Message")]
[docs] class CreditsInfo(BaseModel): credits: Annotated[int | None, Field(title="Credits")] is_credit_enabled: Annotated[bool, Field(title="Is Credit Enabled")]
[docs] class EnvironmentInfo(BaseModel): """ Resolved environment values for the current user. """ dataset_expiration_days: Annotated[ int, Field( description="Number of days before a dataset expires.", title="Dataset Expiration Days", ), ] max_allowed_dimensions_per_dataset: Annotated[ int, Field( description="Maximum number of dimensions (columns) allowed per dataset.", title="Max Allowed Dimensions Per Dataset", ), ] max_allowed_lines_per_dataset: Annotated[ int, Field( description="Maximum number of rows allowed per dataset.", title="Max Allowed Lines Per Dataset", ), ]
[docs] class EventLogResponse(BaseModel): """ A single audit-trail entry visible to the user. """ id: Annotated[UUID, Field(title="Id")] verb: Annotated[str, Field(title="Verb")] object_id: Annotated[UUID | None, Field(title="Object Id")] = None object_type: Annotated[str, Field(title="Object Type")] created_at: Annotated[AwareDatetime, Field(title="Created At")]
[docs] class FeatureScope(StrEnum): avatar_parameters = "avatar_parameters" single_table = "single_table" multi_table = "multi_table" time_series = "time_series" report = "report" geolocalization = "geolocalization" privacy_assessment = "privacy_assessment" differential_privacy = "differential_privacy"
[docs] class FeaturesInfo(BaseModel): feature_scopes: Annotated[list[FeatureScope], Field(title="Feature Scopes")]
[docs] class FileCredentials(BaseModel): access_key_id: Annotated[str, Field(title="Access Key Id")] secret_access_key: Annotated[str, Field(title="Secret Access Key")]
[docs] class ForgottenPasswordRequest(BaseModel): email: Annotated[str, Field(title="Email")]
[docs] class JobCreateRequest(BaseModel): set_name: Annotated[UUID, Field(title="Set Name")] parameters_name: Annotated[str, Field(title="Parameters Name")] depends_on: Annotated[list[str] | None, Field(title="Depends On")] = []
[docs] class JobCreateResponse(BaseModel): name: Annotated[str, Field(title="Name")] Location: Annotated[str, Field(title="Location")]
[docs] class JobKind(StrEnum): standard = "standard" privacy_metrics = "privacy_metrics" signal_metrics = "signal_metrics" report = "report" advice = "advice"
[docs] class JobStatus(StrEnum): """ Status of a job in its lifecycle. Typical happy-path order: QUEUED → CREATED → PENDING → FINISHED Error paths: PARENT_ERROR (a dependency job failed) ERROR (the job itself failed) LOST (worker disappeared) ORPHANED (worker lost contact before running) DEFAULT ("") is the initial value before any status is assigned. """ queued = "queued" created = "created" orphaned = "orphaned" parent_error = "parent_error" error = "error" finished = "finished" field_ = "" pending = "pending" lost = "lost"
[docs] class LoginResponse(BaseModel): access_token: Annotated[str, Field(title="Access Token")] refresh_token: Annotated[str | None, Field(title="Refresh Token")] = None token_type: Annotated[str, Field(title="Token Type")]
[docs] class ResetPasswordRequest(BaseModel): email: Annotated[str, Field(title="Email")] new_password: Annotated[str, Field(title="New Password")] new_password_repeated: Annotated[str, Field(title="New Password Repeated")] token: Annotated[UUID, Field(title="Token")]
[docs] class ResourceSetResponse(BaseModel): set_name: Annotated[UUID, Field(title="Set Name")] display_name: Annotated[str, Field(title="Display Name")]
[docs] class UserRole(StrEnum): admin = "admin" user = "user"
[docs] class ValidationError(BaseModel): loc: Annotated[list[str | int], Field(title="Location")] msg: Annotated[str, Field(title="Message")] type: Annotated[str, Field(title="Error Type")] input: Annotated[Any | None, Field(title="Input")] = None ctx: Annotated[dict[str, Any] | None, Field(title="Context")] = None
[docs] class GrantType(RootModel[str]): root: Annotated[str, Field(pattern="^password$", title="Grant Type")]
[docs] class Login(BaseModel): grant_type: Annotated[GrantType | None, Field(title="Grant Type")] = None username: Annotated[str, Field(title="Username")] password: Annotated[SecretStr, Field(title="Password")] scope: Annotated[str | None, Field(title="Scope")] = "" client_id: Annotated[str | None, Field(title="Client Id")] = None client_secret: Annotated[SecretStr | None, Field(title="Client Secret")] = None
[docs] class CompatibilityResponse(BaseModel): message: Annotated[str, Field(title="Message")] most_recent_compatible_client: Annotated[ str | None, Field(title="Most Recent Compatible Client") ] = None status: CompatibilityStatus
[docs] class CreateUser(BaseModel): """ Create a user with an email. """ email: Annotated[str, Field(title="Email")] role: UserRole | None = UserRole.user password: Annotated[str | None, Field(title="Password")] = None
[docs] class FileAccess(BaseModel): url: Annotated[str, Field(title="Url")] credentials: FileCredentials
[docs] class HTTPValidationError(BaseModel): detail: Annotated[list[ValidationError] | None, Field(title="Detail")] = None
[docs] class JobResponse(BaseModel): name: Annotated[str, Field(title="Name")] set_name: Annotated[UUID, Field(title="Set Name")] parameters_name: Annotated[str, Field(title="Parameters Name")] display_name: Annotated[str, Field(title="Display Name")] created_at: Annotated[AwareDatetime, Field(title="Created At")] kind: JobKind status: JobStatus exception: Annotated[str, Field(title="Exception")] done: Annotated[bool, Field(title="Done")] progress: Annotated[float | None, Field(title="Progress")] deleted_at: Annotated[AwareDatetime | None, Field(title="Deleted At")] = None
[docs] class JobResponseList(BaseModel): jobs: Annotated[list[JobResponse], Field(title="Jobs")]
[docs] class MeUser(BaseModel): id: Annotated[UUID, Field(title="Id")] organization_id: Annotated[UUID, Field(title="Organization Id")] email: Annotated[str, Field(title="Email")] role: UserRole | None = UserRole.user environment: EnvironmentInfo
[docs] class User(BaseModel): id: Annotated[UUID, Field(title="Id")] organization_id: Annotated[UUID, Field(title="Organization Id")] email: Annotated[str, Field(title="Email")] role: UserRole | None = UserRole.user
[docs] class BulkDeleteResponse(BaseModel): """ Response model for bulk job deletion. """ deleted_jobs: Annotated[list[JobResponse], Field(title="Deleted Jobs")] failed_jobs: Annotated[list[str], Field(title="Failed Jobs")]
[docs] @runtime_checkable class Processor(Protocol):
[docs] def preprocess(self, df: pd.DataFrame) -> pd.DataFrame: ...
[docs] def postprocess(self, source: pd.DataFrame, dest: pd.DataFrame) -> pd.DataFrame: ...