diff --git a/frameworks/fastapi/.gitignore b/frameworks/fastapi/.gitignore deleted file mode 100644 index 6b1f59d6..00000000 --- a/frameworks/fastapi/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -__pycache__ -app.egg-info -*.pyc -.mypy_cache -.coverage -htmlcov -.cache -.venv -*.todo -# macOS -.DS_Store - -# env -.env* - -.idea/ - -# tmp -.tmp -tmp/ diff --git a/frameworks/fastapi/.python-version b/frameworks/fastapi/.python-version deleted file mode 100644 index c8cfe395..00000000 --- a/frameworks/fastapi/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.10 diff --git a/frameworks/fastapi/.vscode/launch.json b/frameworks/fastapi/.vscode/launch.json deleted file mode 100644 index ce823bda..00000000 --- a/frameworks/fastapi/.vscode/launch.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "FastAPI", - "type": "debugpy", - "request": "launch", - "module": "uvicorn", - "args": ["app.main:app", "--reload", "--port", "8004"], - "python": "${command:python.interpreterPath}", - "env": { - "PYTHONPATH": "${workspaceFolder}" - } - } - ], - "compounds": [] -} diff --git a/frameworks/fastapi/.vscode/settings.json b/frameworks/fastapi/.vscode/settings.json deleted file mode 100644 index b68e04b9..00000000 --- a/frameworks/fastapi/.vscode/settings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "explorer.fileNesting.enabled": true, - "explorer.fileNesting.expand": false, - "explorer.fileNesting.patterns": { - ".env": ".env.*", - "DockerFile": "docker-compose.yml, docker-compose.yaml, docker-compose.override.yml, docker-compose.override.yaml, .dockerignore", - ".gitignore": ".gitattributes, .gitmodules, .gitmessage, .mailmap, .git-blame*", - "pyproject.toml": "poetry.lock, poetry.toml", - "readme.*": "authors, backers.md, changelog*, citation*, code_of_conduct.md, codeowners, contributing.md, contributors, copying, credits, governance.md, history.md, license*, maintainers, readme*, security.md, sponsors.md" - }, - "cSpell.language": "en,ar", - "cSpell.words": [], - "python.analysis.typeCheckingMode": "basic", - "python.analysis.diagnosticMode": "workspace" -} diff --git a/frameworks/fastapi/LICENSE b/frameworks/fastapi/LICENSE deleted file mode 100644 index 9a84cb8d..00000000 --- a/frameworks/fastapi/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2025 @masreplay - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/frameworks/fastapi/README.md b/frameworks/fastapi/README.md deleted file mode 100644 index 8c5b086a..00000000 --- a/frameworks/fastapi/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# FastApi Project for swagger_to_dart package - -- Follow pydantic and fastapi conventions -- Support pydantic_extra_types \ No newline at end of file diff --git a/frameworks/fastapi/app/main.py b/frameworks/fastapi/app/main.py deleted file mode 100644 index 84169bea..00000000 --- a/frameworks/fastapi/app/main.py +++ /dev/null @@ -1,1120 +0,0 @@ -from datetime import date, datetime, time, timedelta -from enum import Enum -from typing import Annotated, Any, Literal -from uuid import UUID - -from fastapi import ( - Body, - Cookie, - Depends, - FastAPI, - File, - Form, - Header, - HTTPException, - Path, - Query, - UploadFile, - status, -) -from fastapi.security import ( - APIKeyHeader, - OAuth2PasswordBearer, - OAuth2PasswordRequestForm, -) -from pydantic import ( - BaseModel, - EmailStr, - Field, - HttpUrl, - NegativeInt, - PositiveInt, - SecretStr, - confloat, - conint, - constr, -) - -from app.router import ( - generic_router, - items_router, - pydantic_extra_types_router, - union_router, -) - -app = FastAPI( - title="FastAPI Type Examples", - description="Comprehensive examples of types and routes in FastAPI", - version="1.0.0", - generate_unique_id_function=lambda route: f"{route.tags[0]}-{route.name}", - openapi_tags=[ - {"name": "basic", "description": "Basic type operations"}, - {"name": "advanced", "description": "Advanced type operations"}, - {"name": "models", "description": "Pydantic model operations"}, - {"name": "validation", "description": "Parameter validation examples"}, - {"name": "files", "description": "File upload examples"}, - {"name": "security", "description": "Security related endpoints"}, - ], -) - - -# --------- BASIC TYPES --------- - - -@app.get( - "/basic/number/{num}", - tags=["basic"], - summary="Handle integer path parameter", -) -def basic_number(num: int) -> dict[str, Any]: - """Handle integer path parameter.""" - return {"value": num, "type": "integer"} - - -@app.get( - "/basic/float/{num}", - tags=["basic"], - summary="Handle float path parameter", -) -def basic_float(num: float) -> dict[str, Any]: - """Handle float path parameter.""" - return {"value": num, "type": "float"} - - -@app.get( - "/basic/boolean", - tags=["basic"], - summary="Handle boolean query parameter", -) -def basic_boolean(flag: bool = Query(False, example=True)) -> dict[str, Any]: - """Handle boolean query parameter with default value.""" - return {"value": flag, "type": "boolean"} - - -@app.get( - "/basic/string", - tags=["basic"], - summary="Handle string query parameter", -) -def basic_string( - text: str = Query( - None, - min_length=3, - max_length=50, - example="example_text", - ), -) -> dict[str, Any]: - """Handle string query parameter with validation.""" - return {"value": text, "type": "string"} - - -# --------- DATE & TIME TYPES --------- - - -@app.get( - "/datetime/date", - tags=["basic"], - summary="Handle date parameters", -) -def datetime_date(d: date) -> dict[str, Any]: - """Handle date parameter (YYYY-MM-DD).""" - return {"date": d, "weekday": d.weekday()} - - -@app.get( - "/datetime/datetime", - tags=["basic"], - summary="Handle datetime parameters", -) -def datetime_datetime(dt: datetime) -> dict[str, Any]: - """Handle datetime parameter (YYYY-MM-DDThh:mm:ss).""" - return {"datetime": dt, "timestamp": dt.timestamp()} - -@app.post( - "/datetime/datetime", - tags=["basic"], - summary="Handle datetime parameters", -) -def create_datetime_datetime(dt: datetime) -> dict[str, Any]: - """Handle datetime parameter (YYYY-MM-DDThh:mm:ss).""" - return {"datetime": dt, "timestamp": dt.timestamp()} - - -@app.get( - "/datetime/time", - tags=["basic"], - summary="Handle time parameters", -) -def datetime_time(t: time) -> dict[str, Any]: - """Handle time parameter (hh:mm:ss).""" - return {"time": t, "hour": t.hour, "minute": t.minute} - - -@app.get( - "/datetime/timedelta", - tags=["basic"], - summary="Handle timedelta parameters", -) -def datetime_timedelta(td: timedelta) -> dict[str, Any]: - """Handle timedelta parameter (in seconds).""" - return {"timedelta": td, "seconds": td.total_seconds()} - - -# --------- SPECIAL TYPES --------- - - -@app.get( - "/special/uuid", - tags=["advanced"], - summary="Handle UUID parameters", -) -def special_uuid(id: UUID) -> dict[str, Any]: - """Handle UUID parameter.""" - return {"uuid": id, "version": id.version} - - -class UserLevel(str, Enum): - BASIC = "basic" - PREMIUM = "premium" - ADMIN = "admin" - - -@app.get( - "/special/enum", - tags=["advanced"], - summary="Handle enum parameters", -) -def special_enum(level: UserLevel = UserLevel.BASIC) -> dict[str, Any]: - """Handle Enum parameter.""" - return { - "level": level, - "permissions": ["read"] - if level == UserLevel.BASIC - else ["read", "write"] - if level == UserLevel.PREMIUM - else ["read", "write", "admin"], - } - - -@app.get( - "/special/literal", - tags=["advanced"], - summary="Handle literal type parameters", -) -def special_literal( - mode: Literal["light", "dark", "system"] = "system", -) -> dict[str, Any]: - """Handle Literal type parameter.""" - return { - "mode": mode, - "theme_color": "#FFFFFF" - if mode == "light" - else "#000000" - if mode == "dark" - else "#CCCCCC", - } - - -# --------- COLLECTION TYPES --------- - - -@app.get("/collection/list", tags=["advanced"]) -def collection_list(items: list[str] = Query(["default"])) -> dict[str, Any]: - """Handle list of strings query parameter.""" - return {"items": items, "count": len(items)} - - -@app.get("/collection/set", tags=["advanced"]) -def collection_set(items: set[int] = Query({1, 2, 3})) -> dict[str, Any]: - """Handle set of integers query parameter.""" - return { - "items": list( - items, - ), - "unique_count": len(items), - } - - -@app.get("/collection/dict", tags=["advanced"]) -def collection_dict(data: dict[str, Any] = Body(...)) -> dict[str, Any]: - """Handle dictionary in request body.""" - return {"data": data, "keys": list(data.keys())} - - -@app.get("/collection/tuple", tags=["advanced"]) -def collection_tuple(items: tuple[int, str, bool] = Query(...)) -> dict[str, Any]: - """Handle fixed-size tuple query parameter.""" - return {"items": items, "types": [type(item).__name__ for item in items]} - - -@app.get("/collection/variable_tuple", tags=["advanced"]) -def collection_variable_tuple(items: tuple[str, ...] = Query(...)) -> dict[str, Any]: - """Handle variable-size tuple query parameter.""" - return {"items": items, "count": len(items)} - - -# --------- UNION TYPES --------- - - -@app.get( - "/union/simple", - tags=["advanced"], - summary="Handle union type parameters", -) -def union_simple(value: int | str | bool) -> dict[str, Any]: - """Handle union type parameter.""" - return {"value": value, "type": type(value).__name__} - - -@app.get( - "/union/optional", - tags=["advanced"], - summary="Handle optional parameters", -) -def union_optional(value: str | None = None) -> dict[str, Any]: - """Handle optional type parameter.""" - return {"value": value, "is_none": value is None} - - -@app.get( - "/union/modern", - tags=["advanced"], - summary="Handle union with modern Python syntax", -) -def union_modern(value: int | str | None = None) -> dict[str, Any]: - """Handle union with modern Python syntax (Python 3.10+).""" - return { - "value": value, - "type": type(value).__name__ if value is not None else "None", - } - - -# --------- PYDANTIC MODELS --------- - - -class Location(BaseModel): - lat: Annotated[ - float, - Field( - ge=-90, - le=90, - examples=[40.7128], - description="Latitude coordinate between -90 and 90 degrees", - title="Latitude", - ), - ] - lng: Annotated[ - float, - Field( - ge=-180, - le=180, - examples=[-74.0060], - description="Longitude coordinate between -180 and 180 degrees", - title="Longitude", - ), - ] - name: str | None = Field( - None, - examples=["New York"], - description="Optional location name", - ) - - -class UserBase(BaseModel): - username: str = Field( - min_length=3, - max_length=50, - examples=["johndoe"], - pattern="^[a-zA-Z0-9_-]+$", - description="Username between 3-50 characters, alphanumeric with _ and -", - ) - email: EmailStr = Field( - examples=["john@example.com"], - description="Valid email address", - ) - full_name: str | None = Field( - None, - examples=["John Doe"], - description="User's full name", - ) - - -class UserCreate(UserBase): - password: SecretStr = Field( - min_length=8, - description="Password with minimum 8 characters", - ) - - -class User(UserBase): - id: int = Field( - examples=[1], - gt=0, - description="Unique user identifier", - ) - is_active: bool = Field( - True, - examples=[True], - description="User account status", - ) - created_at: datetime = Field( - default_factory=datetime.now, - examples=["2023-01-01T00:00:00"], - description="Account creation timestamp", - ) - location: Location | None = Field( - None, - description="User's location information", - ) - tags: list[str] = Field( - [], - examples=["user", "customer"], - description="list of tags associated with the user", - ) - - tmp: bool = Field( - False, - exclude=True, - description="Temporary field excluded from output", - ) - - class Config: - json_schema_extra = { - "example": { - "id": 1, - "username": "johndoe", - "email": "john@example.com", - "full_name": "John Doe", - "is_active": True, - "created_at": "2023-01-01T00:00:00", - "location": {"lat": 40.7128, "lng": -74.0060, "name": "New York"}, - "tags": ["user", "customer"], - } - } - - -@app.post( - "/models/user", - tags=["models"], -) -def create_user(user: UserCreate) -> User: - """Create a new user from a Pydantic model.""" - # This would normally interact with a database - return User( - id=1, - username=user.username, - email=user.email, - full_name=user.full_name, - created_at=datetime.now(), - is_active=True, - location=None, - tags=[], - tmp=False, - ) - - -@app.get( - "/models/location", - tags=["models"], - summary="Process location information", -) -def get_location(location: Location) -> dict[str, Any]: - """Handle a Pydantic model as query parameters.""" - return { - "location": location, - "url": f"https://maps.google.com/?q={location.lat},{location.lng}", - } - - -# --------- PARAMETER SOURCES --------- - - -@app.get( - "/params/path/{item_id}", - tags=["validation"], - summary="Demonstrate path parameter validation", -) -def param_path( - item_id: int = Path( - title="Item ID", - description="The ID of the item", - ge=1, - example=42, - ), -) -> dict[str, Any]: - """Path parameter with validation.""" - return {"item_id": item_id} - - -@app.get( - "/params/query", - tags=["validation"], - summary="Demonstrate query parameter validation", -) -def param_query( - q: str | None = Query( - None, - min_length=3, - max_length=50, - regex="^[a-zA-Z0-9_-]+$", - example="search-term", - description="Search query string (alphanumeric with hyphens and underscores)", - ), - skip: int = Query( - 0, - ge=0, - example=0, - description="Number of items to skip", - ), - limit: int = Query( - 10, - ge=1, - le=100, - example=10, - description="Maximum number of items to return (1-100)", - ), -) -> dict[str, Any]: - """Query parameters with validation.""" - return {"q": q, "skip": skip, "limit": limit} - - -@app.post( - "/params/body", - tags=["validation"], - summary="Demonstrate body parameter validation", -) -def param_body( - data: dict[str, Any] = Body( - example={"name": "Test Item", "description": "This is a test item"}, - description="Arbitrary data object", - ), - importance: int = Body( - ge=0, - le=10, - example=5, - description="Importance level from 0-10", - ), -) -> dict[str, Any]: - """Body parameters with validation.""" - return {"data": data, "importance": importance} - - -@app.get("/params/cookie", tags=["validation"]) -def param_cookie( - session: str | None = Cookie( - None, - ), - preferences: str | None = Cookie( - None, - ), -) -> dict[str, Any]: - """Cookie parameters.""" - return {"session": session, "preferences": preferences} - - -@app.get("/params/header", tags=["validation"]) -def param_header( - user_agent: str = Header( - ..., - ), - x_token: str | None = Header( - None, - ), -) -> dict[str, Any]: - """Header parameters.""" - return {"user_agent": user_agent, "token": x_token} - - -# --------- FORM DATA & FILES --------- - - -@app.post( - "/forms/basic", - tags=["files"], - summary="Handle basic form data", -) -def form_basic( - username: str = Form( - example="johndoe", - description="Username", - ), - password: str = Form( - description="Password", - ), - remember: bool = Form( - False, - example=False, - description="Remember login", - ), -) -> dict[str, Any]: - """Handle form data.""" - return { - "username": username, - "password_length": len( - password, - ), - "remember": remember, - } - - -@app.post( - "/files/upload", - tags=["files"], - summary="Handle single file upload", -) -def file_upload( - file: UploadFile = File( - description="File to upload", - ), - description: str | None = Form( - None, - example="My document", - description="File description", - ), -) -> dict[str, Any]: - """Handle file upload.""" - return { - "filename": file.filename, - "content_type": file.content_type, - "description": description, - } - - -@app.post( - "/files/multiple", - tags=["files"], - summary="Handle multiple file uploads", -) -def files_multiple( - files: list[UploadFile] = File( - description="list of files to upload", - ), - notes: str = Form( - None, - example="Important files", - description="Notes about the uploads", - ), -) -> dict[str, Any]: - """Handle multiple file uploads.""" - return { - "filenames": [file.filename for file in files], - "total_files": len( - files, - ), - "notes": notes, - } - - -# --------- VALIDATION EXAMPLES --------- - - -class AllTypesWithValidation(BaseModel): - int_value: Annotated[ - int, - Field( - examples=[42], - gt=0, - lt=100, - description="Integer between 1-99", - title="Integer Value", - ), - ] - float_value: Annotated[ - float, - Field( - examples=[3.14], - ge=0.0, - le=10.0, - decimal_places=2, - description="Pi or other values", - ), - ] - str_value: Annotated[ - str, - Field( - min_length=3, - max_length=50, - pattern="^[a-zA-Z0-9_-]+$", - examples=["example_value"], - description="String with alphanumeric characters, underscores and hyphens", - ), - ] - bool_value: bool = Field(examples=[True], description="Boolean value") - email_value: EmailStr = Field( - examples=["user@example.com"], - description="Valid email address", - ) - url_value: HttpUrl = Field( - examples=["https://example.com"], - description="Valid HTTP URL", - ) - list_value: list[str] = Field( - min_length=1, - max_length=5, - examples=["item1", "item2"], - description="list with 1-5 strings", - ) - - class Config: - json_schema_extra = { - "example": { - "int_value": 42, - "float_value": 3.14, - "str_value": "example_value", - "bool_value": True, - "email_value": "user@example.com", - "url_value": "https://example.com", - "list_value": ["item1", "item2"], - } - } - - -@app.post( - "/validation/complex", - tags=["validation"], - summary="Demonstrate complex model validation", -) -def validation_complex(data: AllTypesWithValidation) -> AllTypesWithValidation: - """Process a model with complex validation rules.""" - return data - - -@app.get( - "/validation/conditional", - tags=["validation"], - summary="Demonstrate conditional validation", -) -def validation_conditional( - user_id: int | None = Query( - None, - ge=1, - example=123, - description="User ID", - ), - username: str | None = Query( - None, - min_length=3, - example="johndoe", - description="Username", - ), -) -> dict[str, Any]: - """Validate that at least one parameter is provided.""" - if user_id is None and username is None: - raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, - detail="Either user_id or username must be provided", - ) - return {"user_id": user_id, "username": username} - - -class ConditionalBody(BaseModel): - item_id: int | None = Field( - None, - examples=[42], - gt=0, - description="Item ID (if provided)", - ) - item_name: str | None = Field( - None, - examples=["example_item"], - description="Item name (if provided)", - ) - - @classmethod - def __get_validators__(cls) -> Any: - yield cls.validate_either_id_or_name - - @classmethod - def validate_either_id_or_name(cls, values: Any) -> dict[str, Any] | None: - if values.get("item_id") is None and values.get("item_name") is None: - raise ValueError("Either item_id or item_name must be provided") - return values - - class Config: - json_schema_extra = {"example": {"item_id": 42, "item_name": "example_item"}} - - -@app.post( - "/validation/conditional_body", - tags=["validation"], - summary="Validate a model with conditional requirements", -) -def validation_conditional_body(body: ConditionalBody) -> ConditionalBody: - """Validate a body with conditional validation.""" - return body - - -# --------- CUSTOM TYPES --------- - - -@app.get( - "/custom/positive_int", - tags=["advanced"], - summary="Demonstrate custom type validation", -) -def custom_positive_int(value: PositiveInt, value2: NegativeInt) -> dict[str, Any]: - """Handle custom type for positive integers.""" - return {"value": value, "doubled": value * 2} - - -# --------- CONSTRAINED TYPES --------- - - -@app.get( - "/constrained/int", - tags=["validation"], - summary="Demonstrate constrained integer validation", -) -def constrained_int( - value: Annotated[ - conint(ge=0, lt=100), - Query( - examples=[42], - description="Integer between 0 and 99", - ), - ], -) -> dict[str, Any]: - """Handle constrained integer with validation.""" - return { - "value": value, - "category": "low" if value < 33 else "medium" if value < 66 else "high", - } - - -@app.get( - "/constrained/float", - tags=["validation"], - summary="Demonstrate constrained float validation", -) -def constrained_float( - value: Annotated[ - confloat(ge=0.0, le=1.0), - Query( - examples=[0.5], - description="Float between 0.0 and 1.0", - ), - ], -) -> dict[str, Any]: - """Handle constrained float with validation.""" - return {"value": value, "percentage": f"{value * 100:.1f}%"} - - -@app.get( - "/constrained/string", - tags=["validation"], - summary="Demonstrate constrained string validation", -) -def constrained_string( - value: Annotated[ - constr(min_length=3, max_length=50, pattern="^[a-zA-Z0-9_-]+$"), - Query( - examples=["example-value"], - description="String between 3-50 chars, alphanumeric with hyphens and underscores", - ), - ], -) -> dict[str, Any]: - """Handle constrained string with validation.""" - return {"value": value, "length": len(value)} - - -# --------- RESPONSE MODELS --------- - - -@app.get( - "/response/filtered", - tags=["models"], - summary="Return a filtered response model", -) -def response_filtered() -> User: - """Return a response filtered by the response_model.""" - # Only fields defined in UserBase will be returned - return User( - id=1, - username="johndoe", - email="john@example.com", - full_name="John Doe", - is_active=True, - tags=["user", "customer"], - created_at=datetime.now(), - location=Location( - lat=40.7128, - lng=-74.0060, - name="New York", - ), - tmp=False, - ) - - -@app.get( - "/response/multiple", - tags=["models"], - summary="Return different response models based on query", -) -def response_multiple( - is_user: bool = Query( - True, - example=True, - description="Whether to return a user or location", - ), -) -> User | Location: - """Return different response models based on query parameters.""" - if is_user: - return User( - id=1, - username="johndoe", - email="john@example.com", - created_at=datetime.now(), - is_active=True, - location=Location( - lat=40.7128, - lng=-74.0060, - name="New York", - ), - tags=["user", "customer"], - tmp=False, - full_name="John Doe", - ) - else: - return Location(lat=40.7128, lng=-74.0060, name="New York") - - -@app.get( - "/response/list", - tags=["models"], - summary="Return a list of models", -) -def response_list() -> list[User]: - """Return a list of items with a response model.""" - return [ - User( - id=1, - username="user1", - email="user1@example.com", - created_at=datetime.now(), - is_active=True, - location=Location( - lat=40.7128, - lng=-74.0060, - name="New York", - ), - tags=["user", "customer"], - tmp=False, - full_name="John Doe", - ), - User( - id=2, - username="user2", - email="user2@example.com", - created_at=datetime.now(), - is_active=True, - location=Location( - lat=40.7128, - lng=-74.0060, - name="New York", - ), - tags=["user", "customer"], - tmp=False, - full_name="John Doe", - ), - ] - - -# --------- DEPENDENCY INJECTION --------- - - -def common_parameters( - q: str | None = Query( - None, - examples=["search"], - description="Optional search string", - ), - skip: int = Query( - 0, - ge=0, - examples=[0], - description="Number of items to skip", - ), - limit: int = Query( - 100, - ge=1, - le=1000, - examples=[100], - description="Max items to return", - ), -) -> dict[str, Any]: - """Common query parameters that can be reused.""" - return {"q": q, "skip": skip, "limit": limit} - - -@app.get( - "/depends/query", - tags=["advanced"], - summary="Use dependency injection for common parameters", -) -def depends_query( - commons: dict[str, Any] = Depends( - common_parameters, - ), -) -> dict[str, Any]: - """Use dependency injection for common parameters.""" - return commons - - -class DatabaseDependency: - def __init__(self, db_name: str = "default"): - self.db_name = db_name - # In a real app, this would establish a database connection - - def get_items(self, skip: int = 0, limit: int = 100) -> list[dict[str, Any]]: - # This would normally fetch from a database - return [{"id": i, "name": f"Item {i}"} for i in range(skip, skip + limit)] - - -@app.get( - "/depends/class", - tags=["advanced"], - summary="Use class-based dependency injection", -) -def depends_class(db: DatabaseDependency = Depends()) -> dict[str, Any]: - """Use class-based dependency injection.""" - return {"db_name": db.db_name, "items": db.get_items(0, 5)} - - -# --------- SECURITY --------- - - -oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") - - -@app.post( - "/token", - tags=["security"], - summary="Get an access token", -) -def login(form_data: OAuth2PasswordRequestForm = Depends()) -> dict[str, str]: - """OAuth2 compatible token login, get an access token for future requests.""" - # This would normally validate credentials and return a token - if form_data.username == "admin" and form_data.password == "admin": - return {"access_token": "fake-jwt-token", "token_type": "bearer"} - raise HTTPException( - status_code=status.HTTP_401_UNAUTHORIZED, - detail="Incorrect username or password", - headers={"WWW-Authenticate": "Bearer"}, - ) - - -@app.get( - "/users/me", - tags=["security"], - summary="Get current user from token", -) -def read_users_me(token: str = Depends(oauth2_scheme)) -> dict[str, Any]: - """Get current user based on the token.""" - # This would normally decode and validate the token - if token == "fake-jwt-token": - return {"id": 1, "username": "admin"} - raise HTTPException( - status_code=status.HTTP_401_UNAUTHORIZED, - detail="Invalid authentication credentials", - headers={"WWW-Authenticate": "Bearer"}, - ) - - -api_key_header = APIKeyHeader(name="X-API-Key") - - -@app.get( - "/items/secure", - tags=["security"], - summary="Get items using API key auth", -) -def get_secure_items(api_key: str = Depends(api_key_header)) -> list[dict[str, Any]]: - """Get items using API key auth.""" - if api_key != "valid-api-key": - raise HTTPException( - status_code=status.HTTP_403_FORBIDDEN, detail="Invalid API Key" - ) - return [{"id": 1, "name": "Secure Item"}] - - -# --------- HTTP EXCEPTIONS --------- - - -@app.get( - "/errors/not_found/{item_id}", - tags=["advanced"], - summary="Demonstrate 404 error handling", -) -def error_not_found(item_id: int) -> dict[str, Any]: - """Raise an HTTP exception if the item is not found.""" - if item_id != 42: - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail=f"Item with id {item_id} not found", - ) - return {"item_id": item_id, "name": "The Answer"} - - -@app.get( - "/errors/custom", - tags=["advanced"], - summary="Demonstrate custom error status codes", -) -def error_custom( - code: int = Query( - example=400, - description="HTTP error code to simulate", - ), -) -> dict[str, Any]: - """Raise custom HTTP exceptions based on query parameters.""" - error_mapping = { - 400: ( - status.HTTP_400_BAD_REQUEST, - "Bad Request", - ), - 401: ( - status.HTTP_401_UNAUTHORIZED, - "Unauthorized", - ), - 403: ( - status.HTTP_403_FORBIDDEN, - "Forbidden", - ), - 404: ( - status.HTTP_404_NOT_FOUND, - "Not Found", - ), - 500: ( - status.HTTP_500_INTERNAL_SERVER_ERROR, - "Internal Server Error", - ), - } - - if code in error_mapping: - status_code, detail = error_mapping[code] - raise HTTPException(status_code=status_code, detail=detail) - - return {"message": "No error occurred"} - - -# --------- Extras --------- -app.include_router( - pydantic_extra_types_router.router, - prefix="/extra_types", - tags=["Extra Types"], -) -app.include_router( - items_router.router, - prefix="/items", - tags=["items"], -) -app.include_router( - generic_router.router, - prefix="/generic", - tags=["generic"], -) -app.include_router( - union_router.router, - prefix="/union", - tags=["union"], -) diff --git a/frameworks/fastapi/app/router/generic_router.py b/frameworks/fastapi/app/router/generic_router.py deleted file mode 100644 index 7e61bbbf..00000000 --- a/frameworks/fastapi/app/router/generic_router.py +++ /dev/null @@ -1,153 +0,0 @@ -from typing import Generic, TypeVar - -from fastapi import APIRouter, Depends, Query, WebSocket, WebSocketDisconnect -from pydantic import BaseModel, Field - - -router = APIRouter() - - -class PaginationParams(BaseModel): - """Query parameters for pagination.""" - - page: int = Field( - default=1, - ge=1, - description="Page number", - ) - per_page: int = Field( - default=10, - ge=1, - le=100, - description="Number of items per page", - ) - - -PaginationItem = TypeVar("PaginationItem", bound=BaseModel) - - -class PaginationResponse(BaseModel, Generic[PaginationItem]): - """Response model for paginated data.""" - - items: list[PaginationItem] - total: int - page: int - per_page: int - total_pages: int - - -class ItemResponse(BaseModel): - id: int - name: str - - -class CategoryResponse(BaseModel): - id: int - name: str - - -BaseResponseItem = TypeVar("BaseResponseItem") - - -class BaseResponse(BaseModel, Generic[BaseResponseItem]): - data: BaseResponseItem - message: str - code: int - - -@router.get("/items") -async def get_items( - page: int = Query(default=1, ge=1), - per_page: int = Query(default=10, ge=1, le=100), -) -> PaginationResponse[ItemResponse]: - pagination = PaginationParams(page=page, per_page=per_page) - return PaginationResponse( - items=[ItemResponse(id=1, name="Item 1")], - total=10, - page=pagination.page, - per_page=pagination.per_page, - total_pages=1, - ) - - -class ConnectManager: - def __init__(self) -> None: - self.connections: list[WebSocket] = [] - - async def connect(self, websocket: WebSocket) -> None: - await websocket.accept() - self.connections.append(websocket) - - async def disconnect(self, websocket: WebSocket) -> None: - self.connections.remove(websocket) - - async def send_message(self, message: str) -> None: - for connection in self.connections: - await connection.send_text(message) - - -@router.websocket("/ws") -async def websocket_endpoint( - websocket: WebSocket, - manager: ConnectManager = Depends(ConnectManager), -) -> None: - await manager.connect(websocket) - try: - while True: - data = await websocket.receive_text() - await manager.send_message(f"Received: {data}") - except WebSocketDisconnect: - await manager.disconnect(websocket) - - -@router.get("/categories") -async def get_categories( - page: int = Query(default=1, ge=1), - per_page: int = Query(default=10, ge=1, le=100), -) -> PaginationResponse[CategoryResponse]: - pagination = PaginationParams(page=page, per_page=per_page) - return PaginationResponse( - items=[CategoryResponse(id=1, name="Category 1")], - total=10, - page=pagination.page, - per_page=pagination.per_page, - total_pages=1, - ) - - -@router.get("/base-response-item") -async def get_base_response_item(item: ItemResponse) -> BaseResponse[ItemResponse]: - return BaseResponse(data=item, message="Success", code=200) - - -@router.get("/base-response-category") -async def get_base_response_category( - category: CategoryResponse, -) -> BaseResponse[CategoryResponse]: - return BaseResponse(data=category, message="Success", code=200) - - -@router.get("/base-response-list") -async def get_base_response_list() -> BaseResponse[list[ItemResponse]]: - return BaseResponse( - data=[ItemResponse(id=1, name="Item 1")], - message="Success", - code=200, - ) - - -@router.get("/nested-base-and-pagination") -async def get_nested_base_and_pagination( - pagination: PaginationParams = Depends(PaginationParams), -) -> BaseResponse[PaginationResponse[ItemResponse]]: - return BaseResponse( - data=PaginationResponse( - items=[ItemResponse(id=1, name="Item 1")], - total=1, - page=pagination.page, - per_page=pagination.per_page, - total_pages=1, - ), - message="Success", - code=200, - ) diff --git a/frameworks/fastapi/app/router/items_router.py b/frameworks/fastapi/app/router/items_router.py deleted file mode 100644 index 9174312b..00000000 --- a/frameworks/fastapi/app/router/items_router.py +++ /dev/null @@ -1,31 +0,0 @@ -from typing import Optional -from fastapi import APIRouter -from pydantic import BaseModel - -router = APIRouter() - - -class ItemRequestBody(BaseModel): - name: str - description: Optional[str] - price: float - tax: Optional[float] = None - - -class ItemResponse(BaseModel): - id: int - name: str - description: Optional[str] - price: float - tax: Optional[float] = None - - -@router.post("/") -def create_item(item: ItemRequestBody) -> ItemResponse: - return ItemResponse( - id=1, - name=item.name, - description=item.description, - price=item.price, - tax=item.tax, - ) diff --git a/frameworks/fastapi/app/router/pydantic_extra_types_router.py b/frameworks/fastapi/app/router/pydantic_extra_types_router.py deleted file mode 100644 index 4854a028..00000000 --- a/frameworks/fastapi/app/router/pydantic_extra_types_router.py +++ /dev/null @@ -1,239 +0,0 @@ -from typing import Any, Optional - -import phonenumbers -from fastapi import APIRouter -from pydantic import BaseModel -from pydantic_extra_types.color import Color -from pydantic_extra_types.coordinate import Coordinate, Latitude, Longitude -from pydantic_extra_types.country import ( - CountryAlpha2, - CountryAlpha3, - CountryNumericCode, - CountryShortName, -) -from pydantic_extra_types.currency_code import ISO4217, Currency -from pydantic_extra_types.domain import DomainStr -from pydantic_extra_types.isbn import ISBN -from pydantic_extra_types.language_code import ( - ISO639_3, - ISO639_5, - LanguageAlpha2, - LanguageName, -) -from pydantic_extra_types.mac_address import MacAddress -from pydantic_extra_types.payment import PaymentCardBrand, PaymentCardNumber -from pydantic_extra_types.phone_numbers import PhoneNumber, PhoneNumberValidator -from pydantic_extra_types.routing_number import ABARoutingNumber -from pydantic_extra_types.s3 import S3Path -from pydantic_extra_types.script_code import ISO_15924 -from pydantic_extra_types.semantic_version import SemanticVersion -from pydantic_extra_types.timezone_name import TimeZoneName -from pydantic_extra_types.ulid import ULID -from typing_extensions import Annotated - -router = APIRouter() - - -# Color routes -class ColorModel(BaseModel): - color: Color - - -@router.post("/color/", response_model=dict[str, Any]) -async def create_color(color_model: ColorModel) -> dict[str, Any]: - color = color_model.color - return {"color": str(color), "as_rgb": color.as_rgb(), "as_hex": color.as_hex()} - - -# Country routes -class CountryModel(BaseModel): - alpha2: Optional[CountryAlpha2] = None - alpha3: Optional[CountryAlpha3] = None - numeric: Optional[CountryNumericCode] = None - short_name: Optional[CountryShortName] = None - - -@router.post("/country/", response_model=dict[str, Any]) -async def process_country(country: CountryModel) -> dict[str, Any]: - return {k: str(v) for k, v in country.model_dump(exclude_none=True).items()} - - -# Payment routes -class PaymentCardModel(BaseModel): - card_number: PaymentCardNumber - card_brand: Optional[PaymentCardBrand] = None - - -@router.post("/payment/", response_model=dict[str, Any]) -async def process_payment_card(payment_card: PaymentCardModel) -> dict[str, Any]: - return { - "number": str(payment_card.card_number), - "brand": str(payment_card.card_brand), - } - - -# Phone number route -class PhoneNumberModel(BaseModel): - phone: Annotated[ - phonenumbers.PhoneNumber, - PhoneNumberValidator(supported_regions=["US"], default_region="US"), - ] - phone2: PhoneNumber - - -@router.post("/phone/", response_model=dict[str, Any]) -async def process_phone(phone_model: PhoneNumberModel) -> dict[str, Any]: - return { - "phone": str(phone_model.phone), - "international": phone_model.phone.country_code_source, - "country_code": phone_model.phone.country_code, - "national": phone_model.phone.national_number, - } - - -# ABA Routing Number route -class ABARoutingModel(BaseModel): - routing_number: ABARoutingNumber - - -@router.post("/routing/", response_model=dict[str, Any]) -async def process_routing(routing: ABARoutingModel) -> dict[str, Any]: - return {"routing_number": str(routing.routing_number)} - - -# Coordinate routes -class CoordinateModel(BaseModel): - coordinate: Optional[Coordinate] = None - latitude: Optional[Latitude] = None - longitude: Optional[Longitude] = None - - -@router.post("/coordinate/", response_model=dict[str, Any]) -async def process_coordinate(coordinate_model: CoordinateModel) -> dict[str, Any]: - result: dict[str, Any] = {} - - if coordinate_model.coordinate: - result["coordinate"] = str(coordinate_model.coordinate) - if coordinate_model.latitude: - result["latitude"] = str(coordinate_model.latitude) - if coordinate_model.longitude: - result["longitude"] = str(coordinate_model.longitude) - return result - - -# MAC Address route -class MACAddressModel(BaseModel): - mac_address: MacAddress - - -@router.post("/mac/", response_model=dict[str, Any]) -async def process_mac(mac_model: MACAddressModel) -> dict[str, Any]: - return {"mac_address": str(mac_model.mac_address)} - - -# ISBN route -class ISBNModel(BaseModel): - isbn: ISBN - - -@router.post("/isbn/", response_model=dict[str, Any]) -async def process_isbn(isbn_model: ISBNModel) -> dict[str, Any]: - return {"isbn": str(isbn_model.isbn)} - - -# Currency route -class CurrencyModel(BaseModel): - currency: Optional[Currency] = None - iso4217: Optional[ISO4217] = None - - -@router.post("/currency/", response_model=dict[str, Any]) -async def process_currency(currency_model: CurrencyModel) -> dict[str, Any]: - result: dict[str, Any] = {} - if currency_model.currency: - result["currency"] = str(currency_model.currency) - if currency_model.iso4217: - result["iso4217"] = str(currency_model.iso4217) - return result - - -# Domain route -class DomainModel(BaseModel): - domain: DomainStr - - -@router.post("/domain/", response_model=dict[str, Any]) -async def process_domain(domain_model: DomainModel) -> dict[str, Any]: - return {"domain": domain_model.domain} - - -# Language code routes -class LanguageModel(BaseModel): - alpha2: Optional[LanguageAlpha2] = None - name: Optional[LanguageName] = None - iso639_3: Optional[ISO639_3] = None - iso639_5: Optional[ISO639_5] = None - - -@router.post("/language/", response_model=dict[str, Any]) -async def process_language(language_model: LanguageModel) -> dict[str, Any]: - return {k: str(v) for k, v in language_model.model_dump(exclude_none=True).items()} - - -# Script code route -class ScriptCodeModel(BaseModel): - script_code: ISO_15924 - - -@router.post("/script/", response_model=dict[str, Any]) -async def process_script(script_model: ScriptCodeModel) -> dict[str, Any]: - return {"script_code": str(script_model.script_code)} - - -# Semantic Version route -class VersionModel(BaseModel): - version: SemanticVersion - - -@router.post("/version/", response_model=dict[str, Any]) -async def process_version(version_model: VersionModel) -> dict[str, Any]: - version = version_model.version - return { - "version": str(version), - "major": version.major, - "minor": version.minor, - "patch": version.patch, - "prerelease": version.prerelease, - "build": version.build, - } - - -# S3Path route -class S3PathModel(BaseModel): - s3_path: S3Path - - -@router.post("/s3/", response_model=dict[str, Any]) -async def process_s3_path(s3_model: S3PathModel) -> dict[str, Any]: - path = s3_model.s3_path - return {"s3_path": str(path), "bucket": path.bucket, "key": path.key} - - -# TimeZoneName route -class TimeZoneModel(BaseModel): - timezone: TimeZoneName - - -@router.post("/timezone/", response_model=dict[str, Any]) -async def process_timezone(timezone_model: TimeZoneModel) -> dict[str, Any]: - return {"timezone": str(timezone_model.timezone)} - - -# ULID route -class ULIDModel(BaseModel): - ulid: ULID - - -@router.post("/ulid/", response_model=dict[str, Any]) -async def process_ulid(ulid_model: ULIDModel) -> dict[str, Any]: - return {"ulid": str(ulid_model.ulid)} diff --git a/frameworks/fastapi/app/router/union_router.py b/frameworks/fastapi/app/router/union_router.py deleted file mode 100644 index c2bd6e7d..00000000 --- a/frameworks/fastapi/app/router/union_router.py +++ /dev/null @@ -1,62 +0,0 @@ -from typing import ( - Annotated, - List, - Literal, - TypeAlias, -) - -from fastapi import APIRouter -from pydantic import BaseModel, Field - -router = APIRouter() - - -class Animal(BaseModel): - name: str = Field(examples=["Fido"], description="The animal's name") - - -class Dog(Animal): - type: Literal["dog"] = Field("dog", examples=["dog"]) - bark_loudness: int = Field( - ge=0, - le=10, - examples=[7], - description="How loud the dog barks (0-10)", - title="Bark Loudness", - ) - - -class Cat(Animal): - type: Literal["cat"] = Field("cat", examples=["cat"]) - meow_cuteness: int = Field( - ge=0, - le=10, - examples=[9], - description="How cute the cat's meow is (0-10)", - title="Meow Cuteness Level", - ) - - -class Parrot(Animal): - type: Literal["parrot"] = Field("parrot", examples=["parrot"]) - phrases: List[str] = Field( - examples=[["Hello!", "Polly wants a cracker"]], - description="Phrases the parrot can say", - ) - - -AnimalUnion = Dog | Cat | Parrot -AnimalUnionField: TypeAlias = Annotated[AnimalUnion, Field(discriminator="type")] - - -class CreateAnimalResponse(BaseModel): - animal: AnimalUnion - message: str - - -@router.post( - "/models/animal", - summary="Create an animal based on type discriminator", -) -def create_animal(animal: AnimalUnionField) -> CreateAnimalResponse: - return CreateAnimalResponse(animal=animal, message="Animal created successfully") diff --git a/frameworks/fastapi/pyproject.toml b/frameworks/fastapi/pyproject.toml deleted file mode 100644 index 47baaf59..00000000 --- a/frameworks/fastapi/pyproject.toml +++ /dev/null @@ -1,34 +0,0 @@ -[project] -name = "app" -version = "0.1.0" -description = "Simple Api to generate all kind of swagger types" -readme = "README.md" -requires-python = ">=3.10,<4.0" -dependencies = [ - "fastapi[standard]<1.0.0,>=0.114.2", - "pydantic>2.0", - "pydantic-settings<3.0.0,>=2.2.1", - "pydantic-extra-types[pendulum]>=2.10.3", - "pycountry>=24.6.1", - "phonenumbers>=9.0.2", - "python-ulid>=3.0.0", - "semver>=3.0.4", -] - -[tool.uv] -dev-dependencies = [ - "pytest<8.0.0,>=7.4.3", - "mypy<2.0.0,>=1.8.0", - "ruff<1.0.0,>=0.2.2", - "pre-commit<4.0.0,>=3.6.2", - "types-passlib<2.0.0.0,>=1.7.7.20240106", - "coverage<8.0.0,>=7.4.3", -] - - -[tool.mypy] -strict = true -exclude = ["venv", ".venv"] - -[tool.ruff] -target-version = "py310" diff --git a/frameworks/fastapi/uv.lock b/frameworks/fastapi/uv.lock deleted file mode 100644 index d4479b38..00000000 --- a/frameworks/fastapi/uv.lock +++ /dev/null @@ -1,1308 +0,0 @@ -version = 1 -revision = 1 -requires-python = ">=3.10, <4.0" - -[[package]] -name = "annotated-types" -version = "0.7.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643 }, -] - -[[package]] -name = "anyio" -version = "4.9.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "exceptiongroup", marker = "python_full_version < '3.11'" }, - { name = "idna" }, - { name = "sniffio" }, - { name = "typing-extensions", marker = "python_full_version < '3.13'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/95/7d/4c1bd541d4dffa1b52bd83fb8527089e097a106fc90b467a7313b105f840/anyio-4.9.0.tar.gz", hash = "sha256:673c0c244e15788651a4ff38710fea9675823028a6f08a5eda409e0c9840a028", size = 190949 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a1/ee/48ca1a7c89ffec8b6a0c5d02b89c305671d5ffd8d3c94acf8b8c408575bb/anyio-4.9.0-py3-none-any.whl", hash = "sha256:9f76d541cad6e36af7beb62e978876f3b41e3e04f2c1fbf0884604c0a9c4d93c", size = 100916 }, -] - -[[package]] -name = "app" -version = "0.1.0" -source = { virtual = "." } -dependencies = [ - { name = "fastapi", extra = ["standard"] }, - { name = "phonenumbers" }, - { name = "pycountry" }, - { name = "pydantic" }, - { name = "pydantic-extra-types", extra = ["pendulum"] }, - { name = "pydantic-settings" }, - { name = "python-ulid" }, - { name = "semver" }, -] - -[package.dev-dependencies] -dev = [ - { name = "coverage" }, - { name = "mypy" }, - { name = "pre-commit" }, - { name = "pytest" }, - { name = "ruff" }, - { name = "types-passlib" }, -] - -[package.metadata] -requires-dist = [ - { name = "fastapi", extras = ["standard"], specifier = ">=0.114.2,<1.0.0" }, - { name = "phonenumbers", specifier = ">=9.0.2" }, - { name = "pycountry", specifier = ">=24.6.1" }, - { name = "pydantic", specifier = ">2.0" }, - { name = "pydantic-extra-types", extras = ["pendulum"], specifier = ">=2.10.3" }, - { name = "pydantic-settings", specifier = ">=2.2.1,<3.0.0" }, - { name = "python-ulid", specifier = ">=3.0.0" }, - { name = "semver", specifier = ">=3.0.4" }, -] - -[package.metadata.requires-dev] -dev = [ - { name = "coverage", specifier = ">=7.4.3,<8.0.0" }, - { name = "mypy", specifier = ">=1.8.0,<2.0.0" }, - { name = "pre-commit", specifier = ">=3.6.2,<4.0.0" }, - { name = "pytest", specifier = ">=7.4.3,<8.0.0" }, - { name = "ruff", specifier = ">=0.2.2,<1.0.0" }, - { name = "types-passlib", specifier = ">=1.7.7.20240106,<2.0.0.0" }, -] - -[[package]] -name = "certifi" -version = "2025.1.31" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/1c/ab/c9f1e32b7b1bf505bf26f0ef697775960db7932abeb7b516de930ba2705f/certifi-2025.1.31.tar.gz", hash = "sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651", size = 167577 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/38/fc/bce832fd4fd99766c04d1ee0eead6b0ec6486fb100ae5e74c1d91292b982/certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe", size = 166393 }, -] - -[[package]] -name = "cfgv" -version = "3.4.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/11/74/539e56497d9bd1d484fd863dd69cbbfa653cd2aa27abfe35653494d85e94/cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560", size = 7114 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/c5/55/51844dd50c4fc7a33b653bfaba4c2456f06955289ca770a5dbd5fd267374/cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9", size = 7249 }, -] - -[[package]] -name = "click" -version = "8.1.8" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/7e/d4/7ebdbd03970677812aac39c869717059dbb71a4cfc033ca6e5221787892c/click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2", size = 98188 }, -] - -[[package]] -name = "colorama" -version = "0.4.6" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 }, -] - -[[package]] -name = "coverage" -version = "7.8.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/19/4f/2251e65033ed2ce1e68f00f91a0294e0f80c80ae8c3ebbe2f12828c4cd53/coverage-7.8.0.tar.gz", hash = "sha256:7a3d62b3b03b4b6fd41a085f3574874cf946cb4604d2b4d3e8dca8cd570ca501", size = 811872 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/78/01/1c5e6ee4ebaaa5e079db933a9a45f61172048c7efa06648445821a201084/coverage-7.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2931f66991175369859b5fd58529cd4b73582461877ecfd859b6549869287ffe", size = 211379 }, - { url = "https://files.pythonhosted.org/packages/e9/16/a463389f5ff916963471f7c13585e5f38c6814607306b3cb4d6b4cf13384/coverage-7.8.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:52a523153c568d2c0ef8826f6cc23031dc86cffb8c6aeab92c4ff776e7951b28", size = 211814 }, - { url = "https://files.pythonhosted.org/packages/b8/b1/77062b0393f54d79064dfb72d2da402657d7c569cfbc724d56ac0f9c67ed/coverage-7.8.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c8a5c139aae4c35cbd7cadca1df02ea8cf28a911534fc1b0456acb0b14234f3", size = 240937 }, - { url = "https://files.pythonhosted.org/packages/d7/54/c7b00a23150083c124e908c352db03bcd33375494a4beb0c6d79b35448b9/coverage-7.8.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5a26c0c795c3e0b63ec7da6efded5f0bc856d7c0b24b2ac84b4d1d7bc578d676", size = 238849 }, - { url = "https://files.pythonhosted.org/packages/f7/ec/a6b7cfebd34e7b49f844788fda94713035372b5200c23088e3bbafb30970/coverage-7.8.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:821f7bcbaa84318287115d54becb1915eece6918136c6f91045bb84e2f88739d", size = 239986 }, - { url = "https://files.pythonhosted.org/packages/21/8c/c965ecef8af54e6d9b11bfbba85d4f6a319399f5f724798498387f3209eb/coverage-7.8.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:a321c61477ff8ee705b8a5fed370b5710c56b3a52d17b983d9215861e37b642a", size = 239896 }, - { url = "https://files.pythonhosted.org/packages/40/83/070550273fb4c480efa8381735969cb403fa8fd1626d74865bfaf9e4d903/coverage-7.8.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:ed2144b8a78f9d94d9515963ed273d620e07846acd5d4b0a642d4849e8d91a0c", size = 238613 }, - { url = "https://files.pythonhosted.org/packages/07/76/fbb2540495b01d996d38e9f8897b861afed356be01160ab4e25471f4fed1/coverage-7.8.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:042e7841a26498fff7a37d6fda770d17519982f5b7d8bf5278d140b67b61095f", size = 238909 }, - { url = "https://files.pythonhosted.org/packages/a3/7e/76d604db640b7d4a86e5dd730b73e96e12a8185f22b5d0799025121f4dcb/coverage-7.8.0-cp310-cp310-win32.whl", hash = "sha256:f9983d01d7705b2d1f7a95e10bbe4091fabc03a46881a256c2787637b087003f", size = 213948 }, - { url = "https://files.pythonhosted.org/packages/5c/a7/f8ce4aafb4a12ab475b56c76a71a40f427740cf496c14e943ade72e25023/coverage-7.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:5a570cd9bd20b85d1a0d7b009aaf6c110b52b5755c17be6962f8ccd65d1dbd23", size = 214844 }, - { url = "https://files.pythonhosted.org/packages/2b/77/074d201adb8383addae5784cb8e2dac60bb62bfdf28b2b10f3a3af2fda47/coverage-7.8.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:e7ac22a0bb2c7c49f441f7a6d46c9c80d96e56f5a8bc6972529ed43c8b694e27", size = 211493 }, - { url = "https://files.pythonhosted.org/packages/a9/89/7a8efe585750fe59b48d09f871f0e0c028a7b10722b2172dfe021fa2fdd4/coverage-7.8.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bf13d564d310c156d1c8e53877baf2993fb3073b2fc9f69790ca6a732eb4bfea", size = 211921 }, - { url = "https://files.pythonhosted.org/packages/e9/ef/96a90c31d08a3f40c49dbe897df4f1fd51fb6583821a1a1c5ee30cc8f680/coverage-7.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a5761c70c017c1b0d21b0815a920ffb94a670c8d5d409d9b38857874c21f70d7", size = 244556 }, - { url = "https://files.pythonhosted.org/packages/89/97/dcd5c2ce72cee9d7b0ee8c89162c24972fb987a111b92d1a3d1d19100c61/coverage-7.8.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e5ff52d790c7e1628241ffbcaeb33e07d14b007b6eb00a19320c7b8a7024c040", size = 242245 }, - { url = "https://files.pythonhosted.org/packages/b2/7b/b63cbb44096141ed435843bbb251558c8e05cc835c8da31ca6ffb26d44c0/coverage-7.8.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d39fc4817fd67b3915256af5dda75fd4ee10621a3d484524487e33416c6f3543", size = 244032 }, - { url = "https://files.pythonhosted.org/packages/97/e3/7fa8c2c00a1ef530c2a42fa5df25a6971391f92739d83d67a4ee6dcf7a02/coverage-7.8.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:b44674870709017e4b4036e3d0d6c17f06a0e6d4436422e0ad29b882c40697d2", size = 243679 }, - { url = "https://files.pythonhosted.org/packages/4f/b3/e0a59d8df9150c8a0c0841d55d6568f0a9195692136c44f3d21f1842c8f6/coverage-7.8.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8f99eb72bf27cbb167b636eb1726f590c00e1ad375002230607a844d9e9a2318", size = 241852 }, - { url = "https://files.pythonhosted.org/packages/9b/82/db347ccd57bcef150c173df2ade97976a8367a3be7160e303e43dd0c795f/coverage-7.8.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b571bf5341ba8c6bc02e0baeaf3b061ab993bf372d982ae509807e7f112554e9", size = 242389 }, - { url = "https://files.pythonhosted.org/packages/21/f6/3f7d7879ceb03923195d9ff294456241ed05815281f5254bc16ef71d6a20/coverage-7.8.0-cp311-cp311-win32.whl", hash = "sha256:e75a2ad7b647fd8046d58c3132d7eaf31b12d8a53c0e4b21fa9c4d23d6ee6d3c", size = 213997 }, - { url = "https://files.pythonhosted.org/packages/28/87/021189643e18ecf045dbe1e2071b2747901f229df302de01c998eeadf146/coverage-7.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:3043ba1c88b2139126fc72cb48574b90e2e0546d4c78b5299317f61b7f718b78", size = 214911 }, - { url = "https://files.pythonhosted.org/packages/aa/12/4792669473297f7973518bec373a955e267deb4339286f882439b8535b39/coverage-7.8.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:bbb5cc845a0292e0c520656d19d7ce40e18d0e19b22cb3e0409135a575bf79fc", size = 211684 }, - { url = "https://files.pythonhosted.org/packages/be/e1/2a4ec273894000ebedd789e8f2fc3813fcaf486074f87fd1c5b2cb1c0a2b/coverage-7.8.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4dfd9a93db9e78666d178d4f08a5408aa3f2474ad4d0e0378ed5f2ef71640cb6", size = 211935 }, - { url = "https://files.pythonhosted.org/packages/f8/3a/7b14f6e4372786709a361729164125f6b7caf4024ce02e596c4a69bccb89/coverage-7.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f017a61399f13aa6d1039f75cd467be388d157cd81f1a119b9d9a68ba6f2830d", size = 245994 }, - { url = "https://files.pythonhosted.org/packages/54/80/039cc7f1f81dcbd01ea796d36d3797e60c106077e31fd1f526b85337d6a1/coverage-7.8.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0915742f4c82208ebf47a2b154a5334155ed9ef9fe6190674b8a46c2fb89cb05", size = 242885 }, - { url = "https://files.pythonhosted.org/packages/10/e0/dc8355f992b6cc2f9dcd5ef6242b62a3f73264893bc09fbb08bfcab18eb4/coverage-7.8.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8a40fcf208e021eb14b0fac6bdb045c0e0cab53105f93ba0d03fd934c956143a", size = 245142 }, - { url = "https://files.pythonhosted.org/packages/43/1b/33e313b22cf50f652becb94c6e7dae25d8f02e52e44db37a82de9ac357e8/coverage-7.8.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a1f406a8e0995d654b2ad87c62caf6befa767885301f3b8f6f73e6f3c31ec3a6", size = 244906 }, - { url = "https://files.pythonhosted.org/packages/05/08/c0a8048e942e7f918764ccc99503e2bccffba1c42568693ce6955860365e/coverage-7.8.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:77af0f6447a582fdc7de5e06fa3757a3ef87769fbb0fdbdeba78c23049140a47", size = 243124 }, - { url = "https://files.pythonhosted.org/packages/5b/62/ea625b30623083c2aad645c9a6288ad9fc83d570f9adb913a2abdba562dd/coverage-7.8.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:f2d32f95922927186c6dbc8bc60df0d186b6edb828d299ab10898ef3f40052fe", size = 244317 }, - { url = "https://files.pythonhosted.org/packages/62/cb/3871f13ee1130a6c8f020e2f71d9ed269e1e2124aa3374d2180ee451cee9/coverage-7.8.0-cp312-cp312-win32.whl", hash = "sha256:769773614e676f9d8e8a0980dd7740f09a6ea386d0f383db6821df07d0f08545", size = 214170 }, - { url = "https://files.pythonhosted.org/packages/88/26/69fe1193ab0bfa1eb7a7c0149a066123611baba029ebb448500abd8143f9/coverage-7.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:e5d2b9be5b0693cf21eb4ce0ec8d211efb43966f6657807f6859aab3814f946b", size = 214969 }, - { url = "https://files.pythonhosted.org/packages/f3/21/87e9b97b568e223f3438d93072479c2f36cc9b3f6b9f7094b9d50232acc0/coverage-7.8.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5ac46d0c2dd5820ce93943a501ac5f6548ea81594777ca585bf002aa8854cacd", size = 211708 }, - { url = "https://files.pythonhosted.org/packages/75/be/882d08b28a0d19c9c4c2e8a1c6ebe1f79c9c839eb46d4fca3bd3b34562b9/coverage-7.8.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:771eb7587a0563ca5bb6f622b9ed7f9d07bd08900f7589b4febff05f469bea00", size = 211981 }, - { url = "https://files.pythonhosted.org/packages/7a/1d/ce99612ebd58082fbe3f8c66f6d8d5694976c76a0d474503fa70633ec77f/coverage-7.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42421e04069fb2cbcbca5a696c4050b84a43b05392679d4068acbe65449b5c64", size = 245495 }, - { url = "https://files.pythonhosted.org/packages/dc/8d/6115abe97df98db6b2bd76aae395fcc941d039a7acd25f741312ced9a78f/coverage-7.8.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:554fec1199d93ab30adaa751db68acec2b41c5602ac944bb19187cb9a41a8067", size = 242538 }, - { url = "https://files.pythonhosted.org/packages/cb/74/2f8cc196643b15bc096d60e073691dadb3dca48418f08bc78dd6e899383e/coverage-7.8.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5aaeb00761f985007b38cf463b1d160a14a22c34eb3f6a39d9ad6fc27cb73008", size = 244561 }, - { url = "https://files.pythonhosted.org/packages/22/70/c10c77cd77970ac965734fe3419f2c98665f6e982744a9bfb0e749d298f4/coverage-7.8.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:581a40c7b94921fffd6457ffe532259813fc68eb2bdda60fa8cc343414ce3733", size = 244633 }, - { url = "https://files.pythonhosted.org/packages/38/5a/4f7569d946a07c952688debee18c2bb9ab24f88027e3d71fd25dbc2f9dca/coverage-7.8.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:f319bae0321bc838e205bf9e5bc28f0a3165f30c203b610f17ab5552cff90323", size = 242712 }, - { url = "https://files.pythonhosted.org/packages/bb/a1/03a43b33f50475a632a91ea8c127f7e35e53786dbe6781c25f19fd5a65f8/coverage-7.8.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:04bfec25a8ef1c5f41f5e7e5c842f6b615599ca8ba8391ec33a9290d9d2db3a3", size = 244000 }, - { url = "https://files.pythonhosted.org/packages/6a/89/ab6c43b1788a3128e4d1b7b54214548dcad75a621f9d277b14d16a80d8a1/coverage-7.8.0-cp313-cp313-win32.whl", hash = "sha256:dd19608788b50eed889e13a5d71d832edc34fc9dfce606f66e8f9f917eef910d", size = 214195 }, - { url = "https://files.pythonhosted.org/packages/12/12/6bf5f9a8b063d116bac536a7fb594fc35cb04981654cccb4bbfea5dcdfa0/coverage-7.8.0-cp313-cp313-win_amd64.whl", hash = "sha256:a9abbccd778d98e9c7e85038e35e91e67f5b520776781d9a1e2ee9d400869487", size = 214998 }, - { url = "https://files.pythonhosted.org/packages/2a/e6/1e9df74ef7a1c983a9c7443dac8aac37a46f1939ae3499424622e72a6f78/coverage-7.8.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:18c5ae6d061ad5b3e7eef4363fb27a0576012a7447af48be6c75b88494c6cf25", size = 212541 }, - { url = "https://files.pythonhosted.org/packages/04/51/c32174edb7ee49744e2e81c4b1414ac9df3dacfcb5b5f273b7f285ad43f6/coverage-7.8.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:95aa6ae391a22bbbce1b77ddac846c98c5473de0372ba5c463480043a07bff42", size = 212767 }, - { url = "https://files.pythonhosted.org/packages/e9/8f/f454cbdb5212f13f29d4a7983db69169f1937e869a5142bce983ded52162/coverage-7.8.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e013b07ba1c748dacc2a80e69a46286ff145935f260eb8c72df7185bf048f502", size = 256997 }, - { url = "https://files.pythonhosted.org/packages/e6/74/2bf9e78b321216d6ee90a81e5c22f912fc428442c830c4077b4a071db66f/coverage-7.8.0-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d766a4f0e5aa1ba056ec3496243150698dc0481902e2b8559314368717be82b1", size = 252708 }, - { url = "https://files.pythonhosted.org/packages/92/4d/50d7eb1e9a6062bee6e2f92e78b0998848a972e9afad349b6cdde6fa9e32/coverage-7.8.0-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ad80e6b4a0c3cb6f10f29ae4c60e991f424e6b14219d46f1e7d442b938ee68a4", size = 255046 }, - { url = "https://files.pythonhosted.org/packages/40/9e/71fb4e7402a07c4198ab44fc564d09d7d0ffca46a9fb7b0a7b929e7641bd/coverage-7.8.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:b87eb6fc9e1bb8f98892a2458781348fa37e6925f35bb6ceb9d4afd54ba36c73", size = 256139 }, - { url = "https://files.pythonhosted.org/packages/49/1a/78d37f7a42b5beff027e807c2843185961fdae7fe23aad5a4837c93f9d25/coverage-7.8.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:d1ba00ae33be84066cfbe7361d4e04dec78445b2b88bdb734d0d1cbab916025a", size = 254307 }, - { url = "https://files.pythonhosted.org/packages/58/e9/8fb8e0ff6bef5e170ee19d59ca694f9001b2ec085dc99b4f65c128bb3f9a/coverage-7.8.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:f3c38e4e5ccbdc9198aecc766cedbb134b2d89bf64533973678dfcf07effd883", size = 255116 }, - { url = "https://files.pythonhosted.org/packages/56/b0/d968ecdbe6fe0a863de7169bbe9e8a476868959f3af24981f6a10d2b6924/coverage-7.8.0-cp313-cp313t-win32.whl", hash = "sha256:379fe315e206b14e21db5240f89dc0774bdd3e25c3c58c2c733c99eca96f1ada", size = 214909 }, - { url = "https://files.pythonhosted.org/packages/87/e9/d6b7ef9fecf42dfb418d93544af47c940aa83056c49e6021a564aafbc91f/coverage-7.8.0-cp313-cp313t-win_amd64.whl", hash = "sha256:2e4b6b87bb0c846a9315e3ab4be2d52fac905100565f4b92f02c445c8799e257", size = 216068 }, - { url = "https://files.pythonhosted.org/packages/c4/f1/1da77bb4c920aa30e82fa9b6ea065da3467977c2e5e032e38e66f1c57ffd/coverage-7.8.0-pp39.pp310.pp311-none-any.whl", hash = "sha256:b8194fb8e50d556d5849753de991d390c5a1edeeba50f68e3a9253fbd8bf8ccd", size = 203443 }, - { url = "https://files.pythonhosted.org/packages/59/f1/4da7717f0063a222db253e7121bd6a56f6fb1ba439dcc36659088793347c/coverage-7.8.0-py3-none-any.whl", hash = "sha256:dbf364b4c5e7bae9250528167dfe40219b62e2d573c854d74be213e1e52069f7", size = 203435 }, -] - -[[package]] -name = "distlib" -version = "0.3.9" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/0d/dd/1bec4c5ddb504ca60fc29472f3d27e8d4da1257a854e1d96742f15c1d02d/distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403", size = 613923 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/91/a1/cf2472db20f7ce4a6be1253a81cfdf85ad9c7885ffbed7047fb72c24cf87/distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87", size = 468973 }, -] - -[[package]] -name = "dnspython" -version = "2.7.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/b5/4a/263763cb2ba3816dd94b08ad3a33d5fdae34ecb856678773cc40a3605829/dnspython-2.7.0.tar.gz", hash = "sha256:ce9c432eda0dc91cf618a5cedf1a4e142651196bbcd2c80e89ed5a907e5cfaf1", size = 345197 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/68/1b/e0a87d256e40e8c888847551b20a017a6b98139178505dc7ffb96f04e954/dnspython-2.7.0-py3-none-any.whl", hash = "sha256:b4c34b7d10b51bcc3a5071e7b8dee77939f1e878477eeecc965e9835f63c6c86", size = 313632 }, -] - -[[package]] -name = "email-validator" -version = "2.2.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "dnspython" }, - { name = "idna" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/48/ce/13508a1ec3f8bb981ae4ca79ea40384becc868bfae97fd1c942bb3a001b1/email_validator-2.2.0.tar.gz", hash = "sha256:cb690f344c617a714f22e66ae771445a1ceb46821152df8e165c5f9a364582b7", size = 48967 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/d7/ee/bf0adb559ad3c786f12bcbc9296b3f5675f529199bef03e2df281fa1fadb/email_validator-2.2.0-py3-none-any.whl", hash = "sha256:561977c2d73ce3611850a06fa56b414621e0c8faa9d66f2611407d87465da631", size = 33521 }, -] - -[[package]] -name = "exceptiongroup" -version = "1.2.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/09/35/2495c4ac46b980e4ca1f6ad6db102322ef3ad2410b79fdde159a4b0f3b92/exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc", size = 28883 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/02/cc/b7e31358aac6ed1ef2bb790a9746ac2c69bcb3c8588b41616914eb106eaf/exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b", size = 16453 }, -] - -[[package]] -name = "fastapi" -version = "0.115.12" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "pydantic" }, - { name = "starlette" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/f4/55/ae499352d82338331ca1e28c7f4a63bfd09479b16395dce38cf50a39e2c2/fastapi-0.115.12.tar.gz", hash = "sha256:1e2c2a2646905f9e83d32f04a3f86aff4a286669c6c950ca95b5fd68c2602681", size = 295236 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/50/b3/b51f09c2ba432a576fe63758bddc81f78f0c6309d9e5c10d194313bf021e/fastapi-0.115.12-py3-none-any.whl", hash = "sha256:e94613d6c05e27be7ffebdd6ea5f388112e5e430c8f7d6494a9d1d88d43e814d", size = 95164 }, -] - -[package.optional-dependencies] -standard = [ - { name = "email-validator" }, - { name = "fastapi-cli", extra = ["standard"] }, - { name = "httpx" }, - { name = "jinja2" }, - { name = "python-multipart" }, - { name = "uvicorn", extra = ["standard"] }, -] - -[[package]] -name = "fastapi-cli" -version = "0.0.7" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "rich-toolkit" }, - { name = "typer" }, - { name = "uvicorn", extra = ["standard"] }, -] -sdist = { url = "https://files.pythonhosted.org/packages/fe/73/82a5831fbbf8ed75905bacf5b2d9d3dfd6f04d6968b29fe6f72a5ae9ceb1/fastapi_cli-0.0.7.tar.gz", hash = "sha256:02b3b65956f526412515907a0793c9094abd4bfb5457b389f645b0ea6ba3605e", size = 16753 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a1/e6/5daefc851b514ce2287d8f5d358ae4341089185f78f3217a69d0ce3a390c/fastapi_cli-0.0.7-py3-none-any.whl", hash = "sha256:d549368ff584b2804336c61f192d86ddea080c11255f375959627911944804f4", size = 10705 }, -] - -[package.optional-dependencies] -standard = [ - { name = "uvicorn", extra = ["standard"] }, -] - -[[package]] -name = "filelock" -version = "3.18.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/0a/10/c23352565a6544bdc5353e0b15fc1c563352101f30e24bf500207a54df9a/filelock-3.18.0.tar.gz", hash = "sha256:adbc88eabb99d2fec8c9c1b229b171f18afa655400173ddc653d5d01501fb9f2", size = 18075 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/4d/36/2a115987e2d8c300a974597416d9de88f2444426de9571f4b59b2cca3acc/filelock-3.18.0-py3-none-any.whl", hash = "sha256:c401f4f8377c4464e6db25fff06205fd89bdd83b65eb0488ed1b160f780e21de", size = 16215 }, -] - -[[package]] -name = "h11" -version = "0.14.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/f5/38/3af3d3633a34a3316095b39c8e8fb4853a28a536e55d347bd8d8e9a14b03/h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d", size = 100418 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/95/04/ff642e65ad6b90db43e668d70ffb6736436c7ce41fcc549f4e9472234127/h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761", size = 58259 }, -] - -[[package]] -name = "httpcore" -version = "1.0.7" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "certifi" }, - { name = "h11" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/6a/41/d7d0a89eb493922c37d343b607bc1b5da7f5be7e383740b4753ad8943e90/httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c", size = 85196 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/87/f5/72347bc88306acb359581ac4d52f23c0ef445b57157adedb9aee0cd689d2/httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd", size = 78551 }, -] - -[[package]] -name = "httptools" -version = "0.6.4" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/a7/9a/ce5e1f7e131522e6d3426e8e7a490b3a01f39a6696602e1c4f33f9e94277/httptools-0.6.4.tar.gz", hash = "sha256:4e93eee4add6493b59a5c514da98c939b244fce4a0d8879cd3f466562f4b7d5c", size = 240639 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/3b/6f/972f8eb0ea7d98a1c6be436e2142d51ad2a64ee18e02b0e7ff1f62171ab1/httptools-0.6.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3c73ce323711a6ffb0d247dcd5a550b8babf0f757e86a52558fe5b86d6fefcc0", size = 198780 }, - { url = "https://files.pythonhosted.org/packages/6a/b0/17c672b4bc5c7ba7f201eada4e96c71d0a59fbc185e60e42580093a86f21/httptools-0.6.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:345c288418f0944a6fe67be8e6afa9262b18c7626c3ef3c28adc5eabc06a68da", size = 103297 }, - { url = "https://files.pythonhosted.org/packages/92/5e/b4a826fe91971a0b68e8c2bd4e7db3e7519882f5a8ccdb1194be2b3ab98f/httptools-0.6.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:deee0e3343f98ee8047e9f4c5bc7cedbf69f5734454a94c38ee829fb2d5fa3c1", size = 443130 }, - { url = "https://files.pythonhosted.org/packages/b0/51/ce61e531e40289a681a463e1258fa1e05e0be54540e40d91d065a264cd8f/httptools-0.6.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ca80b7485c76f768a3bc83ea58373f8db7b015551117375e4918e2aa77ea9b50", size = 442148 }, - { url = "https://files.pythonhosted.org/packages/ea/9e/270b7d767849b0c96f275c695d27ca76c30671f8eb8cc1bab6ced5c5e1d0/httptools-0.6.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:90d96a385fa941283ebd231464045187a31ad932ebfa541be8edf5b3c2328959", size = 415949 }, - { url = "https://files.pythonhosted.org/packages/81/86/ced96e3179c48c6f656354e106934e65c8963d48b69be78f355797f0e1b3/httptools-0.6.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:59e724f8b332319e2875efd360e61ac07f33b492889284a3e05e6d13746876f4", size = 417591 }, - { url = "https://files.pythonhosted.org/packages/75/73/187a3f620ed3175364ddb56847d7a608a6fc42d551e133197098c0143eca/httptools-0.6.4-cp310-cp310-win_amd64.whl", hash = "sha256:c26f313951f6e26147833fc923f78f95604bbec812a43e5ee37f26dc9e5a686c", size = 88344 }, - { url = "https://files.pythonhosted.org/packages/7b/26/bb526d4d14c2774fe07113ca1db7255737ffbb119315839af2065abfdac3/httptools-0.6.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:f47f8ed67cc0ff862b84a1189831d1d33c963fb3ce1ee0c65d3b0cbe7b711069", size = 199029 }, - { url = "https://files.pythonhosted.org/packages/a6/17/3e0d3e9b901c732987a45f4f94d4e2c62b89a041d93db89eafb262afd8d5/httptools-0.6.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0614154d5454c21b6410fdf5262b4a3ddb0f53f1e1721cfd59d55f32138c578a", size = 103492 }, - { url = "https://files.pythonhosted.org/packages/b7/24/0fe235d7b69c42423c7698d086d4db96475f9b50b6ad26a718ef27a0bce6/httptools-0.6.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f8787367fbdfccae38e35abf7641dafc5310310a5987b689f4c32cc8cc3ee975", size = 462891 }, - { url = "https://files.pythonhosted.org/packages/b1/2f/205d1f2a190b72da6ffb5f41a3736c26d6fa7871101212b15e9b5cd8f61d/httptools-0.6.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40b0f7fe4fd38e6a507bdb751db0379df1e99120c65fbdc8ee6c1d044897a636", size = 459788 }, - { url = "https://files.pythonhosted.org/packages/6e/4c/d09ce0eff09057a206a74575ae8f1e1e2f0364d20e2442224f9e6612c8b9/httptools-0.6.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:40a5ec98d3f49904b9fe36827dcf1aadfef3b89e2bd05b0e35e94f97c2b14721", size = 433214 }, - { url = "https://files.pythonhosted.org/packages/3e/d2/84c9e23edbccc4a4c6f96a1b8d99dfd2350289e94f00e9ccc7aadde26fb5/httptools-0.6.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:dacdd3d10ea1b4ca9df97a0a303cbacafc04b5cd375fa98732678151643d4988", size = 434120 }, - { url = "https://files.pythonhosted.org/packages/d0/46/4d8e7ba9581416de1c425b8264e2cadd201eb709ec1584c381f3e98f51c1/httptools-0.6.4-cp311-cp311-win_amd64.whl", hash = "sha256:288cd628406cc53f9a541cfaf06041b4c71d751856bab45e3702191f931ccd17", size = 88565 }, - { url = "https://files.pythonhosted.org/packages/bb/0e/d0b71465c66b9185f90a091ab36389a7352985fe857e352801c39d6127c8/httptools-0.6.4-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:df017d6c780287d5c80601dafa31f17bddb170232d85c066604d8558683711a2", size = 200683 }, - { url = "https://files.pythonhosted.org/packages/e2/b8/412a9bb28d0a8988de3296e01efa0bd62068b33856cdda47fe1b5e890954/httptools-0.6.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:85071a1e8c2d051b507161f6c3e26155b5c790e4e28d7f236422dbacc2a9cc44", size = 104337 }, - { url = "https://files.pythonhosted.org/packages/9b/01/6fb20be3196ffdc8eeec4e653bc2a275eca7f36634c86302242c4fbb2760/httptools-0.6.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69422b7f458c5af875922cdb5bd586cc1f1033295aa9ff63ee196a87519ac8e1", size = 508796 }, - { url = "https://files.pythonhosted.org/packages/f7/d8/b644c44acc1368938317d76ac991c9bba1166311880bcc0ac297cb9d6bd7/httptools-0.6.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:16e603a3bff50db08cd578d54f07032ca1631450ceb972c2f834c2b860c28ea2", size = 510837 }, - { url = "https://files.pythonhosted.org/packages/52/d8/254d16a31d543073a0e57f1c329ca7378d8924e7e292eda72d0064987486/httptools-0.6.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ec4f178901fa1834d4a060320d2f3abc5c9e39766953d038f1458cb885f47e81", size = 485289 }, - { url = "https://files.pythonhosted.org/packages/5f/3c/4aee161b4b7a971660b8be71a92c24d6c64372c1ab3ae7f366b3680df20f/httptools-0.6.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:f9eb89ecf8b290f2e293325c646a211ff1c2493222798bb80a530c5e7502494f", size = 489779 }, - { url = "https://files.pythonhosted.org/packages/12/b7/5cae71a8868e555f3f67a50ee7f673ce36eac970f029c0c5e9d584352961/httptools-0.6.4-cp312-cp312-win_amd64.whl", hash = "sha256:db78cb9ca56b59b016e64b6031eda5653be0589dba2b1b43453f6e8b405a0970", size = 88634 }, - { url = "https://files.pythonhosted.org/packages/94/a3/9fe9ad23fd35f7de6b91eeb60848986058bd8b5a5c1e256f5860a160cc3e/httptools-0.6.4-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ade273d7e767d5fae13fa637f4d53b6e961fb7fd93c7797562663f0171c26660", size = 197214 }, - { url = "https://files.pythonhosted.org/packages/ea/d9/82d5e68bab783b632023f2fa31db20bebb4e89dfc4d2293945fd68484ee4/httptools-0.6.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:856f4bc0478ae143bad54a4242fccb1f3f86a6e1be5548fecfd4102061b3a083", size = 102431 }, - { url = "https://files.pythonhosted.org/packages/96/c1/cb499655cbdbfb57b577734fde02f6fa0bbc3fe9fb4d87b742b512908dff/httptools-0.6.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:322d20ea9cdd1fa98bd6a74b77e2ec5b818abdc3d36695ab402a0de8ef2865a3", size = 473121 }, - { url = "https://files.pythonhosted.org/packages/af/71/ee32fd358f8a3bb199b03261f10921716990808a675d8160b5383487a317/httptools-0.6.4-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4d87b29bd4486c0093fc64dea80231f7c7f7eb4dc70ae394d70a495ab8436071", size = 473805 }, - { url = "https://files.pythonhosted.org/packages/8a/0a/0d4df132bfca1507114198b766f1737d57580c9ad1cf93c1ff673e3387be/httptools-0.6.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:342dd6946aa6bda4b8f18c734576106b8a31f2fe31492881a9a160ec84ff4bd5", size = 448858 }, - { url = "https://files.pythonhosted.org/packages/1e/6a/787004fdef2cabea27bad1073bf6a33f2437b4dbd3b6fb4a9d71172b1c7c/httptools-0.6.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4b36913ba52008249223042dca46e69967985fb4051951f94357ea681e1f5dc0", size = 452042 }, - { url = "https://files.pythonhosted.org/packages/4d/dc/7decab5c404d1d2cdc1bb330b1bf70e83d6af0396fd4fc76fc60c0d522bf/httptools-0.6.4-cp313-cp313-win_amd64.whl", hash = "sha256:28908df1b9bb8187393d5b5db91435ccc9c8e891657f9cbb42a2541b44c82fc8", size = 87682 }, -] - -[[package]] -name = "httpx" -version = "0.28.1" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "anyio" }, - { name = "certifi" }, - { name = "httpcore" }, - { name = "idna" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517 }, -] - -[[package]] -name = "identify" -version = "2.6.9" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/9b/98/a71ab060daec766acc30fb47dfca219d03de34a70d616a79a38c6066c5bf/identify-2.6.9.tar.gz", hash = "sha256:d40dfe3142a1421d8518e3d3985ef5ac42890683e32306ad614a29490abeb6bf", size = 99249 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/07/ce/0845144ed1f0e25db5e7a79c2354c1da4b5ce392b8966449d5db8dca18f1/identify-2.6.9-py2.py3-none-any.whl", hash = "sha256:c98b4322da415a8e5a70ff6e51fbc2d2932c015532d77e9f8537b4ba7813b150", size = 99101 }, -] - -[[package]] -name = "idna" -version = "3.10" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/f1/70/7703c29685631f5a7590aa73f1f1d3fa9a380e654b86af429e0934a32f7d/idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9", size = 190490 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442 }, -] - -[[package]] -name = "iniconfig" -version = "2.1.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/f2/97/ebf4da567aa6827c909642694d71c9fcf53e5b504f2d96afea02718862f3/iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7", size = 4793 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/2c/e1/e6716421ea10d38022b952c159d5161ca1193197fb744506875fbb87ea7b/iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760", size = 6050 }, -] - -[[package]] -name = "jinja2" -version = "3.1.6" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "markupsafe" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d", size = 245115 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899 }, -] - -[[package]] -name = "markdown-it-py" -version = "3.0.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "mdurl" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/38/71/3b932df36c1a044d397a1f92d1cf91ee0a503d91e470cbd670aa66b07ed0/markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb", size = 74596 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1", size = 87528 }, -] - -[[package]] -name = "markupsafe" -version = "3.0.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/b2/97/5d42485e71dfc078108a86d6de8fa46db44a1a9295e89c5d6d4a06e23a62/markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0", size = 20537 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/04/90/d08277ce111dd22f77149fd1a5d4653eeb3b3eaacbdfcbae5afb2600eebd/MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8", size = 14357 }, - { url = "https://files.pythonhosted.org/packages/04/e1/6e2194baeae0bca1fae6629dc0cbbb968d4d941469cbab11a3872edff374/MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158", size = 12393 }, - { url = "https://files.pythonhosted.org/packages/1d/69/35fa85a8ece0a437493dc61ce0bb6d459dcba482c34197e3efc829aa357f/MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:38a9ef736c01fccdd6600705b09dc574584b89bea478200c5fbf112a6b0d5579", size = 21732 }, - { url = "https://files.pythonhosted.org/packages/22/35/137da042dfb4720b638d2937c38a9c2df83fe32d20e8c8f3185dbfef05f7/MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d", size = 20866 }, - { url = "https://files.pythonhosted.org/packages/29/28/6d029a903727a1b62edb51863232152fd335d602def598dade38996887f0/MarkupSafe-3.0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:57cb5a3cf367aeb1d316576250f65edec5bb3be939e9247ae594b4bcbc317dfb", size = 20964 }, - { url = "https://files.pythonhosted.org/packages/cc/cd/07438f95f83e8bc028279909d9c9bd39e24149b0d60053a97b2bc4f8aa51/MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:3809ede931876f5b2ec92eef964286840ed3540dadf803dd570c3b7e13141a3b", size = 21977 }, - { url = "https://files.pythonhosted.org/packages/29/01/84b57395b4cc062f9c4c55ce0df7d3108ca32397299d9df00fedd9117d3d/MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e07c3764494e3776c602c1e78e298937c3315ccc9043ead7e685b7f2b8d47b3c", size = 21366 }, - { url = "https://files.pythonhosted.org/packages/bd/6e/61ebf08d8940553afff20d1fb1ba7294b6f8d279df9fd0c0db911b4bbcfd/MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171", size = 21091 }, - { url = "https://files.pythonhosted.org/packages/11/23/ffbf53694e8c94ebd1e7e491de185124277964344733c45481f32ede2499/MarkupSafe-3.0.2-cp310-cp310-win32.whl", hash = "sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50", size = 15065 }, - { url = "https://files.pythonhosted.org/packages/44/06/e7175d06dd6e9172d4a69a72592cb3f7a996a9c396eee29082826449bbc3/MarkupSafe-3.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:6af100e168aa82a50e186c82875a5893c5597a0c1ccdb0d8b40240b1f28b969a", size = 15514 }, - { url = "https://files.pythonhosted.org/packages/6b/28/bbf83e3f76936960b850435576dd5e67034e200469571be53f69174a2dfd/MarkupSafe-3.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9025b4018f3a1314059769c7bf15441064b2207cb3f065e6ea1e7359cb46db9d", size = 14353 }, - { url = "https://files.pythonhosted.org/packages/6c/30/316d194b093cde57d448a4c3209f22e3046c5bb2fb0820b118292b334be7/MarkupSafe-3.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:93335ca3812df2f366e80509ae119189886b0f3c2b81325d39efdb84a1e2ae93", size = 12392 }, - { url = "https://files.pythonhosted.org/packages/f2/96/9cdafba8445d3a53cae530aaf83c38ec64c4d5427d975c974084af5bc5d2/MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2cb8438c3cbb25e220c2ab33bb226559e7afb3baec11c4f218ffa7308603c832", size = 23984 }, - { url = "https://files.pythonhosted.org/packages/f1/a4/aefb044a2cd8d7334c8a47d3fb2c9f328ac48cb349468cc31c20b539305f/MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a123e330ef0853c6e822384873bef7507557d8e4a082961e1defa947aa59ba84", size = 23120 }, - { url = "https://files.pythonhosted.org/packages/8d/21/5e4851379f88f3fad1de30361db501300d4f07bcad047d3cb0449fc51f8c/MarkupSafe-3.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1e084f686b92e5b83186b07e8a17fc09e38fff551f3602b249881fec658d3eca", size = 23032 }, - { url = "https://files.pythonhosted.org/packages/00/7b/e92c64e079b2d0d7ddf69899c98842f3f9a60a1ae72657c89ce2655c999d/MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d8213e09c917a951de9d09ecee036d5c7d36cb6cb7dbaece4c71a60d79fb9798", size = 24057 }, - { url = "https://files.pythonhosted.org/packages/f9/ac/46f960ca323037caa0a10662ef97d0a4728e890334fc156b9f9e52bcc4ca/MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:5b02fb34468b6aaa40dfc198d813a641e3a63b98c2b05a16b9f80b7ec314185e", size = 23359 }, - { url = "https://files.pythonhosted.org/packages/69/84/83439e16197337b8b14b6a5b9c2105fff81d42c2a7c5b58ac7b62ee2c3b1/MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4", size = 23306 }, - { url = "https://files.pythonhosted.org/packages/9a/34/a15aa69f01e2181ed8d2b685c0d2f6655d5cca2c4db0ddea775e631918cd/MarkupSafe-3.0.2-cp311-cp311-win32.whl", hash = "sha256:6c89876f41da747c8d3677a2b540fb32ef5715f97b66eeb0c6b66f5e3ef6f59d", size = 15094 }, - { url = "https://files.pythonhosted.org/packages/da/b8/3a3bd761922d416f3dc5d00bfbed11f66b1ab89a0c2b6e887240a30b0f6b/MarkupSafe-3.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:70a87b411535ccad5ef2f1df5136506a10775d267e197e4cf531ced10537bd6b", size = 15521 }, - { url = "https://files.pythonhosted.org/packages/22/09/d1f21434c97fc42f09d290cbb6350d44eb12f09cc62c9476effdb33a18aa/MarkupSafe-3.0.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf", size = 14274 }, - { url = "https://files.pythonhosted.org/packages/6b/b0/18f76bba336fa5aecf79d45dcd6c806c280ec44538b3c13671d49099fdd0/MarkupSafe-3.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225", size = 12348 }, - { url = "https://files.pythonhosted.org/packages/e0/25/dd5c0f6ac1311e9b40f4af06c78efde0f3b5cbf02502f8ef9501294c425b/MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028", size = 24149 }, - { url = "https://files.pythonhosted.org/packages/f3/f0/89e7aadfb3749d0f52234a0c8c7867877876e0a20b60e2188e9850794c17/MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8", size = 23118 }, - { url = "https://files.pythonhosted.org/packages/d5/da/f2eeb64c723f5e3777bc081da884b414671982008c47dcc1873d81f625b6/MarkupSafe-3.0.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c", size = 22993 }, - { url = "https://files.pythonhosted.org/packages/da/0e/1f32af846df486dce7c227fe0f2398dc7e2e51d4a370508281f3c1c5cddc/MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557", size = 24178 }, - { url = "https://files.pythonhosted.org/packages/c4/f6/bb3ca0532de8086cbff5f06d137064c8410d10779c4c127e0e47d17c0b71/MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22", size = 23319 }, - { url = "https://files.pythonhosted.org/packages/a2/82/8be4c96ffee03c5b4a034e60a31294daf481e12c7c43ab8e34a1453ee48b/MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48", size = 23352 }, - { url = "https://files.pythonhosted.org/packages/51/ae/97827349d3fcffee7e184bdf7f41cd6b88d9919c80f0263ba7acd1bbcb18/MarkupSafe-3.0.2-cp312-cp312-win32.whl", hash = "sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30", size = 15097 }, - { url = "https://files.pythonhosted.org/packages/c1/80/a61f99dc3a936413c3ee4e1eecac96c0da5ed07ad56fd975f1a9da5bc630/MarkupSafe-3.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87", size = 15601 }, - { url = "https://files.pythonhosted.org/packages/83/0e/67eb10a7ecc77a0c2bbe2b0235765b98d164d81600746914bebada795e97/MarkupSafe-3.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd", size = 14274 }, - { url = "https://files.pythonhosted.org/packages/2b/6d/9409f3684d3335375d04e5f05744dfe7e9f120062c9857df4ab490a1031a/MarkupSafe-3.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430", size = 12352 }, - { url = "https://files.pythonhosted.org/packages/d2/f5/6eadfcd3885ea85fe2a7c128315cc1bb7241e1987443d78c8fe712d03091/MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094", size = 24122 }, - { url = "https://files.pythonhosted.org/packages/0c/91/96cf928db8236f1bfab6ce15ad070dfdd02ed88261c2afafd4b43575e9e9/MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396", size = 23085 }, - { url = "https://files.pythonhosted.org/packages/c2/cf/c9d56af24d56ea04daae7ac0940232d31d5a8354f2b457c6d856b2057d69/MarkupSafe-3.0.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79", size = 22978 }, - { url = "https://files.pythonhosted.org/packages/2a/9f/8619835cd6a711d6272d62abb78c033bda638fdc54c4e7f4272cf1c0962b/MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a", size = 24208 }, - { url = "https://files.pythonhosted.org/packages/f9/bf/176950a1792b2cd2102b8ffeb5133e1ed984547b75db47c25a67d3359f77/MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca", size = 23357 }, - { url = "https://files.pythonhosted.org/packages/ce/4f/9a02c1d335caabe5c4efb90e1b6e8ee944aa245c1aaaab8e8a618987d816/MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c", size = 23344 }, - { url = "https://files.pythonhosted.org/packages/ee/55/c271b57db36f748f0e04a759ace9f8f759ccf22b4960c270c78a394f58be/MarkupSafe-3.0.2-cp313-cp313-win32.whl", hash = "sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1", size = 15101 }, - { url = "https://files.pythonhosted.org/packages/29/88/07df22d2dd4df40aba9f3e402e6dc1b8ee86297dddbad4872bd5e7b0094f/MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f", size = 15603 }, - { url = "https://files.pythonhosted.org/packages/62/6a/8b89d24db2d32d433dffcd6a8779159da109842434f1dd2f6e71f32f738c/MarkupSafe-3.0.2-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c", size = 14510 }, - { url = "https://files.pythonhosted.org/packages/7a/06/a10f955f70a2e5a9bf78d11a161029d278eeacbd35ef806c3fd17b13060d/MarkupSafe-3.0.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb", size = 12486 }, - { url = "https://files.pythonhosted.org/packages/34/cf/65d4a571869a1a9078198ca28f39fba5fbb910f952f9dbc5220afff9f5e6/MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c", size = 25480 }, - { url = "https://files.pythonhosted.org/packages/0c/e3/90e9651924c430b885468b56b3d597cabf6d72be4b24a0acd1fa0e12af67/MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d", size = 23914 }, - { url = "https://files.pythonhosted.org/packages/66/8c/6c7cf61f95d63bb866db39085150df1f2a5bd3335298f14a66b48e92659c/MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe", size = 23796 }, - { url = "https://files.pythonhosted.org/packages/bb/35/cbe9238ec3f47ac9a7c8b3df7a808e7cb50fe149dc7039f5f454b3fba218/MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5", size = 25473 }, - { url = "https://files.pythonhosted.org/packages/e6/32/7621a4382488aa283cc05e8984a9c219abad3bca087be9ec77e89939ded9/MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a", size = 24114 }, - { url = "https://files.pythonhosted.org/packages/0d/80/0985960e4b89922cb5a0bac0ed39c5b96cbc1a536a99f30e8c220a996ed9/MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9", size = 24098 }, - { url = "https://files.pythonhosted.org/packages/82/78/fedb03c7d5380df2427038ec8d973587e90561b2d90cd472ce9254cf348b/MarkupSafe-3.0.2-cp313-cp313t-win32.whl", hash = "sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6", size = 15208 }, - { url = "https://files.pythonhosted.org/packages/4f/65/6079a46068dfceaeabb5dcad6d674f5f5c61a6fa5673746f42a9f4c233b3/MarkupSafe-3.0.2-cp313-cp313t-win_amd64.whl", hash = "sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f", size = 15739 }, -] - -[[package]] -name = "mdurl" -version = "0.1.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979 }, -] - -[[package]] -name = "mypy" -version = "1.15.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "mypy-extensions" }, - { name = "tomli", marker = "python_full_version < '3.11'" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/ce/43/d5e49a86afa64bd3839ea0d5b9c7103487007d728e1293f52525d6d5486a/mypy-1.15.0.tar.gz", hash = "sha256:404534629d51d3efea5c800ee7c42b72a6554d6c400e6a79eafe15d11341fd43", size = 3239717 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/68/f8/65a7ce8d0e09b6329ad0c8d40330d100ea343bd4dd04c4f8ae26462d0a17/mypy-1.15.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:979e4e1a006511dacf628e36fadfecbcc0160a8af6ca7dad2f5025529e082c13", size = 10738433 }, - { url = "https://files.pythonhosted.org/packages/b4/95/9c0ecb8eacfe048583706249439ff52105b3f552ea9c4024166c03224270/mypy-1.15.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c4bb0e1bd29f7d34efcccd71cf733580191e9a264a2202b0239da95984c5b559", size = 9861472 }, - { url = "https://files.pythonhosted.org/packages/84/09/9ec95e982e282e20c0d5407bc65031dfd0f0f8ecc66b69538296e06fcbee/mypy-1.15.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:be68172e9fd9ad8fb876c6389f16d1c1b5f100ffa779f77b1fb2176fcc9ab95b", size = 11611424 }, - { url = "https://files.pythonhosted.org/packages/78/13/f7d14e55865036a1e6a0a69580c240f43bc1f37407fe9235c0d4ef25ffb0/mypy-1.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c7be1e46525adfa0d97681432ee9fcd61a3964c2446795714699a998d193f1a3", size = 12365450 }, - { url = "https://files.pythonhosted.org/packages/48/e1/301a73852d40c241e915ac6d7bcd7fedd47d519246db2d7b86b9d7e7a0cb/mypy-1.15.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:2e2c2e6d3593f6451b18588848e66260ff62ccca522dd231cd4dd59b0160668b", size = 12551765 }, - { url = "https://files.pythonhosted.org/packages/77/ba/c37bc323ae5fe7f3f15a28e06ab012cd0b7552886118943e90b15af31195/mypy-1.15.0-cp310-cp310-win_amd64.whl", hash = "sha256:6983aae8b2f653e098edb77f893f7b6aca69f6cffb19b2cc7443f23cce5f4828", size = 9274701 }, - { url = "https://files.pythonhosted.org/packages/03/bc/f6339726c627bd7ca1ce0fa56c9ae2d0144604a319e0e339bdadafbbb599/mypy-1.15.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2922d42e16d6de288022e5ca321cd0618b238cfc5570e0263e5ba0a77dbef56f", size = 10662338 }, - { url = "https://files.pythonhosted.org/packages/e2/90/8dcf506ca1a09b0d17555cc00cd69aee402c203911410136cd716559efe7/mypy-1.15.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2ee2d57e01a7c35de00f4634ba1bbf015185b219e4dc5909e281016df43f5ee5", size = 9787540 }, - { url = "https://files.pythonhosted.org/packages/05/05/a10f9479681e5da09ef2f9426f650d7b550d4bafbef683b69aad1ba87457/mypy-1.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:973500e0774b85d9689715feeffcc980193086551110fd678ebe1f4342fb7c5e", size = 11538051 }, - { url = "https://files.pythonhosted.org/packages/e9/9a/1f7d18b30edd57441a6411fcbc0c6869448d1a4bacbaee60656ac0fc29c8/mypy-1.15.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5a95fb17c13e29d2d5195869262f8125dfdb5c134dc8d9a9d0aecf7525b10c2c", size = 12286751 }, - { url = "https://files.pythonhosted.org/packages/72/af/19ff499b6f1dafcaf56f9881f7a965ac2f474f69f6f618b5175b044299f5/mypy-1.15.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:1905f494bfd7d85a23a88c5d97840888a7bd516545fc5aaedff0267e0bb54e2f", size = 12421783 }, - { url = "https://files.pythonhosted.org/packages/96/39/11b57431a1f686c1aed54bf794870efe0f6aeca11aca281a0bd87a5ad42c/mypy-1.15.0-cp311-cp311-win_amd64.whl", hash = "sha256:c9817fa23833ff189db061e6d2eff49b2f3b6ed9856b4a0a73046e41932d744f", size = 9265618 }, - { url = "https://files.pythonhosted.org/packages/98/3a/03c74331c5eb8bd025734e04c9840532226775c47a2c39b56a0c8d4f128d/mypy-1.15.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:aea39e0583d05124836ea645f412e88a5c7d0fd77a6d694b60d9b6b2d9f184fd", size = 10793981 }, - { url = "https://files.pythonhosted.org/packages/f0/1a/41759b18f2cfd568848a37c89030aeb03534411eef981df621d8fad08a1d/mypy-1.15.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2f2147ab812b75e5b5499b01ade1f4a81489a147c01585cda36019102538615f", size = 9749175 }, - { url = "https://files.pythonhosted.org/packages/12/7e/873481abf1ef112c582db832740f4c11b2bfa510e829d6da29b0ab8c3f9c/mypy-1.15.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ce436f4c6d218a070048ed6a44c0bbb10cd2cc5e272b29e7845f6a2f57ee4464", size = 11455675 }, - { url = "https://files.pythonhosted.org/packages/b3/d0/92ae4cde706923a2d3f2d6c39629134063ff64b9dedca9c1388363da072d/mypy-1.15.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8023ff13985661b50a5928fc7a5ca15f3d1affb41e5f0a9952cb68ef090b31ee", size = 12410020 }, - { url = "https://files.pythonhosted.org/packages/46/8b/df49974b337cce35f828ba6fda228152d6db45fed4c86ba56ffe442434fd/mypy-1.15.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1124a18bc11a6a62887e3e137f37f53fbae476dc36c185d549d4f837a2a6a14e", size = 12498582 }, - { url = "https://files.pythonhosted.org/packages/13/50/da5203fcf6c53044a0b699939f31075c45ae8a4cadf538a9069b165c1050/mypy-1.15.0-cp312-cp312-win_amd64.whl", hash = "sha256:171a9ca9a40cd1843abeca0e405bc1940cd9b305eaeea2dda769ba096932bb22", size = 9366614 }, - { url = "https://files.pythonhosted.org/packages/6a/9b/fd2e05d6ffff24d912f150b87db9e364fa8282045c875654ce7e32fffa66/mypy-1.15.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:93faf3fdb04768d44bf28693293f3904bbb555d076b781ad2530214ee53e3445", size = 10788592 }, - { url = "https://files.pythonhosted.org/packages/74/37/b246d711c28a03ead1fd906bbc7106659aed7c089d55fe40dd58db812628/mypy-1.15.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:811aeccadfb730024c5d3e326b2fbe9249bb7413553f15499a4050f7c30e801d", size = 9753611 }, - { url = "https://files.pythonhosted.org/packages/a6/ac/395808a92e10cfdac8003c3de9a2ab6dc7cde6c0d2a4df3df1b815ffd067/mypy-1.15.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:98b7b9b9aedb65fe628c62a6dc57f6d5088ef2dfca37903a7d9ee374d03acca5", size = 11438443 }, - { url = "https://files.pythonhosted.org/packages/d2/8b/801aa06445d2de3895f59e476f38f3f8d610ef5d6908245f07d002676cbf/mypy-1.15.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c43a7682e24b4f576d93072216bf56eeff70d9140241f9edec0c104d0c515036", size = 12402541 }, - { url = "https://files.pythonhosted.org/packages/c7/67/5a4268782eb77344cc613a4cf23540928e41f018a9a1ec4c6882baf20ab8/mypy-1.15.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:baefc32840a9f00babd83251560e0ae1573e2f9d1b067719479bfb0e987c6357", size = 12494348 }, - { url = "https://files.pythonhosted.org/packages/83/3e/57bb447f7bbbfaabf1712d96f9df142624a386d98fb026a761532526057e/mypy-1.15.0-cp313-cp313-win_amd64.whl", hash = "sha256:b9378e2c00146c44793c98b8d5a61039a048e31f429fb0eb546d93f4b000bedf", size = 9373648 }, - { url = "https://files.pythonhosted.org/packages/09/4e/a7d65c7322c510de2c409ff3828b03354a7c43f5a8ed458a7a131b41c7b9/mypy-1.15.0-py3-none-any.whl", hash = "sha256:5469affef548bd1895d86d3bf10ce2b44e33d86923c29e4d675b3e323437ea3e", size = 2221777 }, -] - -[[package]] -name = "mypy-extensions" -version = "1.0.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/98/a4/1ab47638b92648243faf97a5aeb6ea83059cc3624972ab6b8d2316078d3f/mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782", size = 4433 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/2a/e2/5d3f6ada4297caebe1a2add3b126fe800c96f56dbe5d1988a2cbe0b267aa/mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d", size = 4695 }, -] - -[[package]] -name = "nodeenv" -version = "1.9.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/43/16/fc88b08840de0e0a72a2f9d8c6bae36be573e475a6326ae854bcc549fc45/nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f", size = 47437 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/d2/1d/1b658dbd2b9fa9c4c9f32accbfc0205d532c8c6194dc0f2a4c0428e7128a/nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9", size = 22314 }, -] - -[[package]] -name = "packaging" -version = "24.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d0/63/68dbb6eb2de9cb10ee4c9c14a0148804425e13c4fb20d61cce69f53106da/packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f", size = 163950 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759", size = 65451 }, -] - -[[package]] -name = "pendulum" -version = "3.0.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "python-dateutil" }, - { name = "time-machine", marker = "implementation_name != 'pypy'" }, - { name = "tzdata" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/b8/fe/27c7438c6ac8b8f8bef3c6e571855602ee784b85d072efddfff0ceb1cd77/pendulum-3.0.0.tar.gz", hash = "sha256:5d034998dea404ec31fae27af6b22cff1708f830a1ed7353be4d1019bb9f584e", size = 84524 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/bf/2f/2f4719366d16f1e444b4e400d3de5021bc4b09965f97e45c81e08348cbdf/pendulum-3.0.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:2cf9e53ef11668e07f73190c805dbdf07a1939c3298b78d5a9203a86775d1bfd", size = 362284 }, - { url = "https://files.pythonhosted.org/packages/30/ff/70a8f47e622e641de15b7ed8a8b66c3aa895fabc182a7d520a0c33ec850e/pendulum-3.0.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fb551b9b5e6059377889d2d878d940fd0bbb80ae4810543db18e6f77b02c5ef6", size = 352957 }, - { url = "https://files.pythonhosted.org/packages/f4/cd/4e2fb7d071e81a9b07719203fd1d329febaded59981b8709663341f758f4/pendulum-3.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c58227ac260d5b01fc1025176d7b31858c9f62595737f350d22124a9a3ad82d", size = 335784 }, - { url = "https://files.pythonhosted.org/packages/0f/e5/9fc684c59b6f3425cf597d9489c24c47dc96d391be9eb8c9a3c543cd7646/pendulum-3.0.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:60fb6f415fea93a11c52578eaa10594568a6716602be8430b167eb0d730f3332", size = 362215 }, - { url = "https://files.pythonhosted.org/packages/5a/ba/4dbb1ae42775010249ba29d01829353a9b59d9c3caf97df14d548a3b7d4c/pendulum-3.0.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b69f6b4dbcb86f2c2fe696ba991e67347bcf87fe601362a1aba6431454b46bde", size = 448632 }, - { url = "https://files.pythonhosted.org/packages/10/a9/0932bd7cd677bee8bdc9cb898448e47ada0f74e41f434f4ff687d03a3ea9/pendulum-3.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:138afa9c373ee450ede206db5a5e9004fd3011b3c6bbe1e57015395cd076a09f", size = 384881 }, - { url = "https://files.pythonhosted.org/packages/31/a9/8c9887ce8bfb8ab0db068ac2f1fe679b713f728c116bd136301c303893cd/pendulum-3.0.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:83d9031f39c6da9677164241fd0d37fbfc9dc8ade7043b5d6d62f56e81af8ad2", size = 559554 }, - { url = "https://files.pythonhosted.org/packages/f4/7e/70596b098b97799c78e3fc2f89394decca6f5443cac28c54082daf2d48eb/pendulum-3.0.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0c2308af4033fa534f089595bcd40a95a39988ce4059ccd3dc6acb9ef14ca44a", size = 558246 }, - { url = "https://files.pythonhosted.org/packages/67/5e/e646afbd1632bfbacdae79289d7d5879efdeeb5f5e58327bc5c698731107/pendulum-3.0.0-cp310-none-win_amd64.whl", hash = "sha256:9a59637cdb8462bdf2dbcb9d389518c0263799189d773ad5c11db6b13064fa79", size = 293456 }, - { url = "https://files.pythonhosted.org/packages/7b/f0/d60be6058657bf71281eeaa12bee85e87bac18acf6dbb7b5197bb8416537/pendulum-3.0.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:3725245c0352c95d6ca297193192020d1b0c0f83d5ee6bb09964edc2b5a2d508", size = 362283 }, - { url = "https://files.pythonhosted.org/packages/68/e5/0f9d8351242ddb119a40b41c0cf1d0c74cc243829eea6811f753a8ecf15f/pendulum-3.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6c035f03a3e565ed132927e2c1b691de0dbf4eb53b02a5a3c5a97e1a64e17bec", size = 352957 }, - { url = "https://files.pythonhosted.org/packages/30/43/70d0a08e5d6ca434ba139d19ec2a4847b0a3e461fbb82e680a9b6a4237ef/pendulum-3.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:597e66e63cbd68dd6d58ac46cb7a92363d2088d37ccde2dae4332ef23e95cd00", size = 335784 }, - { url = "https://files.pythonhosted.org/packages/fc/a3/7d4c0b3f57bf7b543da9088a78a6bd6c786808ca4098bd5db649fdf9f6a2/pendulum-3.0.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:99a0f8172e19f3f0c0e4ace0ad1595134d5243cf75985dc2233e8f9e8de263ca", size = 362217 }, - { url = "https://files.pythonhosted.org/packages/8b/03/8c451d569e7f4d9898f155e793f46970eed256c5ae353ecb355584890d8a/pendulum-3.0.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:77d8839e20f54706aed425bec82a83b4aec74db07f26acd039905d1237a5e1d4", size = 448630 }, - { url = "https://files.pythonhosted.org/packages/84/3a/5e36479e199a034adcf6a1a95c691f0a2781ea55b9ac3bcb887e2f97d82b/pendulum-3.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:afde30e8146292b059020fbc8b6f8fd4a60ae7c5e6f0afef937bbb24880bdf01", size = 384882 }, - { url = "https://files.pythonhosted.org/packages/4c/25/beff911dda686e0cf169bc3dbe5d10416b376a6dde94eb1bf04aa4035409/pendulum-3.0.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:660434a6fcf6303c4efd36713ca9212c753140107ee169a3fc6c49c4711c2a05", size = 559556 }, - { url = "https://files.pythonhosted.org/packages/e9/e8/f2aaa470adb6c720645f9f9ef30d5b223407ee327e12c6127eccf4218cb8/pendulum-3.0.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:dee9e5a48c6999dc1106eb7eea3e3a50e98a50651b72c08a87ee2154e544b33e", size = 558249 }, - { url = "https://files.pythonhosted.org/packages/60/19/c13307ea8504d2c02c63c9dffdae1cefbd068b636ec7b18ccf2ec064d246/pendulum-3.0.0-cp311-none-win_amd64.whl", hash = "sha256:d4cdecde90aec2d67cebe4042fd2a87a4441cc02152ed7ed8fb3ebb110b94ec4", size = 293463 }, - { url = "https://files.pythonhosted.org/packages/6b/36/252d48610295c11c0f18e791dcc133d38c545b0bd19a5c3981652a9acb3c/pendulum-3.0.0-cp311-none-win_arm64.whl", hash = "sha256:773c3bc4ddda2dda9f1b9d51fe06762f9200f3293d75c4660c19b2614b991d83", size = 288057 }, - { url = "https://files.pythonhosted.org/packages/1e/37/17c8f0e7481a32f21b9002dd68912a8813f2c1d77b984e00af56eb9ae31b/pendulum-3.0.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:409e64e41418c49f973d43a28afe5df1df4f1dd87c41c7c90f1a63f61ae0f1f7", size = 362284 }, - { url = "https://files.pythonhosted.org/packages/12/e6/08f462f6ea87e2159f19b43ff88231d26e02bda31c10bcb29290a617ace4/pendulum-3.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a38ad2121c5ec7c4c190c7334e789c3b4624798859156b138fcc4d92295835dc", size = 352964 }, - { url = "https://files.pythonhosted.org/packages/47/29/b6877f6b53b91356c2c56d19ddab17b165ca994ad1e57b32c089e79f3fb5/pendulum-3.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fde4d0b2024b9785f66b7f30ed59281bd60d63d9213cda0eb0910ead777f6d37", size = 335848 }, - { url = "https://files.pythonhosted.org/packages/2b/77/62ca666f30b2558342deadda26290a575459a7b59248ea1e978b84175227/pendulum-3.0.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4b2c5675769fb6d4c11238132962939b960fcb365436b6d623c5864287faa319", size = 362215 }, - { url = "https://files.pythonhosted.org/packages/e0/29/ce37593f5ea51862c60dadf4e863d604f954478b3abbcc60a14dc05e242c/pendulum-3.0.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8af95e03e066826f0f4c65811cbee1b3123d4a45a1c3a2b4fc23c4b0dff893b5", size = 448673 }, - { url = "https://files.pythonhosted.org/packages/72/6a/68a8c7b8f1977d89aabfd0e2becb0921e5515dfb365097e98a522334a151/pendulum-3.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2165a8f33cb15e06c67070b8afc87a62b85c5a273e3aaa6bc9d15c93a4920d6f", size = 384891 }, - { url = "https://files.pythonhosted.org/packages/30/e6/edd699300f47a3c53c0d8ed26e905b9a31057c3646211e58cc540716a440/pendulum-3.0.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:ad5e65b874b5e56bd942546ea7ba9dd1d6a25121db1c517700f1c9de91b28518", size = 559558 }, - { url = "https://files.pythonhosted.org/packages/d4/97/95a44aa5e1763d3a966551ed0e12f56508d8dfcc60e1f0395909b6a08626/pendulum-3.0.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:17fe4b2c844bbf5f0ece69cfd959fa02957c61317b2161763950d88fed8e13b9", size = 558240 }, - { url = "https://files.pythonhosted.org/packages/9a/91/fcd992eb36b77ab43f2cf44307b72c01a6fbb27f55c1bb2d4af30e9a6cb7/pendulum-3.0.0-cp312-none-win_amd64.whl", hash = "sha256:78f8f4e7efe5066aca24a7a57511b9c2119f5c2b5eb81c46ff9222ce11e0a7a5", size = 293456 }, - { url = "https://files.pythonhosted.org/packages/3b/60/ba8aa296ca6d76603d58146b4a222cd99e7da33831158b8c00240a896a56/pendulum-3.0.0-cp312-none-win_arm64.whl", hash = "sha256:28f49d8d1e32aae9c284a90b6bb3873eee15ec6e1d9042edd611b22a94ac462f", size = 288054 }, - { url = "https://files.pythonhosted.org/packages/0f/7f/24d8c167937d663a9cf6d5fc5e87a87bfa320c3f002d4fbbc7bd5ff3b6f8/pendulum-3.0.0-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:3b1f74d1e6ffe5d01d6023870e2ce5c2191486928823196f8575dcc786e107b1", size = 362388 }, - { url = "https://files.pythonhosted.org/packages/55/e1/33775ee68f8bbb0da967dfd818706ee69e0a054f663ee6111d5c7639f67a/pendulum-3.0.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:729e9f93756a2cdfa77d0fc82068346e9731c7e884097160603872686e570f07", size = 353062 }, - { url = "https://files.pythonhosted.org/packages/3e/1b/c3e399148c0d69c2c84c2eda45cd3580990b13f36d0c96516591bf4def56/pendulum-3.0.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e586acc0b450cd21cbf0db6bae386237011b75260a3adceddc4be15334689a9a", size = 335871 }, - { url = "https://files.pythonhosted.org/packages/32/6b/23dde8bd3fb78f693b81bd8fc67769b2a461918d51ed6ddf486a1a97e199/pendulum-3.0.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:22e7944ffc1f0099a79ff468ee9630c73f8c7835cd76fdb57ef7320e6a409df4", size = 384859 }, - { url = "https://files.pythonhosted.org/packages/1d/1b/a3e0387f586d6121a15e6d02f7ae8cc3cd1ebb136fd243c1c191136ed518/pendulum-3.0.0-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:fa30af36bd8e50686846bdace37cf6707bdd044e5cb6e1109acbad3277232e04", size = 559441 }, - { url = "https://files.pythonhosted.org/packages/d7/23/91dea81265d5d11af0cd5053ca76730cc2c5ac14085c9a923d448e74c67f/pendulum-3.0.0-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:440215347b11914ae707981b9a57ab9c7b6983ab0babde07063c6ee75c0dc6e7", size = 558189 }, - { url = "https://files.pythonhosted.org/packages/7a/8a/166625d30f927e800e99f3f6556d8b3f4ad952c62d6a774844d73542b84b/pendulum-3.0.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:314c4038dc5e6a52991570f50edb2f08c339debdf8cea68ac355b32c4174e820", size = 293657 }, -] - -[[package]] -name = "phonenumbers" -version = "9.0.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d8/b4/d26590c0cb2f039e7b96a6c2e85210d86c286fc42a3c2e093c7cb2f3b2c8/phonenumbers-9.0.2.tar.gz", hash = "sha256:f590ee2b729bdd9873ca2d52989466add14c9953b48805c0aeb408348d4d6224", size = 2296774 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/ea/d8/159ca512d76892f66c5a0d8fa60fe1989edff81b92e30a4cc18ee600ae06/phonenumbers-9.0.2-py2.py3-none-any.whl", hash = "sha256:dbcec6bdfdf3973f60b81dc0fcac3f7b1638f877ac42da4d7b46724ed413e2b9", size = 2582422 }, -] - -[[package]] -name = "platformdirs" -version = "4.3.7" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/b6/2d/7d512a3913d60623e7eb945c6d1b4f0bddf1d0b7ada5225274c87e5b53d1/platformdirs-4.3.7.tar.gz", hash = "sha256:eb437d586b6a0986388f0d6f74aa0cde27b48d0e3d66843640bfb6bdcdb6e351", size = 21291 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/6d/45/59578566b3275b8fd9157885918fcd0c4d74162928a5310926887b856a51/platformdirs-4.3.7-py3-none-any.whl", hash = "sha256:a03875334331946f13c549dbd8f4bac7a13a50a895a0eb1e8c6a8ace80d40a94", size = 18499 }, -] - -[[package]] -name = "pluggy" -version = "1.5.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/96/2d/02d4312c973c6050a18b314a5ad0b3210edb65a906f868e31c111dede4a6/pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1", size = 67955 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669", size = 20556 }, -] - -[[package]] -name = "pre-commit" -version = "3.8.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "cfgv" }, - { name = "identify" }, - { name = "nodeenv" }, - { name = "pyyaml" }, - { name = "virtualenv" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/64/10/97ee2fa54dff1e9da9badbc5e35d0bbaef0776271ea5907eccf64140f72f/pre_commit-3.8.0.tar.gz", hash = "sha256:8bb6494d4a20423842e198980c9ecf9f96607a07ea29549e180eef9ae80fe7af", size = 177815 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/07/92/caae8c86e94681b42c246f0bca35c059a2f0529e5b92619f6aba4cf7e7b6/pre_commit-3.8.0-py2.py3-none-any.whl", hash = "sha256:9a90a53bf82fdd8778d58085faf8d83df56e40dfe18f45b19446e26bf1b3a63f", size = 204643 }, -] - -[[package]] -name = "pycountry" -version = "24.6.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/76/57/c389fa68c50590881a75b7883eeb3dc15e9e73a0fdc001cdd45c13290c92/pycountry-24.6.1.tar.gz", hash = "sha256:b61b3faccea67f87d10c1f2b0fc0be714409e8fcdcc1315613174f6466c10221", size = 6043910 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b1/ec/1fb891d8a2660716aadb2143235481d15ed1cbfe3ad669194690b0604492/pycountry-24.6.1-py3-none-any.whl", hash = "sha256:f1a4fb391cd7214f8eefd39556d740adcc233c778a27f8942c8dca351d6ce06f", size = 6335189 }, -] - -[[package]] -name = "pydantic" -version = "2.11.3" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "annotated-types" }, - { name = "pydantic-core" }, - { name = "typing-extensions" }, - { name = "typing-inspection" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/10/2e/ca897f093ee6c5f3b0bee123ee4465c50e75431c3d5b6a3b44a47134e891/pydantic-2.11.3.tar.gz", hash = "sha256:7471657138c16adad9322fe3070c0116dd6c3ad8d649300e3cbdfe91f4db4ec3", size = 785513 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b0/1d/407b29780a289868ed696d1616f4aad49d6388e5a77f567dcd2629dcd7b8/pydantic-2.11.3-py3-none-any.whl", hash = "sha256:a082753436a07f9ba1289c6ffa01cd93db3548776088aa917cc43b63f68fa60f", size = 443591 }, -] - -[[package]] -name = "pydantic-core" -version = "2.33.1" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/17/19/ed6a078a5287aea7922de6841ef4c06157931622c89c2a47940837b5eecd/pydantic_core-2.33.1.tar.gz", hash = "sha256:bcc9c6fdb0ced789245b02b7d6603e17d1563064ddcfc36f046b61c0c05dd9df", size = 434395 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/38/ea/5f572806ab4d4223d11551af814d243b0e3e02cc6913def4d1fe4a5ca41c/pydantic_core-2.33.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:3077cfdb6125cc8dab61b155fdd714663e401f0e6883f9632118ec12cf42df26", size = 2044021 }, - { url = "https://files.pythonhosted.org/packages/8c/d1/f86cc96d2aa80e3881140d16d12ef2b491223f90b28b9a911346c04ac359/pydantic_core-2.33.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8ffab8b2908d152e74862d276cf5017c81a2f3719f14e8e3e8d6b83fda863927", size = 1861742 }, - { url = "https://files.pythonhosted.org/packages/37/08/fbd2cd1e9fc735a0df0142fac41c114ad9602d1c004aea340169ae90973b/pydantic_core-2.33.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5183e4f6a2d468787243ebcd70cf4098c247e60d73fb7d68d5bc1e1beaa0c4db", size = 1910414 }, - { url = "https://files.pythonhosted.org/packages/7f/73/3ac217751decbf8d6cb9443cec9b9eb0130eeada6ae56403e11b486e277e/pydantic_core-2.33.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:398a38d323f37714023be1e0285765f0a27243a8b1506b7b7de87b647b517e48", size = 1996848 }, - { url = "https://files.pythonhosted.org/packages/9a/f5/5c26b265cdcff2661e2520d2d1e9db72d117ea00eb41e00a76efe68cb009/pydantic_core-2.33.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:87d3776f0001b43acebfa86f8c64019c043b55cc5a6a2e313d728b5c95b46969", size = 2141055 }, - { url = "https://files.pythonhosted.org/packages/5d/14/a9c3cee817ef2f8347c5ce0713e91867a0dceceefcb2973942855c917379/pydantic_core-2.33.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c566dd9c5f63d22226409553531f89de0cac55397f2ab8d97d6f06cfce6d947e", size = 2753806 }, - { url = "https://files.pythonhosted.org/packages/f2/68/866ce83a51dd37e7c604ce0050ff6ad26de65a7799df89f4db87dd93d1d6/pydantic_core-2.33.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a0d5f3acc81452c56895e90643a625302bd6be351e7010664151cc55b7b97f89", size = 2007777 }, - { url = "https://files.pythonhosted.org/packages/b6/a8/36771f4404bb3e49bd6d4344da4dede0bf89cc1e01f3b723c47248a3761c/pydantic_core-2.33.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d3a07fadec2a13274a8d861d3d37c61e97a816beae717efccaa4b36dfcaadcde", size = 2122803 }, - { url = "https://files.pythonhosted.org/packages/18/9c/730a09b2694aa89360d20756369822d98dc2f31b717c21df33b64ffd1f50/pydantic_core-2.33.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:f99aeda58dce827f76963ee87a0ebe75e648c72ff9ba1174a253f6744f518f65", size = 2086755 }, - { url = "https://files.pythonhosted.org/packages/54/8e/2dccd89602b5ec31d1c58138d02340ecb2ebb8c2cac3cc66b65ce3edb6ce/pydantic_core-2.33.1-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:902dbc832141aa0ec374f4310f1e4e7febeebc3256f00dc359a9ac3f264a45dc", size = 2257358 }, - { url = "https://files.pythonhosted.org/packages/d1/9c/126e4ac1bfad8a95a9837acdd0963695d69264179ba4ede8b8c40d741702/pydantic_core-2.33.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fe44d56aa0b00d66640aa84a3cbe80b7a3ccdc6f0b1ca71090696a6d4777c091", size = 2257916 }, - { url = "https://files.pythonhosted.org/packages/7d/ba/91eea2047e681a6853c81c20aeca9dcdaa5402ccb7404a2097c2adf9d038/pydantic_core-2.33.1-cp310-cp310-win32.whl", hash = "sha256:ed3eb16d51257c763539bde21e011092f127a2202692afaeaccb50db55a31383", size = 1923823 }, - { url = "https://files.pythonhosted.org/packages/94/c0/fcdf739bf60d836a38811476f6ecd50374880b01e3014318b6e809ddfd52/pydantic_core-2.33.1-cp310-cp310-win_amd64.whl", hash = "sha256:694ad99a7f6718c1a498dc170ca430687a39894a60327f548e02a9c7ee4b6504", size = 1952494 }, - { url = "https://files.pythonhosted.org/packages/d6/7f/c6298830cb780c46b4f46bb24298d01019ffa4d21769f39b908cd14bbd50/pydantic_core-2.33.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:6e966fc3caaf9f1d96b349b0341c70c8d6573bf1bac7261f7b0ba88f96c56c24", size = 2044224 }, - { url = "https://files.pythonhosted.org/packages/a8/65/6ab3a536776cad5343f625245bd38165d6663256ad43f3a200e5936afd6c/pydantic_core-2.33.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bfd0adeee563d59c598ceabddf2c92eec77abcb3f4a391b19aa7366170bd9e30", size = 1858845 }, - { url = "https://files.pythonhosted.org/packages/e9/15/9a22fd26ba5ee8c669d4b8c9c244238e940cd5d818649603ca81d1c69861/pydantic_core-2.33.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:91815221101ad3c6b507804178a7bb5cb7b2ead9ecd600041669c8d805ebd595", size = 1910029 }, - { url = "https://files.pythonhosted.org/packages/d5/33/8cb1a62818974045086f55f604044bf35b9342900318f9a2a029a1bec460/pydantic_core-2.33.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9fea9c1869bb4742d174a57b4700c6dadea951df8b06de40c2fedb4f02931c2e", size = 1997784 }, - { url = "https://files.pythonhosted.org/packages/c0/ca/49958e4df7715c71773e1ea5be1c74544923d10319173264e6db122543f9/pydantic_core-2.33.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1d20eb4861329bb2484c021b9d9a977566ab16d84000a57e28061151c62b349a", size = 2141075 }, - { url = "https://files.pythonhosted.org/packages/7b/a6/0b3a167a9773c79ba834b959b4e18c3ae9216b8319bd8422792abc8a41b1/pydantic_core-2.33.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0fb935c5591573ae3201640579f30128ccc10739b45663f93c06796854405505", size = 2745849 }, - { url = "https://files.pythonhosted.org/packages/0b/60/516484135173aa9e5861d7a0663dce82e4746d2e7f803627d8c25dfa5578/pydantic_core-2.33.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c964fd24e6166420d18fb53996d8c9fd6eac9bf5ae3ec3d03015be4414ce497f", size = 2005794 }, - { url = "https://files.pythonhosted.org/packages/86/70/05b1eb77459ad47de00cf78ee003016da0cedf8b9170260488d7c21e9181/pydantic_core-2.33.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:681d65e9011f7392db5aa002b7423cc442d6a673c635668c227c6c8d0e5a4f77", size = 2123237 }, - { url = "https://files.pythonhosted.org/packages/c7/57/12667a1409c04ae7dc95d3b43158948eb0368e9c790be8b095cb60611459/pydantic_core-2.33.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e100c52f7355a48413e2999bfb4e139d2977a904495441b374f3d4fb4a170961", size = 2086351 }, - { url = "https://files.pythonhosted.org/packages/57/61/cc6d1d1c1664b58fdd6ecc64c84366c34ec9b606aeb66cafab6f4088974c/pydantic_core-2.33.1-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:048831bd363490be79acdd3232f74a0e9951b11b2b4cc058aeb72b22fdc3abe1", size = 2258914 }, - { url = "https://files.pythonhosted.org/packages/d1/0a/edb137176a1f5419b2ddee8bde6a0a548cfa3c74f657f63e56232df8de88/pydantic_core-2.33.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:bdc84017d28459c00db6f918a7272a5190bec3090058334e43a76afb279eac7c", size = 2257385 }, - { url = "https://files.pythonhosted.org/packages/26/3c/48ca982d50e4b0e1d9954919c887bdc1c2b462801bf408613ccc641b3daa/pydantic_core-2.33.1-cp311-cp311-win32.whl", hash = "sha256:32cd11c5914d1179df70406427097c7dcde19fddf1418c787540f4b730289896", size = 1923765 }, - { url = "https://files.pythonhosted.org/packages/33/cd/7ab70b99e5e21559f5de38a0928ea84e6f23fdef2b0d16a6feaf942b003c/pydantic_core-2.33.1-cp311-cp311-win_amd64.whl", hash = "sha256:2ea62419ba8c397e7da28a9170a16219d310d2cf4970dbc65c32faf20d828c83", size = 1950688 }, - { url = "https://files.pythonhosted.org/packages/4b/ae/db1fc237b82e2cacd379f63e3335748ab88b5adde98bf7544a1b1bd10a84/pydantic_core-2.33.1-cp311-cp311-win_arm64.whl", hash = "sha256:fc903512177361e868bc1f5b80ac8c8a6e05fcdd574a5fb5ffeac5a9982b9e89", size = 1908185 }, - { url = "https://files.pythonhosted.org/packages/c8/ce/3cb22b07c29938f97ff5f5bb27521f95e2ebec399b882392deb68d6c440e/pydantic_core-2.33.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:1293d7febb995e9d3ec3ea09caf1a26214eec45b0f29f6074abb004723fc1de8", size = 2026640 }, - { url = "https://files.pythonhosted.org/packages/19/78/f381d643b12378fee782a72126ec5d793081ef03791c28a0fd542a5bee64/pydantic_core-2.33.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:99b56acd433386c8f20be5c4000786d1e7ca0523c8eefc995d14d79c7a081498", size = 1852649 }, - { url = "https://files.pythonhosted.org/packages/9d/2b/98a37b80b15aac9eb2c6cfc6dbd35e5058a352891c5cce3a8472d77665a6/pydantic_core-2.33.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:35a5ec3fa8c2fe6c53e1b2ccc2454398f95d5393ab398478f53e1afbbeb4d939", size = 1892472 }, - { url = "https://files.pythonhosted.org/packages/4e/d4/3c59514e0f55a161004792b9ff3039da52448f43f5834f905abef9db6e4a/pydantic_core-2.33.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b172f7b9d2f3abc0efd12e3386f7e48b576ef309544ac3a63e5e9cdd2e24585d", size = 1977509 }, - { url = "https://files.pythonhosted.org/packages/a9/b6/c2c7946ef70576f79a25db59a576bce088bdc5952d1b93c9789b091df716/pydantic_core-2.33.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9097b9f17f91eea659b9ec58148c0747ec354a42f7389b9d50701610d86f812e", size = 2128702 }, - { url = "https://files.pythonhosted.org/packages/88/fe/65a880f81e3f2a974312b61f82a03d85528f89a010ce21ad92f109d94deb/pydantic_core-2.33.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cc77ec5b7e2118b152b0d886c7514a4653bcb58c6b1d760134a9fab915f777b3", size = 2679428 }, - { url = "https://files.pythonhosted.org/packages/6f/ff/4459e4146afd0462fb483bb98aa2436d69c484737feaceba1341615fb0ac/pydantic_core-2.33.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d5e3d15245b08fa4a84cefc6c9222e6f37c98111c8679fbd94aa145f9a0ae23d", size = 2008753 }, - { url = "https://files.pythonhosted.org/packages/7c/76/1c42e384e8d78452ededac8b583fe2550c84abfef83a0552e0e7478ccbc3/pydantic_core-2.33.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ef99779001d7ac2e2461d8ab55d3373fe7315caefdbecd8ced75304ae5a6fc6b", size = 2114849 }, - { url = "https://files.pythonhosted.org/packages/00/72/7d0cf05095c15f7ffe0eb78914b166d591c0eed72f294da68378da205101/pydantic_core-2.33.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:fc6bf8869e193855e8d91d91f6bf59699a5cdfaa47a404e278e776dd7f168b39", size = 2069541 }, - { url = "https://files.pythonhosted.org/packages/b3/69/94a514066bb7d8be499aa764926937409d2389c09be0b5107a970286ef81/pydantic_core-2.33.1-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:b1caa0bc2741b043db7823843e1bde8aaa58a55a58fda06083b0569f8b45693a", size = 2239225 }, - { url = "https://files.pythonhosted.org/packages/84/b0/e390071eadb44b41f4f54c3cef64d8bf5f9612c92686c9299eaa09e267e2/pydantic_core-2.33.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:ec259f62538e8bf364903a7d0d0239447059f9434b284f5536e8402b7dd198db", size = 2248373 }, - { url = "https://files.pythonhosted.org/packages/d6/b2/288b3579ffc07e92af66e2f1a11be3b056fe1214aab314748461f21a31c3/pydantic_core-2.33.1-cp312-cp312-win32.whl", hash = "sha256:e14f369c98a7c15772b9da98987f58e2b509a93235582838bd0d1d8c08b68fda", size = 1907034 }, - { url = "https://files.pythonhosted.org/packages/02/28/58442ad1c22b5b6742b992ba9518420235adced665513868f99a1c2638a5/pydantic_core-2.33.1-cp312-cp312-win_amd64.whl", hash = "sha256:1c607801d85e2e123357b3893f82c97a42856192997b95b4d8325deb1cd0c5f4", size = 1956848 }, - { url = "https://files.pythonhosted.org/packages/a1/eb/f54809b51c7e2a1d9f439f158b8dd94359321abcc98767e16fc48ae5a77e/pydantic_core-2.33.1-cp312-cp312-win_arm64.whl", hash = "sha256:8d13f0276806ee722e70a1c93da19748594f19ac4299c7e41237fc791d1861ea", size = 1903986 }, - { url = "https://files.pythonhosted.org/packages/7a/24/eed3466a4308d79155f1cdd5c7432c80ddcc4530ba8623b79d5ced021641/pydantic_core-2.33.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:70af6a21237b53d1fe7b9325b20e65cbf2f0a848cf77bed492b029139701e66a", size = 2033551 }, - { url = "https://files.pythonhosted.org/packages/ab/14/df54b1a0bc9b6ded9b758b73139d2c11b4e8eb43e8ab9c5847c0a2913ada/pydantic_core-2.33.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:282b3fe1bbbe5ae35224a0dbd05aed9ccabccd241e8e6b60370484234b456266", size = 1852785 }, - { url = "https://files.pythonhosted.org/packages/fa/96/e275f15ff3d34bb04b0125d9bc8848bf69f25d784d92a63676112451bfb9/pydantic_core-2.33.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4b315e596282bbb5822d0c7ee9d255595bd7506d1cb20c2911a4da0b970187d3", size = 1897758 }, - { url = "https://files.pythonhosted.org/packages/b7/d8/96bc536e975b69e3a924b507d2a19aedbf50b24e08c80fb00e35f9baaed8/pydantic_core-2.33.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1dfae24cf9921875ca0ca6a8ecb4bb2f13c855794ed0d468d6abbec6e6dcd44a", size = 1986109 }, - { url = "https://files.pythonhosted.org/packages/90/72/ab58e43ce7e900b88cb571ed057b2fcd0e95b708a2e0bed475b10130393e/pydantic_core-2.33.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6dd8ecfde08d8bfadaea669e83c63939af76f4cf5538a72597016edfa3fad516", size = 2129159 }, - { url = "https://files.pythonhosted.org/packages/dc/3f/52d85781406886c6870ac995ec0ba7ccc028b530b0798c9080531b409fdb/pydantic_core-2.33.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2f593494876eae852dc98c43c6f260f45abdbfeec9e4324e31a481d948214764", size = 2680222 }, - { url = "https://files.pythonhosted.org/packages/f4/56/6e2ef42f363a0eec0fd92f74a91e0ac48cd2e49b695aac1509ad81eee86a/pydantic_core-2.33.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:948b73114f47fd7016088e5186d13faf5e1b2fe83f5e320e371f035557fd264d", size = 2006980 }, - { url = "https://files.pythonhosted.org/packages/4c/c0/604536c4379cc78359f9ee0aa319f4aedf6b652ec2854953f5a14fc38c5a/pydantic_core-2.33.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e11f3864eb516af21b01e25fac915a82e9ddad3bb0fb9e95a246067398b435a4", size = 2120840 }, - { url = "https://files.pythonhosted.org/packages/1f/46/9eb764814f508f0edfb291a0f75d10854d78113fa13900ce13729aaec3ae/pydantic_core-2.33.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:549150be302428b56fdad0c23c2741dcdb5572413776826c965619a25d9c6bde", size = 2072518 }, - { url = "https://files.pythonhosted.org/packages/42/e3/fb6b2a732b82d1666fa6bf53e3627867ea3131c5f39f98ce92141e3e3dc1/pydantic_core-2.33.1-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:495bc156026efafd9ef2d82372bd38afce78ddd82bf28ef5276c469e57c0c83e", size = 2248025 }, - { url = "https://files.pythonhosted.org/packages/5c/9d/fbe8fe9d1aa4dac88723f10a921bc7418bd3378a567cb5e21193a3c48b43/pydantic_core-2.33.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ec79de2a8680b1a67a07490bddf9636d5c2fab609ba8c57597e855fa5fa4dacd", size = 2254991 }, - { url = "https://files.pythonhosted.org/packages/aa/99/07e2237b8a66438d9b26482332cda99a9acccb58d284af7bc7c946a42fd3/pydantic_core-2.33.1-cp313-cp313-win32.whl", hash = "sha256:ee12a7be1742f81b8a65b36c6921022301d466b82d80315d215c4c691724986f", size = 1915262 }, - { url = "https://files.pythonhosted.org/packages/8a/f4/e457a7849beeed1e5defbcf5051c6f7b3c91a0624dd31543a64fc9adcf52/pydantic_core-2.33.1-cp313-cp313-win_amd64.whl", hash = "sha256:ede9b407e39949d2afc46385ce6bd6e11588660c26f80576c11c958e6647bc40", size = 1956626 }, - { url = "https://files.pythonhosted.org/packages/20/d0/e8d567a7cff7b04e017ae164d98011f1e1894269fe8e90ea187a3cbfb562/pydantic_core-2.33.1-cp313-cp313-win_arm64.whl", hash = "sha256:aa687a23d4b7871a00e03ca96a09cad0f28f443690d300500603bd0adba4b523", size = 1909590 }, - { url = "https://files.pythonhosted.org/packages/ef/fd/24ea4302d7a527d672c5be06e17df16aabfb4e9fdc6e0b345c21580f3d2a/pydantic_core-2.33.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:401d7b76e1000d0dd5538e6381d28febdcacb097c8d340dde7d7fc6e13e9f95d", size = 1812963 }, - { url = "https://files.pythonhosted.org/packages/5f/95/4fbc2ecdeb5c1c53f1175a32d870250194eb2fdf6291b795ab08c8646d5d/pydantic_core-2.33.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7aeb055a42d734c0255c9e489ac67e75397d59c6fbe60d155851e9782f276a9c", size = 1986896 }, - { url = "https://files.pythonhosted.org/packages/71/ae/fe31e7f4a62431222d8f65a3bd02e3fa7e6026d154a00818e6d30520ea77/pydantic_core-2.33.1-cp313-cp313t-win_amd64.whl", hash = "sha256:338ea9b73e6e109f15ab439e62cb3b78aa752c7fd9536794112e14bee02c8d18", size = 1931810 }, - { url = "https://files.pythonhosted.org/packages/9c/c7/8b311d5adb0fe00a93ee9b4e92a02b0ec08510e9838885ef781ccbb20604/pydantic_core-2.33.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:5c834f54f8f4640fd7e4b193f80eb25a0602bba9e19b3cd2fc7ffe8199f5ae02", size = 2041659 }, - { url = "https://files.pythonhosted.org/packages/8a/d6/4f58d32066a9e26530daaf9adc6664b01875ae0691570094968aaa7b8fcc/pydantic_core-2.33.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:049e0de24cf23766f12cc5cc71d8abc07d4a9deb9061b334b62093dedc7cb068", size = 1873294 }, - { url = "https://files.pythonhosted.org/packages/f7/3f/53cc9c45d9229da427909c751f8ed2bf422414f7664ea4dde2d004f596ba/pydantic_core-2.33.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a28239037b3d6f16916a4c831a5a0eadf856bdd6d2e92c10a0da3a59eadcf3e", size = 1903771 }, - { url = "https://files.pythonhosted.org/packages/f0/49/bf0783279ce674eb9903fb9ae43f6c614cb2f1c4951370258823f795368b/pydantic_core-2.33.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d3da303ab5f378a268fa7d45f37d7d85c3ec19769f28d2cc0c61826a8de21fe", size = 2083558 }, - { url = "https://files.pythonhosted.org/packages/9c/5b/0d998367687f986c7d8484a2c476d30f07bf5b8b1477649a6092bd4c540e/pydantic_core-2.33.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:25626fb37b3c543818c14821afe0fd3830bc327a43953bc88db924b68c5723f1", size = 2118038 }, - { url = "https://files.pythonhosted.org/packages/b3/33/039287d410230ee125daee57373ac01940d3030d18dba1c29cd3089dc3ca/pydantic_core-2.33.1-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:3ab2d36e20fbfcce8f02d73c33a8a7362980cff717926bbae030b93ae46b56c7", size = 2079315 }, - { url = "https://files.pythonhosted.org/packages/1f/85/6d8b2646d99c062d7da2d0ab2faeb0d6ca9cca4c02da6076376042a20da3/pydantic_core-2.33.1-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:2f9284e11c751b003fd4215ad92d325d92c9cb19ee6729ebd87e3250072cdcde", size = 2249063 }, - { url = "https://files.pythonhosted.org/packages/17/d7/c37d208d5738f7b9ad8f22ae8a727d88ebf9c16c04ed2475122cc3f7224a/pydantic_core-2.33.1-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:048c01eee07d37cbd066fc512b9d8b5ea88ceeb4e629ab94b3e56965ad655add", size = 2254631 }, - { url = "https://files.pythonhosted.org/packages/13/e0/bafa46476d328e4553b85ab9b2f7409e7aaef0ce4c937c894821c542d347/pydantic_core-2.33.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:5ccd429694cf26af7997595d627dd2637e7932214486f55b8a357edaac9dae8c", size = 2080877 }, - { url = "https://files.pythonhosted.org/packages/0b/76/1794e440c1801ed35415238d2c728f26cd12695df9057154ad768b7b991c/pydantic_core-2.33.1-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:3a371dc00282c4b84246509a5ddc808e61b9864aa1eae9ecc92bb1268b82db4a", size = 2042858 }, - { url = "https://files.pythonhosted.org/packages/73/b4/9cd7b081fb0b1b4f8150507cd59d27b275c3e22ad60b35cb19ea0977d9b9/pydantic_core-2.33.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:f59295ecc75a1788af8ba92f2e8c6eeaa5a94c22fc4d151e8d9638814f85c8fc", size = 1873745 }, - { url = "https://files.pythonhosted.org/packages/e1/d7/9ddb7575d4321e40d0363903c2576c8c0c3280ebea137777e5ab58d723e3/pydantic_core-2.33.1-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:08530b8ac922003033f399128505f513e30ca770527cc8bbacf75a84fcc2c74b", size = 1904188 }, - { url = "https://files.pythonhosted.org/packages/d1/a8/3194ccfe461bb08da19377ebec8cb4f13c9bd82e13baebc53c5c7c39a029/pydantic_core-2.33.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bae370459da6a5466978c0eacf90690cb57ec9d533f8e63e564ef3822bfa04fe", size = 2083479 }, - { url = "https://files.pythonhosted.org/packages/42/c7/84cb569555d7179ca0b3f838cef08f66f7089b54432f5b8599aac6e9533e/pydantic_core-2.33.1-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e3de2777e3b9f4d603112f78006f4ae0acb936e95f06da6cb1a45fbad6bdb4b5", size = 2118415 }, - { url = "https://files.pythonhosted.org/packages/3b/67/72abb8c73e0837716afbb58a59cc9e3ae43d1aa8677f3b4bc72c16142716/pydantic_core-2.33.1-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:3a64e81e8cba118e108d7126362ea30e021291b7805d47e4896e52c791be2761", size = 2079623 }, - { url = "https://files.pythonhosted.org/packages/0b/cd/c59707e35a47ba4cbbf153c3f7c56420c58653b5801b055dc52cccc8e2dc/pydantic_core-2.33.1-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:52928d8c1b6bda03cc6d811e8923dffc87a2d3c8b3bfd2ce16471c7147a24850", size = 2250175 }, - { url = "https://files.pythonhosted.org/packages/84/32/e4325a6676b0bed32d5b084566ec86ed7fd1e9bcbfc49c578b1755bde920/pydantic_core-2.33.1-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:1b30d92c9412beb5ac6b10a3eb7ef92ccb14e3f2a8d7732e2d739f58b3aa7544", size = 2254674 }, - { url = "https://files.pythonhosted.org/packages/12/6f/5596dc418f2e292ffc661d21931ab34591952e2843e7168ea5a52591f6ff/pydantic_core-2.33.1-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:f995719707e0e29f0f41a8aa3bcea6e761a36c9136104d3189eafb83f5cec5e5", size = 2080951 }, -] - -[[package]] -name = "pydantic-extra-types" -version = "2.10.3" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "pydantic" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/53/fa/6b268a47839f8af46ffeb5bb6aee7bded44fbad54e6bf826c11f17aef91a/pydantic_extra_types-2.10.3.tar.gz", hash = "sha256:dcc0a7b90ac9ef1b58876c9b8fdede17fbdde15420de9d571a9fccde2ae175bb", size = 95128 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/38/0a/f6f8e5f79d188e2f3fa9ecfccfa72538b685985dd5c7c2886c67af70e685/pydantic_extra_types-2.10.3-py3-none-any.whl", hash = "sha256:e8b372752b49019cd8249cc192c62a820d8019f5382a8789d0f887338a59c0f3", size = 37175 }, -] - -[package.optional-dependencies] -pendulum = [ - { name = "pendulum" }, -] - -[[package]] -name = "pydantic-settings" -version = "2.8.1" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "pydantic" }, - { name = "python-dotenv" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/88/82/c79424d7d8c29b994fb01d277da57b0a9b09cc03c3ff875f9bd8a86b2145/pydantic_settings-2.8.1.tar.gz", hash = "sha256:d5c663dfbe9db9d5e1c646b2e161da12f0d734d422ee56f567d0ea2cee4e8585", size = 83550 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/0b/53/a64f03044927dc47aafe029c42a5b7aabc38dfb813475e0e1bf71c4a59d0/pydantic_settings-2.8.1-py3-none-any.whl", hash = "sha256:81942d5ac3d905f7f3ee1a70df5dfb62d5569c12f51a5a647defc1c3d9ee2e9c", size = 30839 }, -] - -[[package]] -name = "pygments" -version = "2.19.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/7c/2d/c3338d48ea6cc0feb8446d8e6937e1408088a72a39937982cc6111d17f84/pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f", size = 4968581 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/8a/0b/9fcc47d19c48b59121088dd6da2488a49d5f72dacf8262e2790a1d2c7d15/pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c", size = 1225293 }, -] - -[[package]] -name = "pytest" -version = "7.4.4" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32'" }, - { name = "exceptiongroup", marker = "python_full_version < '3.11'" }, - { name = "iniconfig" }, - { name = "packaging" }, - { name = "pluggy" }, - { name = "tomli", marker = "python_full_version < '3.11'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/80/1f/9d8e98e4133ffb16c90f3b405c43e38d3abb715bb5d7a63a5a684f7e46a3/pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280", size = 1357116 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/51/ff/f6e8b8f39e08547faece4bd80f89d5a8de68a38b2d179cc1c4490ffa3286/pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8", size = 325287 }, -] - -[[package]] -name = "python-dateutil" -version = "2.9.0.post0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "six" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/66/c0/0c8b6ad9f17a802ee498c46e004a0eb49bc148f2fd230864601a86dcf6db/python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", size = 342432 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892 }, -] - -[[package]] -name = "python-dotenv" -version = "1.1.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/88/2c/7bb1416c5620485aa793f2de31d3df393d3686aa8a8506d11e10e13c5baf/python_dotenv-1.1.0.tar.gz", hash = "sha256:41f90bc6f5f177fb41f53e87666db362025010eb28f60a01c9143bfa33a2b2d5", size = 39920 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/1e/18/98a99ad95133c6a6e2005fe89faedf294a748bd5dc803008059409ac9b1e/python_dotenv-1.1.0-py3-none-any.whl", hash = "sha256:d7c01d9e2293916c18baf562d95698754b0dbbb5e74d457c45d4f6561fb9d55d", size = 20256 }, -] - -[[package]] -name = "python-multipart" -version = "0.0.20" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/f3/87/f44d7c9f274c7ee665a29b885ec97089ec5dc034c7f3fafa03da9e39a09e/python_multipart-0.0.20.tar.gz", hash = "sha256:8dd0cab45b8e23064ae09147625994d090fa46f5b0d1e13af944c331a7fa9d13", size = 37158 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/45/58/38b5afbc1a800eeea951b9285d3912613f2603bdf897a4ab0f4bd7f405fc/python_multipart-0.0.20-py3-none-any.whl", hash = "sha256:8a62d3a8335e06589fe01f2a3e178cdcc632f3fbe0d492ad9ee0ec35aab1f104", size = 24546 }, -] - -[[package]] -name = "python-ulid" -version = "3.0.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/9a/db/e5e67aeca9c2420cb91f94007f30693cc3628ae9783a565fd33ffb3fbfdd/python_ulid-3.0.0.tar.gz", hash = "sha256:e50296a47dc8209d28629a22fc81ca26c00982c78934bd7766377ba37ea49a9f", size = 28822 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/63/4e/cc2ba2c0df2589f35a4db8473b8c2ba9bbfc4acdec4a94f1c78934d2350f/python_ulid-3.0.0-py3-none-any.whl", hash = "sha256:e4c4942ff50dbd79167ad01ac725ec58f924b4018025ce22c858bfcff99a5e31", size = 11194 }, -] - -[[package]] -name = "pyyaml" -version = "6.0.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/54/ed/79a089b6be93607fa5cdaedf301d7dfb23af5f25c398d5ead2525b063e17/pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e", size = 130631 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/9b/95/a3fac87cb7158e231b5a6012e438c647e1a87f09f8e0d123acec8ab8bf71/PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0a9a2848a5b7feac301353437eb7d5957887edbf81d56e903999a75a3d743086", size = 184199 }, - { url = "https://files.pythonhosted.org/packages/c7/7a/68bd47624dab8fd4afbfd3c48e3b79efe09098ae941de5b58abcbadff5cb/PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:29717114e51c84ddfba879543fb232a6ed60086602313ca38cce623c1d62cfbf", size = 171758 }, - { url = "https://files.pythonhosted.org/packages/49/ee/14c54df452143b9ee9f0f29074d7ca5516a36edb0b4cc40c3f280131656f/PyYAML-6.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8824b5a04a04a047e72eea5cec3bc266db09e35de6bdfe34c9436ac5ee27d237", size = 718463 }, - { url = "https://files.pythonhosted.org/packages/4d/61/de363a97476e766574650d742205be468921a7b532aa2499fcd886b62530/PyYAML-6.0.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7c36280e6fb8385e520936c3cb3b8042851904eba0e58d277dca80a5cfed590b", size = 719280 }, - { url = "https://files.pythonhosted.org/packages/6b/4e/1523cb902fd98355e2e9ea5e5eb237cbc5f3ad5f3075fa65087aa0ecb669/PyYAML-6.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ec031d5d2feb36d1d1a24380e4db6d43695f3748343d99434e6f5f9156aaa2ed", size = 751239 }, - { url = "https://files.pythonhosted.org/packages/b7/33/5504b3a9a4464893c32f118a9cc045190a91637b119a9c881da1cf6b7a72/PyYAML-6.0.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:936d68689298c36b53b29f23c6dbb74de12b4ac12ca6cfe0e047bedceea56180", size = 695802 }, - { url = "https://files.pythonhosted.org/packages/5c/20/8347dcabd41ef3a3cdc4f7b7a2aff3d06598c8779faa189cdbf878b626a4/PyYAML-6.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:23502f431948090f597378482b4812b0caae32c22213aecf3b55325e049a6c68", size = 720527 }, - { url = "https://files.pythonhosted.org/packages/be/aa/5afe99233fb360d0ff37377145a949ae258aaab831bde4792b32650a4378/PyYAML-6.0.2-cp310-cp310-win32.whl", hash = "sha256:2e99c6826ffa974fe6e27cdb5ed0021786b03fc98e5ee3c5bfe1fd5015f42b99", size = 144052 }, - { url = "https://files.pythonhosted.org/packages/b5/84/0fa4b06f6d6c958d207620fc60005e241ecedceee58931bb20138e1e5776/PyYAML-6.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:a4d3091415f010369ae4ed1fc6b79def9416358877534caf6a0fdd2146c87a3e", size = 161774 }, - { url = "https://files.pythonhosted.org/packages/f8/aa/7af4e81f7acba21a4c6be026da38fd2b872ca46226673c89a758ebdc4fd2/PyYAML-6.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cc1c1159b3d456576af7a3e4d1ba7e6924cb39de8f67111c735f6fc832082774", size = 184612 }, - { url = "https://files.pythonhosted.org/packages/8b/62/b9faa998fd185f65c1371643678e4d58254add437edb764a08c5a98fb986/PyYAML-6.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1e2120ef853f59c7419231f3bf4e7021f1b936f6ebd222406c3b60212205d2ee", size = 172040 }, - { url = "https://files.pythonhosted.org/packages/ad/0c/c804f5f922a9a6563bab712d8dcc70251e8af811fce4524d57c2c0fd49a4/PyYAML-6.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d225db5a45f21e78dd9358e58a98702a0302f2659a3c6cd320564b75b86f47c", size = 736829 }, - { url = "https://files.pythonhosted.org/packages/51/16/6af8d6a6b210c8e54f1406a6b9481febf9c64a3109c541567e35a49aa2e7/PyYAML-6.0.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5ac9328ec4831237bec75defaf839f7d4564be1e6b25ac710bd1a96321cc8317", size = 764167 }, - { url = "https://files.pythonhosted.org/packages/75/e4/2c27590dfc9992f73aabbeb9241ae20220bd9452df27483b6e56d3975cc5/PyYAML-6.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ad2a3decf9aaba3d29c8f537ac4b243e36bef957511b4766cb0057d32b0be85", size = 762952 }, - { url = "https://files.pythonhosted.org/packages/9b/97/ecc1abf4a823f5ac61941a9c00fe501b02ac3ab0e373c3857f7d4b83e2b6/PyYAML-6.0.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4", size = 735301 }, - { url = "https://files.pythonhosted.org/packages/45/73/0f49dacd6e82c9430e46f4a027baa4ca205e8b0a9dce1397f44edc23559d/PyYAML-6.0.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:797b4f722ffa07cc8d62053e4cff1486fa6dc094105d13fea7b1de7d8bf71c9e", size = 756638 }, - { url = "https://files.pythonhosted.org/packages/22/5f/956f0f9fc65223a58fbc14459bf34b4cc48dec52e00535c79b8db361aabd/PyYAML-6.0.2-cp311-cp311-win32.whl", hash = "sha256:11d8f3dd2b9c1207dcaf2ee0bbbfd5991f571186ec9cc78427ba5bd32afae4b5", size = 143850 }, - { url = "https://files.pythonhosted.org/packages/ed/23/8da0bbe2ab9dcdd11f4f4557ccaf95c10b9811b13ecced089d43ce59c3c8/PyYAML-6.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:e10ce637b18caea04431ce14fabcf5c64a1c61ec9c56b071a4b7ca131ca52d44", size = 161980 }, - { url = "https://files.pythonhosted.org/packages/86/0c/c581167fc46d6d6d7ddcfb8c843a4de25bdd27e4466938109ca68492292c/PyYAML-6.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:c70c95198c015b85feafc136515252a261a84561b7b1d51e3384e0655ddf25ab", size = 183873 }, - { url = "https://files.pythonhosted.org/packages/a8/0c/38374f5bb272c051e2a69281d71cba6fdb983413e6758b84482905e29a5d/PyYAML-6.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ce826d6ef20b1bc864f0a68340c8b3287705cae2f8b4b1d932177dcc76721725", size = 173302 }, - { url = "https://files.pythonhosted.org/packages/c3/93/9916574aa8c00aa06bbac729972eb1071d002b8e158bd0e83a3b9a20a1f7/PyYAML-6.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f71ea527786de97d1a0cc0eacd1defc0985dcf6b3f17bb77dcfc8c34bec4dc5", size = 739154 }, - { url = "https://files.pythonhosted.org/packages/95/0f/b8938f1cbd09739c6da569d172531567dbcc9789e0029aa070856f123984/PyYAML-6.0.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9b22676e8097e9e22e36d6b7bda33190d0d400f345f23d4065d48f4ca7ae0425", size = 766223 }, - { url = "https://files.pythonhosted.org/packages/b9/2b/614b4752f2e127db5cc206abc23a8c19678e92b23c3db30fc86ab731d3bd/PyYAML-6.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:80bab7bfc629882493af4aa31a4cfa43a4c57c83813253626916b8c7ada83476", size = 767542 }, - { url = "https://files.pythonhosted.org/packages/d4/00/dd137d5bcc7efea1836d6264f049359861cf548469d18da90cd8216cf05f/PyYAML-6.0.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:0833f8694549e586547b576dcfaba4a6b55b9e96098b36cdc7ebefe667dfed48", size = 731164 }, - { url = "https://files.pythonhosted.org/packages/c9/1f/4f998c900485e5c0ef43838363ba4a9723ac0ad73a9dc42068b12aaba4e4/PyYAML-6.0.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8b9c7197f7cb2738065c481a0461e50ad02f18c78cd75775628afb4d7137fb3b", size = 756611 }, - { url = "https://files.pythonhosted.org/packages/df/d1/f5a275fdb252768b7a11ec63585bc38d0e87c9e05668a139fea92b80634c/PyYAML-6.0.2-cp312-cp312-win32.whl", hash = "sha256:ef6107725bd54b262d6dedcc2af448a266975032bc85ef0172c5f059da6325b4", size = 140591 }, - { url = "https://files.pythonhosted.org/packages/0c/e8/4f648c598b17c3d06e8753d7d13d57542b30d56e6c2dedf9c331ae56312e/PyYAML-6.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:7e7401d0de89a9a855c839bc697c079a4af81cf878373abd7dc625847d25cbd8", size = 156338 }, - { url = "https://files.pythonhosted.org/packages/ef/e3/3af305b830494fa85d95f6d95ef7fa73f2ee1cc8ef5b495c7c3269fb835f/PyYAML-6.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:efdca5630322a10774e8e98e1af481aad470dd62c3170801852d752aa7a783ba", size = 181309 }, - { url = "https://files.pythonhosted.org/packages/45/9f/3b1c20a0b7a3200524eb0076cc027a970d320bd3a6592873c85c92a08731/PyYAML-6.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:50187695423ffe49e2deacb8cd10510bc361faac997de9efef88badc3bb9e2d1", size = 171679 }, - { url = "https://files.pythonhosted.org/packages/7c/9a/337322f27005c33bcb656c655fa78325b730324c78620e8328ae28b64d0c/PyYAML-6.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0ffe8360bab4910ef1b9e87fb812d8bc0a308b0d0eef8c8f44e0254ab3b07133", size = 733428 }, - { url = "https://files.pythonhosted.org/packages/a3/69/864fbe19e6c18ea3cc196cbe5d392175b4cf3d5d0ac1403ec3f2d237ebb5/PyYAML-6.0.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:17e311b6c678207928d649faa7cb0d7b4c26a0ba73d41e99c4fff6b6c3276484", size = 763361 }, - { url = "https://files.pythonhosted.org/packages/04/24/b7721e4845c2f162d26f50521b825fb061bc0a5afcf9a386840f23ea19fa/PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70b189594dbe54f75ab3a1acec5f1e3faa7e8cf2f1e08d9b561cb41b845f69d5", size = 759523 }, - { url = "https://files.pythonhosted.org/packages/2b/b2/e3234f59ba06559c6ff63c4e10baea10e5e7df868092bf9ab40e5b9c56b6/PyYAML-6.0.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:41e4e3953a79407c794916fa277a82531dd93aad34e29c2a514c2c0c5fe971cc", size = 726660 }, - { url = "https://files.pythonhosted.org/packages/fe/0f/25911a9f080464c59fab9027482f822b86bf0608957a5fcc6eaac85aa515/PyYAML-6.0.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:68ccc6023a3400877818152ad9a1033e3db8625d899c72eacb5a668902e4d652", size = 751597 }, - { url = "https://files.pythonhosted.org/packages/14/0d/e2c3b43bbce3cf6bd97c840b46088a3031085179e596d4929729d8d68270/PyYAML-6.0.2-cp313-cp313-win32.whl", hash = "sha256:bc2fa7c6b47d6bc618dd7fb02ef6fdedb1090ec036abab80d4681424b84c1183", size = 140527 }, - { url = "https://files.pythonhosted.org/packages/fa/de/02b54f42487e3d3c6efb3f89428677074ca7bf43aae402517bc7cca949f3/PyYAML-6.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:8388ee1976c416731879ac16da0aff3f63b286ffdd57cdeb95f3f2e085687563", size = 156446 }, -] - -[[package]] -name = "rich" -version = "14.0.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "markdown-it-py" }, - { name = "pygments" }, - { name = "typing-extensions", marker = "python_full_version < '3.11'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/a1/53/830aa4c3066a8ab0ae9a9955976fb770fe9c6102117c8ec4ab3ea62d89e8/rich-14.0.0.tar.gz", hash = "sha256:82f1bc23a6a21ebca4ae0c45af9bdbc492ed20231dcb63f297d6d1021a9d5725", size = 224078 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/0d/9b/63f4c7ebc259242c89b3acafdb37b41d1185c07ff0011164674e9076b491/rich-14.0.0-py3-none-any.whl", hash = "sha256:1c9491e1951aac09caffd42f448ee3d04e58923ffe14993f6e83068dc395d7e0", size = 243229 }, -] - -[[package]] -name = "rich-toolkit" -version = "0.14.1" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "click" }, - { name = "rich" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/2e/ea/13945d58d556a28dfb0f774ad5c8af759527390e59505a40d164bf8ce1ce/rich_toolkit-0.14.1.tar.gz", hash = "sha256:9248e2d087bfc01f3e4c5c8987e05f7fa744d00dd22fa2be3aa6e50255790b3f", size = 104416 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/66/e8/61c5b12d1567fdba41a6775db12a090d88b8305424ee7c47259c70d33cb4/rich_toolkit-0.14.1-py3-none-any.whl", hash = "sha256:dc92c0117d752446d04fdc828dbca5873bcded213a091a5d3742a2beec2e6559", size = 24177 }, -] - -[[package]] -name = "ruff" -version = "0.11.4" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/e8/5b/3ae20f89777115944e89c2d8c2e795dcc5b9e04052f76d5347e35e0da66e/ruff-0.11.4.tar.gz", hash = "sha256:f45bd2fb1a56a5a85fae3b95add03fb185a0b30cf47f5edc92aa0355ca1d7407", size = 3933063 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/9c/db/baee59ac88f57527fcbaad3a7b309994e42329c6bc4d4d2b681a3d7b5426/ruff-0.11.4-py3-none-linux_armv6l.whl", hash = "sha256:d9f4a761ecbde448a2d3e12fb398647c7f0bf526dbc354a643ec505965824ed2", size = 10106493 }, - { url = "https://files.pythonhosted.org/packages/c1/d6/9a0962cbb347f4ff98b33d699bf1193ff04ca93bed4b4222fd881b502154/ruff-0.11.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:8c1747d903447d45ca3d40c794d1a56458c51e5cc1bc77b7b64bd2cf0b1626cc", size = 10876382 }, - { url = "https://files.pythonhosted.org/packages/3a/8f/62bab0c7d7e1ae3707b69b157701b41c1ccab8f83e8501734d12ea8a839f/ruff-0.11.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:51a6494209cacca79e121e9b244dc30d3414dac8cc5afb93f852173a2ecfc906", size = 10237050 }, - { url = "https://files.pythonhosted.org/packages/09/96/e296965ae9705af19c265d4d441958ed65c0c58fc4ec340c27cc9d2a1f5b/ruff-0.11.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3f171605f65f4fc49c87f41b456e882cd0c89e4ac9d58e149a2b07930e1d466f", size = 10424984 }, - { url = "https://files.pythonhosted.org/packages/e5/56/644595eb57d855afed6e54b852e2df8cd5ca94c78043b2f29bdfb29882d5/ruff-0.11.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ebf99ea9af918878e6ce42098981fc8c1db3850fef2f1ada69fb1dcdb0f8e79e", size = 9957438 }, - { url = "https://files.pythonhosted.org/packages/86/83/9d3f3bed0118aef3e871ded9e5687fb8c5776bde233427fd9ce0a45db2d4/ruff-0.11.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:edad2eac42279df12e176564a23fc6f4aaeeb09abba840627780b1bb11a9d223", size = 11547282 }, - { url = "https://files.pythonhosted.org/packages/40/e6/0c6e4f5ae72fac5ccb44d72c0111f294a5c2c8cc5024afcb38e6bda5f4b3/ruff-0.11.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:f103a848be9ff379fc19b5d656c1f911d0a0b4e3e0424f9532ececf319a4296e", size = 12182020 }, - { url = "https://files.pythonhosted.org/packages/b5/92/4aed0e460aeb1df5ea0c2fbe8d04f9725cccdb25d8da09a0d3f5b8764bf8/ruff-0.11.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:193e6fac6eb60cc97b9f728e953c21cc38a20077ed64f912e9d62b97487f3f2d", size = 11679154 }, - { url = "https://files.pythonhosted.org/packages/1b/d3/7316aa2609f2c592038e2543483eafbc62a0e1a6a6965178e284808c095c/ruff-0.11.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7af4e5f69b7c138be8dcffa5b4a061bf6ba6a3301f632a6bce25d45daff9bc99", size = 13905985 }, - { url = "https://files.pythonhosted.org/packages/63/80/734d3d17546e47ff99871f44ea7540ad2bbd7a480ed197fe8a1c8a261075/ruff-0.11.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:126b1bf13154aa18ae2d6c3c5efe144ec14b97c60844cfa6eb960c2a05188222", size = 11348343 }, - { url = "https://files.pythonhosted.org/packages/04/7b/70fc7f09a0161dce9613a4671d198f609e653d6f4ff9eee14d64c4c240fb/ruff-0.11.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:e8806daaf9dfa881a0ed603f8a0e364e4f11b6ed461b56cae2b1c0cab0645304", size = 10308487 }, - { url = "https://files.pythonhosted.org/packages/1a/22/1cdd62dabd678d75842bf4944fd889cf794dc9e58c18cc547f9eb28f95ed/ruff-0.11.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:5d94bb1cc2fc94a769b0eb975344f1b1f3d294da1da9ddbb5a77665feb3a3019", size = 9929091 }, - { url = "https://files.pythonhosted.org/packages/9f/20/40e0563506332313148e783bbc1e4276d657962cc370657b2fff20e6e058/ruff-0.11.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:995071203d0fe2183fc7a268766fd7603afb9996785f086b0d76edee8755c896", size = 10924659 }, - { url = "https://files.pythonhosted.org/packages/b5/41/eef9b7aac8819d9e942f617f9db296f13d2c4576806d604aba8db5a753f1/ruff-0.11.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:7a37ca937e307ea18156e775a6ac6e02f34b99e8c23fe63c1996185a4efe0751", size = 11428160 }, - { url = "https://files.pythonhosted.org/packages/ff/61/c488943414fb2b8754c02f3879de003e26efdd20f38167ded3fb3fc1cda3/ruff-0.11.4-py3-none-win32.whl", hash = "sha256:0e9365a7dff9b93af933dab8aebce53b72d8f815e131796268709890b4a83270", size = 10311496 }, - { url = "https://files.pythonhosted.org/packages/b6/2b/2a1c8deb5f5dfa3871eb7daa41492c4d2b2824a74d2b38e788617612a66d/ruff-0.11.4-py3-none-win_amd64.whl", hash = "sha256:5a9fa1c69c7815e39fcfb3646bbfd7f528fa8e2d4bebdcf4c2bd0fa037a255fb", size = 11399146 }, - { url = "https://files.pythonhosted.org/packages/4f/03/3aec4846226d54a37822e4c7ea39489e4abd6f88388fba74e3d4abe77300/ruff-0.11.4-py3-none-win_arm64.whl", hash = "sha256:d435db6b9b93d02934cf61ef332e66af82da6d8c69aefdea5994c89997c7a0fc", size = 10450306 }, -] - -[[package]] -name = "semver" -version = "3.0.4" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/72/d1/d3159231aec234a59dd7d601e9dd9fe96f3afff15efd33c1070019b26132/semver-3.0.4.tar.gz", hash = "sha256:afc7d8c584a5ed0a11033af086e8af226a9c0b206f313e0301f8dd7b6b589602", size = 269730 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a6/24/4d91e05817e92e3a61c8a21e08fd0f390f5301f1c448b137c57c4bc6e543/semver-3.0.4-py3-none-any.whl", hash = "sha256:9c824d87ba7f7ab4a1890799cec8596f15c1241cb473404ea1cb0c55e4b04746", size = 17912 }, -] - -[[package]] -name = "shellingham" -version = "1.5.4" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/58/15/8b3609fd3830ef7b27b655beb4b4e9c62313a4e8da8c676e142cc210d58e/shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de", size = 10310 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755 }, -] - -[[package]] -name = "six" -version = "1.17.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81", size = 34031 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050 }, -] - -[[package]] -name = "sniffio" -version = "1.3.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/a2/87/a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd/sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc", size = 20372 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235 }, -] - -[[package]] -name = "starlette" -version = "0.46.1" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "anyio" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/04/1b/52b27f2e13ceedc79a908e29eac426a63465a1a01248e5f24aa36a62aeb3/starlette-0.46.1.tar.gz", hash = "sha256:3c88d58ee4bd1bb807c0d1acb381838afc7752f9ddaec81bbe4383611d833230", size = 2580102 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a0/4b/528ccf7a982216885a1ff4908e886b8fb5f19862d1962f56a3fce2435a70/starlette-0.46.1-py3-none-any.whl", hash = "sha256:77c74ed9d2720138b25875133f3a2dae6d854af2ec37dceb56aef370c1d8a227", size = 71995 }, -] - -[[package]] -name = "time-machine" -version = "2.16.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "python-dateutil" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/fb/dd/5022939b9cadefe3af04f4012186c29b8afbe858b1ec2cfa38baeec94dab/time_machine-2.16.0.tar.gz", hash = "sha256:4a99acc273d2f98add23a89b94d4dd9e14969c01214c8514bfa78e4e9364c7e2", size = 24626 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/79/47/32fdb8e70122edbc8be9db1f032d22b38e3d9ef0bf52c64470d0815cdb62/time_machine-2.16.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:09531af59fdfb39bfd24d28bd1e837eff5a5d98318509a31b6cfd57d27801e52", size = 20493 }, - { url = "https://files.pythonhosted.org/packages/b1/e6/f3bc391d5642e69299f2d1f0a46e7f98d1669e82b1e16c8cf3c6e4615059/time_machine-2.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:92d0b0f3c49f34dd76eb462f0afdc61ed1cb318c06c46d03e99b44ebb489bdad", size = 16757 }, - { url = "https://files.pythonhosted.org/packages/d4/7f/3a78d50fec64edd9964bf42b66a2e659a9846669ac8f705acc363ee79d3a/time_machine-2.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7c29616e18e2349a8766d5b6817920fc74e39c00fa375d202231e9d525a1b882", size = 34527 }, - { url = "https://files.pythonhosted.org/packages/61/00/7cf1324d8f8db8f5dab71c44ed1e9c11c4f1cecca9d4363abf44154aa13b/time_machine-2.16.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c1ceb6035a64cb00650e3ab203cf3faffac18576a3f3125c24df468b784077c7", size = 32537 }, - { url = "https://files.pythonhosted.org/packages/8e/c2/edf5ccb2fa529251eb7f1cfb34098c0ef236dbb88f0a6564d06f6f8378f5/time_machine-2.16.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64c205ea37b8c4ba232645335fc3b75bc2d03ce30f0a34649e36cae85652ee96", size = 34353 }, - { url = "https://files.pythonhosted.org/packages/a9/1e/178b9e3d0054300a4dd0485747c89359e5f719f090ae5165c88618793700/time_machine-2.16.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:dfe92412bd11104c4f0fb2da68653e6c45b41f7217319a83a8b66ed4f20148b3", size = 34045 }, - { url = "https://files.pythonhosted.org/packages/e5/4d/068ad9660f00f88a54f3ff7e9d423ed5c08a5f8147518f6c66fd0393dde7/time_machine-2.16.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:d5fe7a6284e3dce87ae13a25029c53542dd27a28d151f3ef362ec4dd9c3e45fd", size = 32356 }, - { url = "https://files.pythonhosted.org/packages/a5/25/c0f26294808946ec5b665f17a0072049a3f9e2468abc18aa8fe22580b4cf/time_machine-2.16.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c0fca3025266d88d1b48be162a43b7c2d91c81cc5b3bee9f01194678ffb9969a", size = 33737 }, - { url = "https://files.pythonhosted.org/packages/8b/d4/ae909a269828eaa7672e1201403976e794ea679ae7ba04fe0c0c0c65c2b6/time_machine-2.16.0-cp310-cp310-win32.whl", hash = "sha256:4149e17018af07a5756a1df84aea71e6e178598c358c860c6bfec42170fa7970", size = 19133 }, - { url = "https://files.pythonhosted.org/packages/7e/e7/5946d62d49e79b97c6772fe2918eccbd069d74effa8d50bdca4056502aeb/time_machine-2.16.0-cp310-cp310-win_amd64.whl", hash = "sha256:01bc257e9418980a4922de94775be42a966e1a082fb01a1635917f9afc7b84ca", size = 19995 }, - { url = "https://files.pythonhosted.org/packages/54/cb/6507c6594f086bc955ff200cc4fd415d2ab229371ca3ba8fc3d27429a9cc/time_machine-2.16.0-cp310-cp310-win_arm64.whl", hash = "sha256:6895e3e84119594ab12847c928f619d40ae9cedd0755515dc154a5b5dc6edd9f", size = 18109 }, - { url = "https://files.pythonhosted.org/packages/38/7b/34aad93f75f86503dd1fa53bc120d8129fe4de83aef58ffa78c62b044ef9/time_machine-2.16.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:8f936566ef9f09136a3d5db305961ef6d897b76b240c9ff4199144aed6dd4fe5", size = 20169 }, - { url = "https://files.pythonhosted.org/packages/68/cb/7d020d5c05d0460a4a96232b0777882ef989c1e6144d11ba984c4b0b4d1a/time_machine-2.16.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5886e23ede3478ca2a3e0a641f5d09dd784dfa9e48c96e8e5e31fc4fe77b6dc0", size = 16614 }, - { url = "https://files.pythonhosted.org/packages/0d/24/ce1ff76c9a4f3be88c2b947f2411a5a8019390734597d3106a151f8a9416/time_machine-2.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c76caf539fa4941e1817b7c482c87c65c52a1903fea761e84525955c6106fafb", size = 32507 }, - { url = "https://files.pythonhosted.org/packages/08/d7/ba1135587bd2ed105e59ed7e05969c913277d110fecc0ed871006ea3f763/time_machine-2.16.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:298aa423e07c8b21b991782f01d7749c871c792319c2af3e9755f9ab49033212", size = 30627 }, - { url = "https://files.pythonhosted.org/packages/da/c6/f490aaddc80c54238f4b8fe97870bbfe0d2c70fe4a57269badc94f5f38a6/time_machine-2.16.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e3391ae9c484736850bb44ef125cbad52fe2d1b69e42c95dc88c43af8ead2cc7", size = 32362 }, - { url = "https://files.pythonhosted.org/packages/b1/f7/2522ae1c1995a39d6d8b7ee7efed47ec8bd7ff3240fdb2662a8b7e11b84a/time_machine-2.16.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:503e7ff507c2089699d91885fc5b9c8ff16774a7b6aff48b4dcee0c0a0685b61", size = 32188 }, - { url = "https://files.pythonhosted.org/packages/e9/53/b1ccb55f39e7e62660f852d7aedef438d2872ea9c73f64be46d0d3b3f3d7/time_machine-2.16.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:eee7b0fc4fbab2c6585ea17606c6548be83919c70deea0865409fe9fc2d8cdce", size = 30600 }, - { url = "https://files.pythonhosted.org/packages/19/1f/37a5a9333a2da35b0fc43e8ac693b82dd5492892131bc3cc0c8f5835af94/time_machine-2.16.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9db5e5b3ccdadaafa5730c2f9db44c38b013234c9ad01f87738907e19bdba268", size = 31896 }, - { url = "https://files.pythonhosted.org/packages/fc/97/e1a8bd64e5432adf47859cb63847b4472efc644b508602141c60ccf52112/time_machine-2.16.0-cp311-cp311-win32.whl", hash = "sha256:2552f0767bc10c9d668f108fef9b487809cdeb772439ce932e74136365c69baf", size = 19030 }, - { url = "https://files.pythonhosted.org/packages/34/c9/f4764e447aa9da4031c89da60fa69f4f73fd45571415788c298cbd4620e9/time_machine-2.16.0-cp311-cp311-win_amd64.whl", hash = "sha256:12474fcdbc475aa6fe5275fe7224e685c5b9777f5939647f35980e9614ae7558", size = 19924 }, - { url = "https://files.pythonhosted.org/packages/8a/c0/788500d33656a044e3289b814106c2277209ac73316c00b9668012ce6027/time_machine-2.16.0-cp311-cp311-win_arm64.whl", hash = "sha256:ac2df0fa564356384515ed62cb6679f33f1f529435b16b0ec0f88414635dbe39", size = 17993 }, - { url = "https://files.pythonhosted.org/packages/4a/f4/603a84e7ae6427a53953db9f61b689dc6adf233e03c5f5ca907a901452fd/time_machine-2.16.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:84788f4d62a8b1bf5e499bb9b0e23ceceea21c415ad6030be6267ce3d639842f", size = 20155 }, - { url = "https://files.pythonhosted.org/packages/d8/94/dbe69aecb4b84be52d34814e63176c5ca61f38ee9e6ecda11104653405b5/time_machine-2.16.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:15ec236b6571730236a193d9d6c11d472432fc6ab54e85eac1c16d98ddcd71bf", size = 16640 }, - { url = "https://files.pythonhosted.org/packages/da/13/27f11be25d7bd298e033b9da93217e5b68309bf724b6e494cdadb471d00d/time_machine-2.16.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cedc989717c8b44a3881ac3d68ab5a95820448796c550de6a2149ed1525157f0", size = 33721 }, - { url = "https://files.pythonhosted.org/packages/e6/9d/70e4640fed1fd8122204ae825c688d0ef8c04f515ec6bf3c5f3086d6510e/time_machine-2.16.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9d26d79de1c63a8c6586c75967e09b0ff306aa7e944a1eaddb74595c9b1839ca", size = 31646 }, - { url = "https://files.pythonhosted.org/packages/a1/cb/93bc0e51bea4e171a85151dbba3c3b3f612b50b953cd3076f5b4f0db9e14/time_machine-2.16.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:317b68b56a9c3731e0cf8886e0f94230727159e375988b36c60edce0ddbcb44a", size = 33403 }, - { url = "https://files.pythonhosted.org/packages/89/71/2c6a63ad4fbce3d62d46bbd9ac4433f30bade7f25978ce00815b905bcfcf/time_machine-2.16.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:43e1e18279759897be3293a255d53e6b1cb0364b69d9591d0b80c51e461c94b0", size = 33327 }, - { url = "https://files.pythonhosted.org/packages/68/4e/205c2b26763b8817cd6b8868242843800a1fbf275f2af35f5ba35ff2b01a/time_machine-2.16.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:e43adb22def972a29d2b147999b56897116085777a0fea182fd93ee45730611e", size = 31454 }, - { url = "https://files.pythonhosted.org/packages/d7/95/44c1aa3994919f93534244c40cfd2fb9416d7686dc0c8b9b262c751b5118/time_machine-2.16.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0c766bea27a0600e36806d628ebc4b47178b12fcdfb6c24dc0a566a9c06bfe7f", size = 32972 }, - { url = "https://files.pythonhosted.org/packages/d4/ee/75243df9c7cf30f108758e887141a58e6544baaa46e2e647b9ccc56db819/time_machine-2.16.0-cp312-cp312-win32.whl", hash = "sha256:6dae82ab647d107817e013db82223e20a9853fa88543fec853ae326382d03c2e", size = 19078 }, - { url = "https://files.pythonhosted.org/packages/d4/7c/d4e67cc031f9653c92167ccf87d241e3208653d191c96ac79281c273ab92/time_machine-2.16.0-cp312-cp312-win_amd64.whl", hash = "sha256:265462c77dc9576267c3c7f20707780a171a9fdbac93ac22e608c309efd68c33", size = 19923 }, - { url = "https://files.pythonhosted.org/packages/aa/b6/7047226fcb9afefe47fc80f605530535bf71ad99b6797f057abbfa4cd9a5/time_machine-2.16.0-cp312-cp312-win_arm64.whl", hash = "sha256:ef768e14768eebe3bb1196c0dece8e14c1c6991605721214a0c3c68cf77eb216", size = 18003 }, - { url = "https://files.pythonhosted.org/packages/a6/18/3087d0eb185cedbc82385f46bf16032ec7102a0e070205a2c88c4ecf9952/time_machine-2.16.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:7751bf745d54e9e8b358c0afa332815da9b8a6194b26d0fd62876ab6c4d5c9c0", size = 20209 }, - { url = "https://files.pythonhosted.org/packages/03/a3/fcc3eaf69390402ecf491d718e533b6d0e06d944d77fc8d87be3a2839102/time_machine-2.16.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:1784edf173ca840ba154de6eed000b5727f65ab92972c2f88cec5c4d6349c5f2", size = 16681 }, - { url = "https://files.pythonhosted.org/packages/a2/96/8b76d264014bf9dc21873218de50d67223c71736f87fe6c65e582f7c29ac/time_machine-2.16.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2f5876a5682ce1f517e55d7ace2383432627889f6f7e338b961f99d684fd9e8d", size = 33768 }, - { url = "https://files.pythonhosted.org/packages/5c/13/59ae8259be02b6c657ef6e3b6952bf274b43849f6f35cc61a576c68ce301/time_machine-2.16.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:806672529a2e255cd901f244c9033767dc1fa53466d0d3e3e49565a1572a64fe", size = 31685 }, - { url = "https://files.pythonhosted.org/packages/3e/c1/9f142beb4d373a2a01ebb58d5117289315baa5131d880ec804db49e94bf7/time_machine-2.16.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:667b150fedb54acdca2a4bea5bf6da837b43e6dd12857301b48191f8803ba93f", size = 33447 }, - { url = "https://files.pythonhosted.org/packages/95/f7/ed9ecd93c2d38dca77d0a28e070020f3ce0fb23e0d4a6edb14bcfffa5526/time_machine-2.16.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:da3ae1028af240c0c46c79adf9c1acffecc6ed1701f2863b8132f5ceae6ae4b5", size = 33408 }, - { url = "https://files.pythonhosted.org/packages/91/40/d0d274d70fa2c4cad531745deb8c81346365beb0a2736be05a3acde8b94a/time_machine-2.16.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:520a814ea1b2706c89ab260a54023033d3015abef25c77873b83e3d7c1fafbb2", size = 31526 }, - { url = "https://files.pythonhosted.org/packages/1d/ba/a27cdbb324d9a6d779cde0d514d47b696b5a6a653705d4b511fd65ef1514/time_machine-2.16.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8243664438bb468408b29c6865958662d75e51f79c91842d2794fa22629eb697", size = 33042 }, - { url = "https://files.pythonhosted.org/packages/72/63/64e9156c9e38c18720d0cc41378168635241de44013ffe3dd5b099447eb0/time_machine-2.16.0-cp313-cp313-win32.whl", hash = "sha256:32d445ce20d25c60ab92153c073942b0bac9815bfbfd152ce3dcc225d15ce988", size = 19108 }, - { url = "https://files.pythonhosted.org/packages/3d/40/27f5738fbd50b78dcc0682c14417eac5a49ccf430525dd0c5a058be125a2/time_machine-2.16.0-cp313-cp313-win_amd64.whl", hash = "sha256:f6927dda86425f97ffda36131f297b1a601c64a6ee6838bfa0e6d3149c2f0d9f", size = 19935 }, - { url = "https://files.pythonhosted.org/packages/35/75/c4d8b2f0fe7dac22854d88a9c509d428e78ac4bf284bc54cfe83f75cc13b/time_machine-2.16.0-cp313-cp313-win_arm64.whl", hash = "sha256:4d3843143c46dddca6491a954bbd0abfd435681512ac343169560e9bab504129", size = 18047 }, -] - -[[package]] -name = "tomli" -version = "2.2.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/18/87/302344fed471e44a87289cf4967697d07e532f2421fdaf868a303cbae4ff/tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff", size = 17175 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/43/ca/75707e6efa2b37c77dadb324ae7d9571cb424e61ea73fad7c56c2d14527f/tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249", size = 131077 }, - { url = "https://files.pythonhosted.org/packages/c7/16/51ae563a8615d472fdbffc43a3f3d46588c264ac4f024f63f01283becfbb/tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6", size = 123429 }, - { url = "https://files.pythonhosted.org/packages/f1/dd/4f6cd1e7b160041db83c694abc78e100473c15d54620083dbd5aae7b990e/tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a", size = 226067 }, - { url = "https://files.pythonhosted.org/packages/a9/6b/c54ede5dc70d648cc6361eaf429304b02f2871a345bbdd51e993d6cdf550/tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee", size = 236030 }, - { url = "https://files.pythonhosted.org/packages/1f/47/999514fa49cfaf7a92c805a86c3c43f4215621855d151b61c602abb38091/tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e", size = 240898 }, - { url = "https://files.pythonhosted.org/packages/73/41/0a01279a7ae09ee1573b423318e7934674ce06eb33f50936655071d81a24/tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4", size = 229894 }, - { url = "https://files.pythonhosted.org/packages/55/18/5d8bc5b0a0362311ce4d18830a5d28943667599a60d20118074ea1b01bb7/tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106", size = 245319 }, - { url = "https://files.pythonhosted.org/packages/92/a3/7ade0576d17f3cdf5ff44d61390d4b3febb8a9fc2b480c75c47ea048c646/tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8", size = 238273 }, - { url = "https://files.pythonhosted.org/packages/72/6f/fa64ef058ac1446a1e51110c375339b3ec6be245af9d14c87c4a6412dd32/tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff", size = 98310 }, - { url = "https://files.pythonhosted.org/packages/6a/1c/4a2dcde4a51b81be3530565e92eda625d94dafb46dbeb15069df4caffc34/tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b", size = 108309 }, - { url = "https://files.pythonhosted.org/packages/52/e1/f8af4c2fcde17500422858155aeb0d7e93477a0d59a98e56cbfe75070fd0/tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea", size = 132762 }, - { url = "https://files.pythonhosted.org/packages/03/b8/152c68bb84fc00396b83e7bbddd5ec0bd3dd409db4195e2a9b3e398ad2e3/tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8", size = 123453 }, - { url = "https://files.pythonhosted.org/packages/c8/d6/fc9267af9166f79ac528ff7e8c55c8181ded34eb4b0e93daa767b8841573/tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192", size = 233486 }, - { url = "https://files.pythonhosted.org/packages/5c/51/51c3f2884d7bab89af25f678447ea7d297b53b5a3b5730a7cb2ef6069f07/tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222", size = 242349 }, - { url = "https://files.pythonhosted.org/packages/ab/df/bfa89627d13a5cc22402e441e8a931ef2108403db390ff3345c05253935e/tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77", size = 252159 }, - { url = "https://files.pythonhosted.org/packages/9e/6e/fa2b916dced65763a5168c6ccb91066f7639bdc88b48adda990db10c8c0b/tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6", size = 237243 }, - { url = "https://files.pythonhosted.org/packages/b4/04/885d3b1f650e1153cbb93a6a9782c58a972b94ea4483ae4ac5cedd5e4a09/tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd", size = 259645 }, - { url = "https://files.pythonhosted.org/packages/9c/de/6b432d66e986e501586da298e28ebeefd3edc2c780f3ad73d22566034239/tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e", size = 244584 }, - { url = "https://files.pythonhosted.org/packages/1c/9a/47c0449b98e6e7d1be6cbac02f93dd79003234ddc4aaab6ba07a9a7482e2/tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98", size = 98875 }, - { url = "https://files.pythonhosted.org/packages/ef/60/9b9638f081c6f1261e2688bd487625cd1e660d0a85bd469e91d8db969734/tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4", size = 109418 }, - { url = "https://files.pythonhosted.org/packages/04/90/2ee5f2e0362cb8a0b6499dc44f4d7d48f8fff06d28ba46e6f1eaa61a1388/tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7", size = 132708 }, - { url = "https://files.pythonhosted.org/packages/c0/ec/46b4108816de6b385141f082ba99e315501ccd0a2ea23db4a100dd3990ea/tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c", size = 123582 }, - { url = "https://files.pythonhosted.org/packages/a0/bd/b470466d0137b37b68d24556c38a0cc819e8febe392d5b199dcd7f578365/tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13", size = 232543 }, - { url = "https://files.pythonhosted.org/packages/d9/e5/82e80ff3b751373f7cead2815bcbe2d51c895b3c990686741a8e56ec42ab/tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281", size = 241691 }, - { url = "https://files.pythonhosted.org/packages/05/7e/2a110bc2713557d6a1bfb06af23dd01e7dde52b6ee7dadc589868f9abfac/tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272", size = 251170 }, - { url = "https://files.pythonhosted.org/packages/64/7b/22d713946efe00e0adbcdfd6d1aa119ae03fd0b60ebed51ebb3fa9f5a2e5/tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140", size = 236530 }, - { url = "https://files.pythonhosted.org/packages/38/31/3a76f67da4b0cf37b742ca76beaf819dca0ebef26d78fc794a576e08accf/tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2", size = 258666 }, - { url = "https://files.pythonhosted.org/packages/07/10/5af1293da642aded87e8a988753945d0cf7e00a9452d3911dd3bb354c9e2/tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744", size = 243954 }, - { url = "https://files.pythonhosted.org/packages/5b/b9/1ed31d167be802da0fc95020d04cd27b7d7065cc6fbefdd2f9186f60d7bd/tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec", size = 98724 }, - { url = "https://files.pythonhosted.org/packages/c7/32/b0963458706accd9afcfeb867c0f9175a741bf7b19cd424230714d722198/tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69", size = 109383 }, - { url = "https://files.pythonhosted.org/packages/6e/c2/61d3e0f47e2b74ef40a68b9e6ad5984f6241a942f7cd3bbfbdbd03861ea9/tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc", size = 14257 }, -] - -[[package]] -name = "typer" -version = "0.15.2" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "click" }, - { name = "rich" }, - { name = "shellingham" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/8b/6f/3991f0f1c7fcb2df31aef28e0594d8d54b05393a0e4e34c65e475c2a5d41/typer-0.15.2.tar.gz", hash = "sha256:ab2fab47533a813c49fe1f16b1a370fd5819099c00b119e0633df65f22144ba5", size = 100711 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/7f/fc/5b29fea8cee020515ca82cc68e3b8e1e34bb19a3535ad854cac9257b414c/typer-0.15.2-py3-none-any.whl", hash = "sha256:46a499c6107d645a9c13f7ee46c5d5096cae6f5fc57dd11eccbbb9ae3e44ddfc", size = 45061 }, -] - -[[package]] -name = "types-passlib" -version = "1.7.7.20250408" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/4a/f4/69f74230e5b5201e970ffa77a45237605063924b13e311ebf721291c3554/types_passlib-1.7.7.20250408.tar.gz", hash = "sha256:7db7cb394658b194b0b252f87bcedf57fdc2b494c203c8a8d80e81d3b26516ae", size = 25160 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a2/a2/3cbb10d8583656f84d45b39e3be3c5e50b8b416137e5cc70caaa73932da4/types_passlib-1.7.7.20250408-py3-none-any.whl", hash = "sha256:04cec96e438e1cf5d0440b1e31123abab1844f5293f8350c8d6d787bd00c46e6", size = 40311 }, -] - -[[package]] -name = "typing-extensions" -version = "4.13.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/76/ad/cd3e3465232ec2416ae9b983f27b9e94dc8171d56ac99b345319a9475967/typing_extensions-4.13.1.tar.gz", hash = "sha256:98795af00fb9640edec5b8e31fc647597b4691f099ad75f469a2616be1a76dff", size = 106633 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/df/c5/e7a0b0f5ed69f94c8ab7379c599e6036886bffcde609969a5325f47f1332/typing_extensions-4.13.1-py3-none-any.whl", hash = "sha256:4b6cf02909eb5495cfbc3f6e8fd49217e6cc7944e145cdda8caa3734777f9e69", size = 45739 }, -] - -[[package]] -name = "typing-inspection" -version = "0.4.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/82/5c/e6082df02e215b846b4b8c0b887a64d7d08ffaba30605502639d44c06b82/typing_inspection-0.4.0.tar.gz", hash = "sha256:9765c87de36671694a67904bf2c96e395be9c6439bb6c87b5142569dcdd65122", size = 76222 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/31/08/aa4fdfb71f7de5176385bd9e90852eaf6b5d622735020ad600f2bab54385/typing_inspection-0.4.0-py3-none-any.whl", hash = "sha256:50e72559fcd2a6367a19f7a7e610e6afcb9fac940c650290eed893d61386832f", size = 14125 }, -] - -[[package]] -name = "tzdata" -version = "2025.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/95/32/1a225d6164441be760d75c2c42e2780dc0873fe382da3e98a2e1e48361e5/tzdata-2025.2.tar.gz", hash = "sha256:b60a638fcc0daffadf82fe0f57e53d06bdec2f36c4df66280ae79bce6bd6f2b9", size = 196380 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/5c/23/c7abc0ca0a1526a0774eca151daeb8de62ec457e77262b66b359c3c7679e/tzdata-2025.2-py2.py3-none-any.whl", hash = "sha256:1a403fada01ff9221ca8044d701868fa132215d84beb92242d9acd2147f667a8", size = 347839 }, -] - -[[package]] -name = "uvicorn" -version = "0.34.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "click" }, - { name = "h11" }, - { name = "typing-extensions", marker = "python_full_version < '3.11'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/4b/4d/938bd85e5bf2edeec766267a5015ad969730bb91e31b44021dfe8b22df6c/uvicorn-0.34.0.tar.gz", hash = "sha256:404051050cd7e905de2c9a7e61790943440b3416f49cb409f965d9dcd0fa73e9", size = 76568 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/61/14/33a3a1352cfa71812a3a21e8c9bfb83f60b0011f5e36f2b1399d51928209/uvicorn-0.34.0-py3-none-any.whl", hash = "sha256:023dc038422502fa28a09c7a30bf2b6991512da7dcdb8fd35fe57cfc154126f4", size = 62315 }, -] - -[package.optional-dependencies] -standard = [ - { name = "colorama", marker = "sys_platform == 'win32'" }, - { name = "httptools" }, - { name = "python-dotenv" }, - { name = "pyyaml" }, - { name = "uvloop", marker = "platform_python_implementation != 'PyPy' and sys_platform != 'cygwin' and sys_platform != 'win32'" }, - { name = "watchfiles" }, - { name = "websockets" }, -] - -[[package]] -name = "uvloop" -version = "0.21.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/af/c0/854216d09d33c543f12a44b393c402e89a920b1a0a7dc634c42de91b9cf6/uvloop-0.21.0.tar.gz", hash = "sha256:3bf12b0fda68447806a7ad847bfa591613177275d35b6724b1ee573faa3704e3", size = 2492741 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/3d/76/44a55515e8c9505aa1420aebacf4dd82552e5e15691654894e90d0bd051a/uvloop-0.21.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ec7e6b09a6fdded42403182ab6b832b71f4edaf7f37a9a0e371a01db5f0cb45f", size = 1442019 }, - { url = "https://files.pythonhosted.org/packages/35/5a/62d5800358a78cc25c8a6c72ef8b10851bdb8cca22e14d9c74167b7f86da/uvloop-0.21.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:196274f2adb9689a289ad7d65700d37df0c0930fd8e4e743fa4834e850d7719d", size = 801898 }, - { url = "https://files.pythonhosted.org/packages/f3/96/63695e0ebd7da6c741ccd4489b5947394435e198a1382349c17b1146bb97/uvloop-0.21.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f38b2e090258d051d68a5b14d1da7203a3c3677321cf32a95a6f4db4dd8b6f26", size = 3827735 }, - { url = "https://files.pythonhosted.org/packages/61/e0/f0f8ec84979068ffae132c58c79af1de9cceeb664076beea86d941af1a30/uvloop-0.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87c43e0f13022b998eb9b973b5e97200c8b90823454d4bc06ab33829e09fb9bb", size = 3825126 }, - { url = "https://files.pythonhosted.org/packages/bf/fe/5e94a977d058a54a19df95f12f7161ab6e323ad49f4dabc28822eb2df7ea/uvloop-0.21.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:10d66943def5fcb6e7b37310eb6b5639fd2ccbc38df1177262b0640c3ca68c1f", size = 3705789 }, - { url = "https://files.pythonhosted.org/packages/26/dd/c7179618e46092a77e036650c1f056041a028a35c4d76945089fcfc38af8/uvloop-0.21.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:67dd654b8ca23aed0a8e99010b4c34aca62f4b7fce88f39d452ed7622c94845c", size = 3800523 }, - { url = "https://files.pythonhosted.org/packages/57/a7/4cf0334105c1160dd6819f3297f8700fda7fc30ab4f61fbf3e725acbc7cc/uvloop-0.21.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:c0f3fa6200b3108919f8bdabb9a7f87f20e7097ea3c543754cabc7d717d95cf8", size = 1447410 }, - { url = "https://files.pythonhosted.org/packages/8c/7c/1517b0bbc2dbe784b563d6ab54f2ef88c890fdad77232c98ed490aa07132/uvloop-0.21.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0878c2640cf341b269b7e128b1a5fed890adc4455513ca710d77d5e93aa6d6a0", size = 805476 }, - { url = "https://files.pythonhosted.org/packages/ee/ea/0bfae1aceb82a503f358d8d2fa126ca9dbdb2ba9c7866974faec1cb5875c/uvloop-0.21.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b9fb766bb57b7388745d8bcc53a359b116b8a04c83a2288069809d2b3466c37e", size = 3960855 }, - { url = "https://files.pythonhosted.org/packages/8a/ca/0864176a649838b838f36d44bf31c451597ab363b60dc9e09c9630619d41/uvloop-0.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8a375441696e2eda1c43c44ccb66e04d61ceeffcd76e4929e527b7fa401b90fb", size = 3973185 }, - { url = "https://files.pythonhosted.org/packages/30/bf/08ad29979a936d63787ba47a540de2132169f140d54aa25bc8c3df3e67f4/uvloop-0.21.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:baa0e6291d91649c6ba4ed4b2f982f9fa165b5bbd50a9e203c416a2797bab3c6", size = 3820256 }, - { url = "https://files.pythonhosted.org/packages/da/e2/5cf6ef37e3daf2f06e651aae5ea108ad30df3cb269102678b61ebf1fdf42/uvloop-0.21.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:4509360fcc4c3bd2c70d87573ad472de40c13387f5fda8cb58350a1d7475e58d", size = 3937323 }, - { url = "https://files.pythonhosted.org/packages/8c/4c/03f93178830dc7ce8b4cdee1d36770d2f5ebb6f3d37d354e061eefc73545/uvloop-0.21.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:359ec2c888397b9e592a889c4d72ba3d6befba8b2bb01743f72fffbde663b59c", size = 1471284 }, - { url = "https://files.pythonhosted.org/packages/43/3e/92c03f4d05e50f09251bd8b2b2b584a2a7f8fe600008bcc4523337abe676/uvloop-0.21.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f7089d2dc73179ce5ac255bdf37c236a9f914b264825fdaacaded6990a7fb4c2", size = 821349 }, - { url = "https://files.pythonhosted.org/packages/a6/ef/a02ec5da49909dbbfb1fd205a9a1ac4e88ea92dcae885e7c961847cd51e2/uvloop-0.21.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:baa4dcdbd9ae0a372f2167a207cd98c9f9a1ea1188a8a526431eef2f8116cc8d", size = 4580089 }, - { url = "https://files.pythonhosted.org/packages/06/a7/b4e6a19925c900be9f98bec0a75e6e8f79bb53bdeb891916609ab3958967/uvloop-0.21.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:86975dca1c773a2c9864f4c52c5a55631038e387b47eaf56210f873887b6c8dc", size = 4693770 }, - { url = "https://files.pythonhosted.org/packages/ce/0c/f07435a18a4b94ce6bd0677d8319cd3de61f3a9eeb1e5f8ab4e8b5edfcb3/uvloop-0.21.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:461d9ae6660fbbafedd07559c6a2e57cd553b34b0065b6550685f6653a98c1cb", size = 4451321 }, - { url = "https://files.pythonhosted.org/packages/8f/eb/f7032be105877bcf924709c97b1bf3b90255b4ec251f9340cef912559f28/uvloop-0.21.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:183aef7c8730e54c9a3ee3227464daed66e37ba13040bb3f350bc2ddc040f22f", size = 4659022 }, - { url = "https://files.pythonhosted.org/packages/3f/8d/2cbef610ca21539f0f36e2b34da49302029e7c9f09acef0b1c3b5839412b/uvloop-0.21.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:bfd55dfcc2a512316e65f16e503e9e450cab148ef11df4e4e679b5e8253a5281", size = 1468123 }, - { url = "https://files.pythonhosted.org/packages/93/0d/b0038d5a469f94ed8f2b2fce2434a18396d8fbfb5da85a0a9781ebbdec14/uvloop-0.21.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:787ae31ad8a2856fc4e7c095341cccc7209bd657d0e71ad0dc2ea83c4a6fa8af", size = 819325 }, - { url = "https://files.pythonhosted.org/packages/50/94/0a687f39e78c4c1e02e3272c6b2ccdb4e0085fda3b8352fecd0410ccf915/uvloop-0.21.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5ee4d4ef48036ff6e5cfffb09dd192c7a5027153948d85b8da7ff705065bacc6", size = 4582806 }, - { url = "https://files.pythonhosted.org/packages/d2/19/f5b78616566ea68edd42aacaf645adbf71fbd83fc52281fba555dc27e3f1/uvloop-0.21.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f3df876acd7ec037a3d005b3ab85a7e4110422e4d9c1571d4fc89b0fc41b6816", size = 4701068 }, - { url = "https://files.pythonhosted.org/packages/47/57/66f061ee118f413cd22a656de622925097170b9380b30091b78ea0c6ea75/uvloop-0.21.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:bd53ecc9a0f3d87ab847503c2e1552b690362e005ab54e8a48ba97da3924c0dc", size = 4454428 }, - { url = "https://files.pythonhosted.org/packages/63/9a/0962b05b308494e3202d3f794a6e85abe471fe3cafdbcf95c2e8c713aabd/uvloop-0.21.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a5c39f217ab3c663dc699c04cbd50c13813e31d917642d459fdcec07555cc553", size = 4660018 }, -] - -[[package]] -name = "virtualenv" -version = "20.30.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "distlib" }, - { name = "filelock" }, - { name = "platformdirs" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/38/e0/633e369b91bbc664df47dcb5454b6c7cf441e8f5b9d0c250ce9f0546401e/virtualenv-20.30.0.tar.gz", hash = "sha256:800863162bcaa5450a6e4d721049730e7f2dae07720e0902b0e4040bd6f9ada8", size = 4346945 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/4c/ed/3cfeb48175f0671ec430ede81f628f9fb2b1084c9064ca67ebe8c0ed6a05/virtualenv-20.30.0-py3-none-any.whl", hash = "sha256:e34302959180fca3af42d1800df014b35019490b119eba981af27f2fa486e5d6", size = 4329461 }, -] - -[[package]] -name = "watchfiles" -version = "1.0.5" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "anyio" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/03/e2/8ed598c42057de7aa5d97c472254af4906ff0a59a66699d426fc9ef795d7/watchfiles-1.0.5.tar.gz", hash = "sha256:b7529b5dcc114679d43827d8c35a07c493ad6f083633d573d81c660abc5979e9", size = 94537 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/af/4d/d02e6ea147bb7fff5fd109c694a95109612f419abed46548a930e7f7afa3/watchfiles-1.0.5-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:5c40fe7dd9e5f81e0847b1ea64e1f5dd79dd61afbedb57759df06767ac719b40", size = 405632 }, - { url = "https://files.pythonhosted.org/packages/60/31/9ee50e29129d53a9a92ccf1d3992751dc56fc3c8f6ee721be1c7b9c81763/watchfiles-1.0.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8c0db396e6003d99bb2d7232c957b5f0b5634bbd1b24e381a5afcc880f7373fb", size = 395734 }, - { url = "https://files.pythonhosted.org/packages/ad/8c/759176c97195306f028024f878e7f1c776bda66ccc5c68fa51e699cf8f1d/watchfiles-1.0.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b551d4fb482fc57d852b4541f911ba28957d051c8776e79c3b4a51eb5e2a1b11", size = 455008 }, - { url = "https://files.pythonhosted.org/packages/55/1a/5e977250c795ee79a0229e3b7f5e3a1b664e4e450756a22da84d2f4979fe/watchfiles-1.0.5-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:830aa432ba5c491d52a15b51526c29e4a4b92bf4f92253787f9726fe01519487", size = 459029 }, - { url = "https://files.pythonhosted.org/packages/e6/17/884cf039333605c1d6e296cf5be35fad0836953c3dfd2adb71b72f9dbcd0/watchfiles-1.0.5-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a16512051a822a416b0d477d5f8c0e67b67c1a20d9acecb0aafa3aa4d6e7d256", size = 488916 }, - { url = "https://files.pythonhosted.org/packages/ef/e0/bcb6e64b45837056c0a40f3a2db3ef51c2ced19fda38484fa7508e00632c/watchfiles-1.0.5-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:bfe0cbc787770e52a96c6fda6726ace75be7f840cb327e1b08d7d54eadc3bc85", size = 523763 }, - { url = "https://files.pythonhosted.org/packages/24/e9/f67e9199f3bb35c1837447ecf07e9830ec00ff5d35a61e08c2cd67217949/watchfiles-1.0.5-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d363152c5e16b29d66cbde8fa614f9e313e6f94a8204eaab268db52231fe5358", size = 502891 }, - { url = "https://files.pythonhosted.org/packages/23/ed/a6cf815f215632f5c8065e9c41fe872025ffea35aa1f80499f86eae922db/watchfiles-1.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7ee32c9a9bee4d0b7bd7cbeb53cb185cf0b622ac761efaa2eba84006c3b3a614", size = 454921 }, - { url = "https://files.pythonhosted.org/packages/92/4c/e14978599b80cde8486ab5a77a821e8a982ae8e2fcb22af7b0886a033ec8/watchfiles-1.0.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:29c7fd632ccaf5517c16a5188e36f6612d6472ccf55382db6c7fe3fcccb7f59f", size = 631422 }, - { url = "https://files.pythonhosted.org/packages/b2/1a/9263e34c3458f7614b657f974f4ee61fd72f58adce8b436e16450e054efd/watchfiles-1.0.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8e637810586e6fe380c8bc1b3910accd7f1d3a9a7262c8a78d4c8fb3ba6a2b3d", size = 625675 }, - { url = "https://files.pythonhosted.org/packages/96/1f/1803a18bd6ab04a0766386a19bcfe64641381a04939efdaa95f0e3b0eb58/watchfiles-1.0.5-cp310-cp310-win32.whl", hash = "sha256:cd47d063fbeabd4c6cae1d4bcaa38f0902f8dc5ed168072874ea11d0c7afc1ff", size = 277921 }, - { url = "https://files.pythonhosted.org/packages/c2/3b/29a89de074a7d6e8b4dc67c26e03d73313e4ecf0d6e97e942a65fa7c195e/watchfiles-1.0.5-cp310-cp310-win_amd64.whl", hash = "sha256:86c0df05b47a79d80351cd179893f2f9c1b1cae49d96e8b3290c7f4bd0ca0a92", size = 291526 }, - { url = "https://files.pythonhosted.org/packages/39/f4/41b591f59021786ef517e1cdc3b510383551846703e03f204827854a96f8/watchfiles-1.0.5-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:237f9be419e977a0f8f6b2e7b0475ababe78ff1ab06822df95d914a945eac827", size = 405336 }, - { url = "https://files.pythonhosted.org/packages/ae/06/93789c135be4d6d0e4f63e96eea56dc54050b243eacc28439a26482b5235/watchfiles-1.0.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e0da39ff917af8b27a4bdc5a97ac577552a38aac0d260a859c1517ea3dc1a7c4", size = 395977 }, - { url = "https://files.pythonhosted.org/packages/d2/db/1cd89bd83728ca37054512d4d35ab69b5f12b8aa2ac9be3b0276b3bf06cc/watchfiles-1.0.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2cfcb3952350e95603f232a7a15f6c5f86c5375e46f0bd4ae70d43e3e063c13d", size = 455232 }, - { url = "https://files.pythonhosted.org/packages/40/90/d8a4d44ffe960517e487c9c04f77b06b8abf05eb680bed71c82b5f2cad62/watchfiles-1.0.5-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:68b2dddba7a4e6151384e252a5632efcaa9bc5d1c4b567f3cb621306b2ca9f63", size = 459151 }, - { url = "https://files.pythonhosted.org/packages/6c/da/267a1546f26465dead1719caaba3ce660657f83c9d9c052ba98fb8856e13/watchfiles-1.0.5-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:95cf944fcfc394c5f9de794ce581914900f82ff1f855326f25ebcf24d5397418", size = 489054 }, - { url = "https://files.pythonhosted.org/packages/b1/31/33850dfd5c6efb6f27d2465cc4c6b27c5a6f5ed53c6fa63b7263cf5f60f6/watchfiles-1.0.5-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ecf6cd9f83d7c023b1aba15d13f705ca7b7d38675c121f3cc4a6e25bd0857ee9", size = 523955 }, - { url = "https://files.pythonhosted.org/packages/09/84/b7d7b67856efb183a421f1416b44ca975cb2ea6c4544827955dfb01f7dc2/watchfiles-1.0.5-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:852de68acd6212cd6d33edf21e6f9e56e5d98c6add46f48244bd479d97c967c6", size = 502234 }, - { url = "https://files.pythonhosted.org/packages/71/87/6dc5ec6882a2254cfdd8b0718b684504e737273903b65d7338efaba08b52/watchfiles-1.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d5730f3aa35e646103b53389d5bc77edfbf578ab6dab2e005142b5b80a35ef25", size = 454750 }, - { url = "https://files.pythonhosted.org/packages/3d/6c/3786c50213451a0ad15170d091570d4a6554976cf0df19878002fc96075a/watchfiles-1.0.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:18b3bd29954bc4abeeb4e9d9cf0b30227f0f206c86657674f544cb032296acd5", size = 631591 }, - { url = "https://files.pythonhosted.org/packages/1b/b3/1427425ade4e359a0deacce01a47a26024b2ccdb53098f9d64d497f6684c/watchfiles-1.0.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:ba5552a1b07c8edbf197055bc9d518b8f0d98a1c6a73a293bc0726dce068ed01", size = 625370 }, - { url = "https://files.pythonhosted.org/packages/15/ba/f60e053b0b5b8145d682672024aa91370a29c5c921a88977eb565de34086/watchfiles-1.0.5-cp311-cp311-win32.whl", hash = "sha256:2f1fefb2e90e89959447bc0420fddd1e76f625784340d64a2f7d5983ef9ad246", size = 277791 }, - { url = "https://files.pythonhosted.org/packages/50/ed/7603c4e164225c12c0d4e8700b64bb00e01a6c4eeea372292a3856be33a4/watchfiles-1.0.5-cp311-cp311-win_amd64.whl", hash = "sha256:b6e76ceb1dd18c8e29c73f47d41866972e891fc4cc7ba014f487def72c1cf096", size = 291622 }, - { url = "https://files.pythonhosted.org/packages/a2/c2/99bb7c96b4450e36877fde33690ded286ff555b5a5c1d925855d556968a1/watchfiles-1.0.5-cp311-cp311-win_arm64.whl", hash = "sha256:266710eb6fddc1f5e51843c70e3bebfb0f5e77cf4f27129278c70554104d19ed", size = 283699 }, - { url = "https://files.pythonhosted.org/packages/2a/8c/4f0b9bdb75a1bfbd9c78fad7d8854369283f74fe7cf03eb16be77054536d/watchfiles-1.0.5-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:b5eb568c2aa6018e26da9e6c86f3ec3fd958cee7f0311b35c2630fa4217d17f2", size = 401511 }, - { url = "https://files.pythonhosted.org/packages/dc/4e/7e15825def77f8bd359b6d3f379f0c9dac4eb09dd4ddd58fd7d14127179c/watchfiles-1.0.5-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0a04059f4923ce4e856b4b4e5e783a70f49d9663d22a4c3b3298165996d1377f", size = 392715 }, - { url = "https://files.pythonhosted.org/packages/58/65/b72fb817518728e08de5840d5d38571466c1b4a3f724d190cec909ee6f3f/watchfiles-1.0.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e380c89983ce6e6fe2dd1e1921b9952fb4e6da882931abd1824c092ed495dec", size = 454138 }, - { url = "https://files.pythonhosted.org/packages/3e/a4/86833fd2ea2e50ae28989f5950b5c3f91022d67092bfec08f8300d8b347b/watchfiles-1.0.5-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fe43139b2c0fdc4a14d4f8d5b5d967f7a2777fd3d38ecf5b1ec669b0d7e43c21", size = 458592 }, - { url = "https://files.pythonhosted.org/packages/38/7e/42cb8df8be9a37e50dd3a818816501cf7a20d635d76d6bd65aae3dbbff68/watchfiles-1.0.5-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ee0822ce1b8a14fe5a066f93edd20aada932acfe348bede8aa2149f1a4489512", size = 487532 }, - { url = "https://files.pythonhosted.org/packages/fc/fd/13d26721c85d7f3df6169d8b495fcac8ab0dc8f0945ebea8845de4681dab/watchfiles-1.0.5-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a0dbcb1c2d8f2ab6e0a81c6699b236932bd264d4cef1ac475858d16c403de74d", size = 522865 }, - { url = "https://files.pythonhosted.org/packages/a1/0d/7f9ae243c04e96c5455d111e21b09087d0eeaf9a1369e13a01c7d3d82478/watchfiles-1.0.5-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a2014a2b18ad3ca53b1f6c23f8cd94a18ce930c1837bd891262c182640eb40a6", size = 499887 }, - { url = "https://files.pythonhosted.org/packages/8e/0f/a257766998e26aca4b3acf2ae97dff04b57071e991a510857d3799247c67/watchfiles-1.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10f6ae86d5cb647bf58f9f655fcf577f713915a5d69057a0371bc257e2553234", size = 454498 }, - { url = "https://files.pythonhosted.org/packages/81/79/8bf142575a03e0af9c3d5f8bcae911ee6683ae93a625d349d4ecf4c8f7df/watchfiles-1.0.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:1a7bac2bde1d661fb31f4d4e8e539e178774b76db3c2c17c4bb3e960a5de07a2", size = 630663 }, - { url = "https://files.pythonhosted.org/packages/f1/80/abe2e79f610e45c63a70d271caea90c49bbf93eb00fa947fa9b803a1d51f/watchfiles-1.0.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:4ab626da2fc1ac277bbf752446470b367f84b50295264d2d313e28dc4405d663", size = 625410 }, - { url = "https://files.pythonhosted.org/packages/91/6f/bc7fbecb84a41a9069c2c6eb6319f7f7df113adf113e358c57fc1aff7ff5/watchfiles-1.0.5-cp312-cp312-win32.whl", hash = "sha256:9f4571a783914feda92018ef3901dab8caf5b029325b5fe4558c074582815249", size = 277965 }, - { url = "https://files.pythonhosted.org/packages/99/a5/bf1c297ea6649ec59e935ab311f63d8af5faa8f0b86993e3282b984263e3/watchfiles-1.0.5-cp312-cp312-win_amd64.whl", hash = "sha256:360a398c3a19672cf93527f7e8d8b60d8275119c5d900f2e184d32483117a705", size = 291693 }, - { url = "https://files.pythonhosted.org/packages/7f/7b/fd01087cc21db5c47e5beae507b87965db341cce8a86f9eb12bf5219d4e0/watchfiles-1.0.5-cp312-cp312-win_arm64.whl", hash = "sha256:1a2902ede862969077b97523987c38db28abbe09fb19866e711485d9fbf0d417", size = 283287 }, - { url = "https://files.pythonhosted.org/packages/c7/62/435766874b704f39b2fecd8395a29042db2b5ec4005bd34523415e9bd2e0/watchfiles-1.0.5-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:0b289572c33a0deae62daa57e44a25b99b783e5f7aed81b314232b3d3c81a11d", size = 401531 }, - { url = "https://files.pythonhosted.org/packages/6e/a6/e52a02c05411b9cb02823e6797ef9bbba0bfaf1bb627da1634d44d8af833/watchfiles-1.0.5-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a056c2f692d65bf1e99c41045e3bdcaea3cb9e6b5a53dcaf60a5f3bd95fc9763", size = 392417 }, - { url = "https://files.pythonhosted.org/packages/3f/53/c4af6819770455932144e0109d4854437769672d7ad897e76e8e1673435d/watchfiles-1.0.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b9dca99744991fc9850d18015c4f0438865414e50069670f5f7eee08340d8b40", size = 453423 }, - { url = "https://files.pythonhosted.org/packages/cb/d1/8e88df58bbbf819b8bc5cfbacd3c79e01b40261cad0fc84d1e1ebd778a07/watchfiles-1.0.5-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:894342d61d355446d02cd3988a7326af344143eb33a2fd5d38482a92072d9563", size = 458185 }, - { url = "https://files.pythonhosted.org/packages/ff/70/fffaa11962dd5429e47e478a18736d4e42bec42404f5ee3b92ef1b87ad60/watchfiles-1.0.5-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ab44e1580924d1ffd7b3938e02716d5ad190441965138b4aa1d1f31ea0877f04", size = 486696 }, - { url = "https://files.pythonhosted.org/packages/39/db/723c0328e8b3692d53eb273797d9a08be6ffb1d16f1c0ba2bdbdc2a3852c/watchfiles-1.0.5-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d6f9367b132078b2ceb8d066ff6c93a970a18c3029cea37bfd7b2d3dd2e5db8f", size = 522327 }, - { url = "https://files.pythonhosted.org/packages/cd/05/9fccc43c50c39a76b68343484b9da7b12d42d0859c37c61aec018c967a32/watchfiles-1.0.5-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f2e55a9b162e06e3f862fb61e399fe9f05d908d019d87bf5b496a04ef18a970a", size = 499741 }, - { url = "https://files.pythonhosted.org/packages/23/14/499e90c37fa518976782b10a18b18db9f55ea73ca14641615056f8194bb3/watchfiles-1.0.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0125f91f70e0732a9f8ee01e49515c35d38ba48db507a50c5bdcad9503af5827", size = 453995 }, - { url = "https://files.pythonhosted.org/packages/61/d9/f75d6840059320df5adecd2c687fbc18960a7f97b55c300d20f207d48aef/watchfiles-1.0.5-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:13bb21f8ba3248386337c9fa51c528868e6c34a707f729ab041c846d52a0c69a", size = 629693 }, - { url = "https://files.pythonhosted.org/packages/fc/17/180ca383f5061b61406477218c55d66ec118e6c0c51f02d8142895fcf0a9/watchfiles-1.0.5-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:839ebd0df4a18c5b3c1b890145b5a3f5f64063c2a0d02b13c76d78fe5de34936", size = 624677 }, - { url = "https://files.pythonhosted.org/packages/bf/15/714d6ef307f803f236d69ee9d421763707899d6298d9f3183e55e366d9af/watchfiles-1.0.5-cp313-cp313-win32.whl", hash = "sha256:4a8ec1e4e16e2d5bafc9ba82f7aaecfeec990ca7cd27e84fb6f191804ed2fcfc", size = 277804 }, - { url = "https://files.pythonhosted.org/packages/a8/b4/c57b99518fadf431f3ef47a610839e46e5f8abf9814f969859d1c65c02c7/watchfiles-1.0.5-cp313-cp313-win_amd64.whl", hash = "sha256:f436601594f15bf406518af922a89dcaab416568edb6f65c4e5bbbad1ea45c11", size = 291087 }, - { url = "https://files.pythonhosted.org/packages/1a/03/81f9fcc3963b3fc415cd4b0b2b39ee8cc136c42fb10a36acf38745e9d283/watchfiles-1.0.5-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:f59b870db1f1ae5a9ac28245707d955c8721dd6565e7f411024fa374b5362d1d", size = 405947 }, - { url = "https://files.pythonhosted.org/packages/54/97/8c4213a852feb64807ec1d380f42d4fc8bfaef896bdbd94318f8fd7f3e4e/watchfiles-1.0.5-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:9475b0093767e1475095f2aeb1d219fb9664081d403d1dff81342df8cd707034", size = 397276 }, - { url = "https://files.pythonhosted.org/packages/78/12/d4464d19860cb9672efa45eec1b08f8472c478ed67dcd30647c51ada7aef/watchfiles-1.0.5-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fc533aa50664ebd6c628b2f30591956519462f5d27f951ed03d6c82b2dfd9965", size = 455550 }, - { url = "https://files.pythonhosted.org/packages/90/fb/b07bcdf1034d8edeaef4c22f3e9e3157d37c5071b5f9492ffdfa4ad4bed7/watchfiles-1.0.5-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fed1cd825158dcaae36acce7b2db33dcbfd12b30c34317a88b8ed80f0541cc57", size = 455542 }, -] - -[[package]] -name = "websockets" -version = "15.0.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/21/e6/26d09fab466b7ca9c7737474c52be4f76a40301b08362eb2dbc19dcc16c1/websockets-15.0.1.tar.gz", hash = "sha256:82544de02076bafba038ce055ee6412d68da13ab47f0c60cab827346de828dee", size = 177016 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/1e/da/6462a9f510c0c49837bbc9345aca92d767a56c1fb2939e1579df1e1cdcf7/websockets-15.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d63efaa0cd96cf0c5fe4d581521d9fa87744540d4bc999ae6e08595a1014b45b", size = 175423 }, - { url = "https://files.pythonhosted.org/packages/1c/9f/9d11c1a4eb046a9e106483b9ff69bce7ac880443f00e5ce64261b47b07e7/websockets-15.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ac60e3b188ec7574cb761b08d50fcedf9d77f1530352db4eef1707fe9dee7205", size = 173080 }, - { url = "https://files.pythonhosted.org/packages/d5/4f/b462242432d93ea45f297b6179c7333dd0402b855a912a04e7fc61c0d71f/websockets-15.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5756779642579d902eed757b21b0164cd6fe338506a8083eb58af5c372e39d9a", size = 173329 }, - { url = "https://files.pythonhosted.org/packages/6e/0c/6afa1f4644d7ed50284ac59cc70ef8abd44ccf7d45850d989ea7310538d0/websockets-15.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fdfe3e2a29e4db3659dbd5bbf04560cea53dd9610273917799f1cde46aa725e", size = 182312 }, - { url = "https://files.pythonhosted.org/packages/dd/d4/ffc8bd1350b229ca7a4db2a3e1c482cf87cea1baccd0ef3e72bc720caeec/websockets-15.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c2529b320eb9e35af0fa3016c187dffb84a3ecc572bcee7c3ce302bfeba52bf", size = 181319 }, - { url = "https://files.pythonhosted.org/packages/97/3a/5323a6bb94917af13bbb34009fac01e55c51dfde354f63692bf2533ffbc2/websockets-15.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac1e5c9054fe23226fb11e05a6e630837f074174c4c2f0fe442996112a6de4fb", size = 181631 }, - { url = "https://files.pythonhosted.org/packages/a6/cc/1aeb0f7cee59ef065724041bb7ed667b6ab1eeffe5141696cccec2687b66/websockets-15.0.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5df592cd503496351d6dc14f7cdad49f268d8e618f80dce0cd5a36b93c3fc08d", size = 182016 }, - { url = "https://files.pythonhosted.org/packages/79/f9/c86f8f7af208e4161a7f7e02774e9d0a81c632ae76db2ff22549e1718a51/websockets-15.0.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:0a34631031a8f05657e8e90903e656959234f3a04552259458aac0b0f9ae6fd9", size = 181426 }, - { url = "https://files.pythonhosted.org/packages/c7/b9/828b0bc6753db905b91df6ae477c0b14a141090df64fb17f8a9d7e3516cf/websockets-15.0.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3d00075aa65772e7ce9e990cab3ff1de702aa09be3940d1dc88d5abf1ab8a09c", size = 181360 }, - { url = "https://files.pythonhosted.org/packages/89/fb/250f5533ec468ba6327055b7d98b9df056fb1ce623b8b6aaafb30b55d02e/websockets-15.0.1-cp310-cp310-win32.whl", hash = "sha256:1234d4ef35db82f5446dca8e35a7da7964d02c127b095e172e54397fb6a6c256", size = 176388 }, - { url = "https://files.pythonhosted.org/packages/1c/46/aca7082012768bb98e5608f01658ff3ac8437e563eca41cf068bd5849a5e/websockets-15.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:39c1fec2c11dc8d89bba6b2bf1556af381611a173ac2b511cf7231622058af41", size = 176830 }, - { url = "https://files.pythonhosted.org/packages/9f/32/18fcd5919c293a398db67443acd33fde142f283853076049824fc58e6f75/websockets-15.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:823c248b690b2fd9303ba00c4f66cd5e2d8c3ba4aa968b2779be9532a4dad431", size = 175423 }, - { url = "https://files.pythonhosted.org/packages/76/70/ba1ad96b07869275ef42e2ce21f07a5b0148936688c2baf7e4a1f60d5058/websockets-15.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678999709e68425ae2593acf2e3ebcbcf2e69885a5ee78f9eb80e6e371f1bf57", size = 173082 }, - { url = "https://files.pythonhosted.org/packages/86/f2/10b55821dd40eb696ce4704a87d57774696f9451108cff0d2824c97e0f97/websockets-15.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d50fd1ee42388dcfb2b3676132c78116490976f1300da28eb629272d5d93e905", size = 173330 }, - { url = "https://files.pythonhosted.org/packages/a5/90/1c37ae8b8a113d3daf1065222b6af61cc44102da95388ac0018fcb7d93d9/websockets-15.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d99e5546bf73dbad5bf3547174cd6cb8ba7273062a23808ffea025ecb1cf8562", size = 182878 }, - { url = "https://files.pythonhosted.org/packages/8e/8d/96e8e288b2a41dffafb78e8904ea7367ee4f891dafc2ab8d87e2124cb3d3/websockets-15.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:66dd88c918e3287efc22409d426c8f729688d89a0c587c88971a0faa2c2f3792", size = 181883 }, - { url = "https://files.pythonhosted.org/packages/93/1f/5d6dbf551766308f6f50f8baf8e9860be6182911e8106da7a7f73785f4c4/websockets-15.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8dd8327c795b3e3f219760fa603dcae1dcc148172290a8ab15158cf85a953413", size = 182252 }, - { url = "https://files.pythonhosted.org/packages/d4/78/2d4fed9123e6620cbf1706c0de8a1632e1a28e7774d94346d7de1bba2ca3/websockets-15.0.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8fdc51055e6ff4adeb88d58a11042ec9a5eae317a0a53d12c062c8a8865909e8", size = 182521 }, - { url = "https://files.pythonhosted.org/packages/e7/3b/66d4c1b444dd1a9823c4a81f50231b921bab54eee2f69e70319b4e21f1ca/websockets-15.0.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:693f0192126df6c2327cce3baa7c06f2a117575e32ab2308f7f8216c29d9e2e3", size = 181958 }, - { url = "https://files.pythonhosted.org/packages/08/ff/e9eed2ee5fed6f76fdd6032ca5cd38c57ca9661430bb3d5fb2872dc8703c/websockets-15.0.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:54479983bd5fb469c38f2f5c7e3a24f9a4e70594cd68cd1fa6b9340dadaff7cf", size = 181918 }, - { url = "https://files.pythonhosted.org/packages/d8/75/994634a49b7e12532be6a42103597b71098fd25900f7437d6055ed39930a/websockets-15.0.1-cp311-cp311-win32.whl", hash = "sha256:16b6c1b3e57799b9d38427dda63edcbe4926352c47cf88588c0be4ace18dac85", size = 176388 }, - { url = "https://files.pythonhosted.org/packages/98/93/e36c73f78400a65f5e236cd376713c34182e6663f6889cd45a4a04d8f203/websockets-15.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:27ccee0071a0e75d22cb35849b1db43f2ecd3e161041ac1ee9d2352ddf72f065", size = 176828 }, - { url = "https://files.pythonhosted.org/packages/51/6b/4545a0d843594f5d0771e86463606a3988b5a09ca5123136f8a76580dd63/websockets-15.0.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:3e90baa811a5d73f3ca0bcbf32064d663ed81318ab225ee4f427ad4e26e5aff3", size = 175437 }, - { url = "https://files.pythonhosted.org/packages/f4/71/809a0f5f6a06522af902e0f2ea2757f71ead94610010cf570ab5c98e99ed/websockets-15.0.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:592f1a9fe869c778694f0aa806ba0374e97648ab57936f092fd9d87f8bc03665", size = 173096 }, - { url = "https://files.pythonhosted.org/packages/3d/69/1a681dd6f02180916f116894181eab8b2e25b31e484c5d0eae637ec01f7c/websockets-15.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0701bc3cfcb9164d04a14b149fd74be7347a530ad3bbf15ab2c678a2cd3dd9a2", size = 173332 }, - { url = "https://files.pythonhosted.org/packages/a6/02/0073b3952f5bce97eafbb35757f8d0d54812b6174ed8dd952aa08429bcc3/websockets-15.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8b56bdcdb4505c8078cb6c7157d9811a85790f2f2b3632c7d1462ab5783d215", size = 183152 }, - { url = "https://files.pythonhosted.org/packages/74/45/c205c8480eafd114b428284840da0b1be9ffd0e4f87338dc95dc6ff961a1/websockets-15.0.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0af68c55afbd5f07986df82831c7bff04846928ea8d1fd7f30052638788bc9b5", size = 182096 }, - { url = "https://files.pythonhosted.org/packages/14/8f/aa61f528fba38578ec553c145857a181384c72b98156f858ca5c8e82d9d3/websockets-15.0.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64dee438fed052b52e4f98f76c5790513235efaa1ef7f3f2192c392cd7c91b65", size = 182523 }, - { url = "https://files.pythonhosted.org/packages/ec/6d/0267396610add5bc0d0d3e77f546d4cd287200804fe02323797de77dbce9/websockets-15.0.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d5f6b181bb38171a8ad1d6aa58a67a6aa9d4b38d0f8c5f496b9e42561dfc62fe", size = 182790 }, - { url = "https://files.pythonhosted.org/packages/02/05/c68c5adbf679cf610ae2f74a9b871ae84564462955d991178f95a1ddb7dd/websockets-15.0.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:5d54b09eba2bada6011aea5375542a157637b91029687eb4fdb2dab11059c1b4", size = 182165 }, - { url = "https://files.pythonhosted.org/packages/29/93/bb672df7b2f5faac89761cb5fa34f5cec45a4026c383a4b5761c6cea5c16/websockets-15.0.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3be571a8b5afed347da347bfcf27ba12b069d9d7f42cb8c7028b5e98bbb12597", size = 182160 }, - { url = "https://files.pythonhosted.org/packages/ff/83/de1f7709376dc3ca9b7eeb4b9a07b4526b14876b6d372a4dc62312bebee0/websockets-15.0.1-cp312-cp312-win32.whl", hash = "sha256:c338ffa0520bdb12fbc527265235639fb76e7bc7faafbb93f6ba80d9c06578a9", size = 176395 }, - { url = "https://files.pythonhosted.org/packages/7d/71/abf2ebc3bbfa40f391ce1428c7168fb20582d0ff57019b69ea20fa698043/websockets-15.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:fcd5cf9e305d7b8338754470cf69cf81f420459dbae8a3b40cee57417f4614a7", size = 176841 }, - { url = "https://files.pythonhosted.org/packages/cb/9f/51f0cf64471a9d2b4d0fc6c534f323b664e7095640c34562f5182e5a7195/websockets-15.0.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ee443ef070bb3b6ed74514f5efaa37a252af57c90eb33b956d35c8e9c10a1931", size = 175440 }, - { url = "https://files.pythonhosted.org/packages/8a/05/aa116ec9943c718905997412c5989f7ed671bc0188ee2ba89520e8765d7b/websockets-15.0.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5a939de6b7b4e18ca683218320fc67ea886038265fd1ed30173f5ce3f8e85675", size = 173098 }, - { url = "https://files.pythonhosted.org/packages/ff/0b/33cef55ff24f2d92924923c99926dcce78e7bd922d649467f0eda8368923/websockets-15.0.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:746ee8dba912cd6fc889a8147168991d50ed70447bf18bcda7039f7d2e3d9151", size = 173329 }, - { url = "https://files.pythonhosted.org/packages/31/1d/063b25dcc01faa8fada1469bdf769de3768b7044eac9d41f734fd7b6ad6d/websockets-15.0.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:595b6c3969023ecf9041b2936ac3827e4623bfa3ccf007575f04c5a6aa318c22", size = 183111 }, - { url = "https://files.pythonhosted.org/packages/93/53/9a87ee494a51bf63e4ec9241c1ccc4f7c2f45fff85d5bde2ff74fcb68b9e/websockets-15.0.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3c714d2fc58b5ca3e285461a4cc0c9a66bd0e24c5da9911e30158286c9b5be7f", size = 182054 }, - { url = "https://files.pythonhosted.org/packages/ff/b2/83a6ddf56cdcbad4e3d841fcc55d6ba7d19aeb89c50f24dd7e859ec0805f/websockets-15.0.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f3c1e2ab208db911594ae5b4f79addeb3501604a165019dd221c0bdcabe4db8", size = 182496 }, - { url = "https://files.pythonhosted.org/packages/98/41/e7038944ed0abf34c45aa4635ba28136f06052e08fc2168520bb8b25149f/websockets-15.0.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:229cf1d3ca6c1804400b0a9790dc66528e08a6a1feec0d5040e8b9eb14422375", size = 182829 }, - { url = "https://files.pythonhosted.org/packages/e0/17/de15b6158680c7623c6ef0db361da965ab25d813ae54fcfeae2e5b9ef910/websockets-15.0.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:756c56e867a90fb00177d530dca4b097dd753cde348448a1012ed6c5131f8b7d", size = 182217 }, - { url = "https://files.pythonhosted.org/packages/33/2b/1f168cb6041853eef0362fb9554c3824367c5560cbdaad89ac40f8c2edfc/websockets-15.0.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:558d023b3df0bffe50a04e710bc87742de35060580a293c2a984299ed83bc4e4", size = 182195 }, - { url = "https://files.pythonhosted.org/packages/86/eb/20b6cdf273913d0ad05a6a14aed4b9a85591c18a987a3d47f20fa13dcc47/websockets-15.0.1-cp313-cp313-win32.whl", hash = "sha256:ba9e56e8ceeeedb2e080147ba85ffcd5cd0711b89576b83784d8605a7df455fa", size = 176393 }, - { url = "https://files.pythonhosted.org/packages/1b/6c/c65773d6cab416a64d191d6ee8a8b1c68a09970ea6909d16965d26bfed1e/websockets-15.0.1-cp313-cp313-win_amd64.whl", hash = "sha256:e09473f095a819042ecb2ab9465aee615bd9c2028e4ef7d933600a8401c79561", size = 176837 }, - { url = "https://files.pythonhosted.org/packages/02/9e/d40f779fa16f74d3468357197af8d6ad07e7c5a27ea1ca74ceb38986f77a/websockets-15.0.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:0c9e74d766f2818bb95f84c25be4dea09841ac0f734d1966f415e4edfc4ef1c3", size = 173109 }, - { url = "https://files.pythonhosted.org/packages/bc/cd/5b887b8585a593073fd92f7c23ecd3985cd2c3175025a91b0d69b0551372/websockets-15.0.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1009ee0c7739c08a0cd59de430d6de452a55e42d6b522de7aa15e6f67db0b8e1", size = 173343 }, - { url = "https://files.pythonhosted.org/packages/fe/ae/d34f7556890341e900a95acf4886833646306269f899d58ad62f588bf410/websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:76d1f20b1c7a2fa82367e04982e708723ba0e7b8d43aa643d3dcd404d74f1475", size = 174599 }, - { url = "https://files.pythonhosted.org/packages/71/e6/5fd43993a87db364ec60fc1d608273a1a465c0caba69176dd160e197ce42/websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f29d80eb9a9263b8d109135351caf568cc3f80b9928bccde535c235de55c22d9", size = 174207 }, - { url = "https://files.pythonhosted.org/packages/2b/fb/c492d6daa5ec067c2988ac80c61359ace5c4c674c532985ac5a123436cec/websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b359ed09954d7c18bbc1680f380c7301f92c60bf924171629c5db97febb12f04", size = 174155 }, - { url = "https://files.pythonhosted.org/packages/68/a1/dcb68430b1d00b698ae7a7e0194433bce4f07ded185f0ee5fb21e2a2e91e/websockets-15.0.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:cad21560da69f4ce7658ca2cb83138fb4cf695a2ba3e475e0559e05991aa8122", size = 176884 }, - { url = "https://files.pythonhosted.org/packages/fa/a8/5b41e0da817d64113292ab1f8247140aac61cbf6cfd085d6a0fa77f4984f/websockets-15.0.1-py3-none-any.whl", hash = "sha256:f7a866fbc1e97b5c617ee4116daaa09b722101d4a3c170c787450ba409f9736f", size = 169743 }, -] diff --git a/packages/postman_collection/.gitignore b/packages/postman_collection/.gitignore deleted file mode 100644 index 58c3fec6..00000000 --- a/packages/postman_collection/.gitignore +++ /dev/null @@ -1,52 +0,0 @@ -# Avoid committing pubspec.lock for library packages; see -# https://dart.dev/guides/libraries/private-files#pubspeclock. -pubspec.lock - -# FVM Version Cache -.fvm/ - -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.build/ -.buildlog/ -.history -.svn/ -.swiftpm/ -migrate_working_dir/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.pub-cache/ -.pub/ -/build/ - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Android Studio will place build artifacts here -/android/app/debug -/android/app/profile -/android/app/release diff --git a/packages/postman_collection/CHANGELOG.md b/packages/postman_collection/CHANGELOG.md deleted file mode 100644 index d8a99062..00000000 --- a/packages/postman_collection/CHANGELOG.md +++ /dev/null @@ -1,38 +0,0 @@ -## 0.0.9 - -- fix multipart formdata issue - -## 0.0.8 - -- Add support for multipart formdata - -## 0.0.7 - -- Read version from string for example 1.0.0 -- Read version from pubspec.yaml - -## 0.0.6 - -- Fix request body type - -## 0.0.5 - -- Fix query data type - -## 0.0.4 - -- Add request mode - -## 0.0.3 - -- Fix url in collection - -## 0.0.2 - -- Added new feature. -- Fixed bug. -- Add more documentation. - -## 0.0.1 - -- Initial version. diff --git a/packages/postman_collection/LICENSE b/packages/postman_collection/LICENSE deleted file mode 100644 index a63edd9d..00000000 --- a/packages/postman_collection/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) [2024] [masreplay] - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/packages/postman_collection/README.md b/packages/postman_collection/README.md deleted file mode 100644 index 08d8125d..00000000 --- a/packages/postman_collection/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Postman Collection Schema Generator - -This package is a Postman collection schema generator that allows you to easily generate the schema for your Dio and http client. - -## Installation - -To install the package, simply run the following command: - -```bash -dart pub add postman_collection -``` - -## Usage - -To use the package, you can import it into your project and call the `generateSchema` function. Here's an example: - -```dart -import 'package:postman_collection/postman_collection.dart'; - -PostmanCollection.fromJson(...); -``` - -## Contributing - -Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the [GitHub repository](https://github.com/masreplay/postman_collection). - -## License - -This package is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more information. diff --git a/packages/postman_collection/analysis_options.yaml b/packages/postman_collection/analysis_options.yaml deleted file mode 100644 index 59219f3a..00000000 --- a/packages/postman_collection/analysis_options.yaml +++ /dev/null @@ -1,15 +0,0 @@ -include: package:lints/recommended.yaml - -linter: - rules: - require_trailing_commas: true - prefer_single_quotes: true - -analyzer: - exclude: - - "**/*.g.dart" - - "**/*.freezed.dart" - - "**/*.gen.dart" - - errors: - invalid_annotation_target: ignore \ No newline at end of file diff --git a/packages/postman_collection/build.yaml b/packages/postman_collection/build.yaml deleted file mode 100644 index 32da2ff0..00000000 --- a/packages/postman_collection/build.yaml +++ /dev/null @@ -1,19 +0,0 @@ -targets: - $default: - builders: - json_serializable: - options: - create_factory: true - create_to_json: true - explicit_to_json: true - include_if_null: false - freezed: - options: - union_key: type - format: true - copy_with: true - map: true - when: - when: true - maybe_when: true - when_or_null: true diff --git a/packages/postman_collection/example/.gitignore b/packages/postman_collection/example/.gitignore deleted file mode 100644 index 58c3fec6..00000000 --- a/packages/postman_collection/example/.gitignore +++ /dev/null @@ -1,52 +0,0 @@ -# Avoid committing pubspec.lock for library packages; see -# https://dart.dev/guides/libraries/private-files#pubspeclock. -pubspec.lock - -# FVM Version Cache -.fvm/ - -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.build/ -.buildlog/ -.history -.svn/ -.swiftpm/ -migrate_working_dir/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.pub-cache/ -.pub/ -/build/ - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Android Studio will place build artifacts here -/android/app/debug -/android/app/profile -/android/app/release diff --git a/packages/postman_collection/example/README.md b/packages/postman_collection/example/README.md deleted file mode 100644 index 9c7ecbdc..00000000 --- a/packages/postman_collection/example/README.md +++ /dev/null @@ -1,5 +0,0 @@ -### Postman collection example - -read more [postman_collection](../README.md) - -[https://pub.dev/packages/postman_collection](https://pub.dev/packages/postman_collection) \ No newline at end of file diff --git a/packages/postman_collection/example/analysis_options.yaml b/packages/postman_collection/example/analysis_options.yaml deleted file mode 100644 index ad67ec01..00000000 --- a/packages/postman_collection/example/analysis_options.yaml +++ /dev/null @@ -1,12 +0,0 @@ -include: package:lints/recommended.yaml - -analyzer: - exclude: - - "**/*.g.dart" - - "**/*.freezed.dart" - - errors: - invalid_annotation_target: ignore - - plugins: - - custom_lint diff --git a/packages/postman_collection/example/lib/main.dart b/packages/postman_collection/example/lib/main.dart deleted file mode 100644 index 3696cc19..00000000 --- a/packages/postman_collection/example/lib/main.dart +++ /dev/null @@ -1,341 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:dio/dio.dart'; -import 'package:yaml/yaml.dart'; -import 'package:example/src/dio.dart'; -import 'package:example/src/models.dart'; -import 'package:postman_collection/postman_collection.dart'; -import 'package:retrofit/retrofit.dart'; - -part 'main.g.dart'; - -class UploadFileResponse { - final String url; - - UploadFileResponse({required this.url}); - - factory UploadFileResponse.fromJson(Map json) { - return UploadFileResponse( - url: json['url'], - ); - } - - Map toJson() { - return { - 'url': url, - }; - } -} - -@RestApi() -abstract class AppClient { - factory AppClient(Dio dio, {String baseUrl}) = _AppClient; - - @POST('/upload') - @MultiPart() - Future> uploadFile( - @Part() File file, - ); - - @GET('/app/{platform}') - Future> getAppData({ - @Path() required String platform, - @Header('Accept-Language') required String language, - @Query('version') required String version, - @Body() required AppDataRequestBody body, - }); -} - -class AppClientDoc with PostmanCollectionDocumentationMixin { - AppClientDoc(this._client); - - final AppClient _client; - - @override - Future doc() async { - return PostmanCollectionItem( - name: PostmanCollectionItem.getNameFromClass(runtimeType), - item: await Future.wait([ - getAppDataDoc(), - getUploadFileDoc(), - ]), - ); - } - - Future getAppDataDoc() async { - final function = _client.getAppData; - - return PostmanCollectionItem( - name: PostmanCollectionItem.getNameFromFunction(function), - request: PostmanCollectionRequest.fromRequestOptions( - await getRequestOptionsFromRetrofit( - () => function( - platform: 'android', - version: '1.0.1', - language: 'en', - body: AppDataRequestBody( - date: DateTime.now(), - ), - ), - ), - ), - response: [ - PostmanCollectionResponse( - name: 'Default', - status: '200', - postmanPreviewLanguage: 'json', - body: jsonEncode( - AppResponse( - name: 'Postman', - version: '1.0.0', - ).toJson(), - ), - ), - PostmanCollectionResponse( - name: 'Error', - status: '400', - postmanPreviewLanguage: 'json', - body: jsonEncode(MessageResponse().toJson()), - ), - ], - ); - } - - Future getUploadFileDoc() async { - final function = _client.uploadFile; - - return PostmanCollectionItem( - name: PostmanCollectionItem.getNameFromFunction(function), - request: PostmanCollectionRequest.fromRequestOptions( - await getRequestOptionsFromRetrofit( - () => function(File('pubspec.yaml')), - ), - ), - response: [ - PostmanCollectionResponse( - name: 'Default', - status: '200', - postmanPreviewLanguage: 'json', - body: jsonEncode({ - 'url': 'https://example.com/test.txt', - }), - ), - PostmanCollectionResponse( - name: 'Error', - status: '400', - postmanPreviewLanguage: 'json', - body: jsonEncode(MessageResponse().toJson()), - ), - ], - ); - } -} - -@RestApi() -abstract class UserClient { - factory UserClient(Dio dio, {String baseUrl}) = _UserClient; - - @GET('/users/') - Future>> get(); - - @GET('/users/{id}') - Future> getDetail(@Path() String id); - - @POST('/users/') - @MultiPart() // Add this annotation to mark it as form-data - Future> create(@Body() CreateUserRequestBody body); - - @PUT('/users/{id}') - Future> update( - @Path() String id, - @Body() UpdateUserRequestBody body, - ); - - @DELETE('/users/{id}') - Future> delete(@Path() String id); -} - -class UserClientDoc with PostmanCollectionDocumentationMixin { - UserClientDoc(this._client); - - final UserClient _client; - - Future getDoc() async { - final function = _client.get; - - return PostmanCollectionItem( - name: PostmanCollectionItem.getNameFromFunction(function), - request: PostmanCollectionRequest.fromRequestOptions( - await getRequestOptionsFromRetrofit(function), - ), - response: [ - PostmanCollectionResponse( - name: 'Default', - status: '200', - postmanPreviewLanguage: 'json', - body: jsonEncode([ - UserResponse(name: 'John Doe', email: 'johndoe@email.com'), - ].map((e) => e.toJson()).toList()), - ) - ], - ); - } - - Future getDetailDoc() async { - final function = _client.getDetail; - - return PostmanCollectionItem( - name: PostmanCollectionItem.getNameFromFunction(function), - request: PostmanCollectionRequest.fromRequestOptions( - await getRequestOptionsFromRetrofit(() => function('1')), - ), - response: [ - PostmanCollectionResponse( - name: 'Default', - status: '200', - postmanPreviewLanguage: 'json', - body: jsonEncode( - UserResponse( - name: 'John Doe', - email: 'johndoe@email.com', - ).toJson(), - ), - ) - ], - ); - } - - Future createDoc() async { - final function = _client.create; - - return PostmanCollectionItem( - name: PostmanCollectionItem.getNameFromFunction(function), - request: PostmanCollectionRequest.fromRequestOptions( - await getRequestOptionsFromRetrofit( - () => function( - CreateUserRequestBody( - name: 'John Doe', - email: 'asd', - image: File("${Directory.current.path}/lib/src/dio.dart"), - ), - ), - ), - ), - response: [ - PostmanCollectionResponse( - name: 'Default', - status: '200', - postmanPreviewLanguage: 'json', - body: jsonEncode( - UserResponse( - name: 'John Doe', - email: 'asd', - ).toJson(), - ), - ) - ], - ); - } - - Future updateDoc() async { - final function = _client.update; - - return PostmanCollectionItem( - name: PostmanCollectionItem.getNameFromFunction(function), - request: PostmanCollectionRequest.fromRequestOptions( - await getRequestOptionsFromRetrofit( - () => function( - '1', - UpdateUserRequestBody( - name: 'John Doe', - email: 'asd', - ), - ), - ), - ), - response: [ - PostmanCollectionResponse( - name: 'Default', - status: '200', - postmanPreviewLanguage: 'json', - body: jsonEncode( - UserResponse( - name: 'John Doe', - email: 'asd', - ).toJson(), - ), - ) - ], - ); - } - - Future deleteDoc() async { - final function = _client.delete; - - return PostmanCollectionItem( - name: PostmanCollectionItem.getNameFromFunction(function), - request: PostmanCollectionRequest.fromRequestOptions( - await getRequestOptionsFromRetrofit(() => function('1')), - ), - response: [ - PostmanCollectionResponse( - name: 'Default', - status: '200', - postmanPreviewLanguage: 'json', - body: jsonEncode( - UserResponse( - name: 'John Doe', - email: 'asd', - ).toJson(), - ), - ) - ], - ); - } - - @override - Future doc() async { - return PostmanCollectionItem( - name: PostmanCollectionItem.getNameFromClass(runtimeType), - item: await Future.wait([ - getDoc(), - getDetailDoc(), - createDoc(), - updateDoc(), - deleteDoc(), - ]), - ); - } -} - -Future main() async { - final dio = getDocumentationDio(); - - final pubspecYaml = loadYaml(File('pubspec.yaml').readAsStringSync()); - - final projectName = pubspecYaml['name']; - - print('Generating Postman Collection for $projectName'); - - final collection = PostmanCollection( - info: PostmanCollectionInfo( - name: projectName, - schema: PostmanCollectionInfo.schemaV210, - version: PostmanCollectionVersion.fromString('1.0.0'), - ), - item: await Future.wait([ - AppClientDoc(AppClient(dio)), - UserClientDoc(UserClient(dio)), - ].map((e) => e.doc()).toList()), - ); - - final file = File('versions/${PostmanCollection.filename(projectName)}'); - - await file.writeAsString(jsonEncode(collection.toJson())); - print('Postman Collection generated at ${file.path}'); -} - -String jsonEncode(Object? object) { - return JsonEncoder.withIndent(' ').convert(object); -} diff --git a/packages/postman_collection/example/lib/main.g.dart b/packages/postman_collection/example/lib/main.g.dart deleted file mode 100644 index 11eadb12..00000000 --- a/packages/postman_collection/example/lib/main.g.dart +++ /dev/null @@ -1,312 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'main.dart'; - -// ************************************************************************** -// RetrofitGenerator -// ************************************************************************** - -// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element - -class _AppClient implements AppClient { - _AppClient( - this._dio, { - this.baseUrl, - }); - - final Dio _dio; - - String? baseUrl; - - @override - Future> uploadFile(File file) async { - final _extra = {}; - final queryParameters = {}; - final _headers = {}; - final _data = FormData(); - _data.files.add(MapEntry( - 'file', - MultipartFile.fromFileSync( - file.path, - filename: file.path.split(Platform.pathSeparator).last, - ), - )); - final _result = await _dio.fetch>( - _setStreamType>(Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) - .compose( - _dio.options, - '/upload', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = UploadFileResponse.fromJson(_result.data!); - final httpResponse = HttpResponse(_value, _result); - return httpResponse; - } - - @override - Future> getAppData({ - required String platform, - required String language, - required String version, - required AppDataRequestBody body, - }) async { - final _extra = {}; - final queryParameters = {r'version': version}; - final _headers = {r'Accept-Language': language}; - _headers.removeWhere((k, v) => v == null); - final _data = {}; - _data.addAll(body.toJson()); - final _result = await _dio.fetch>( - _setStreamType>(Options( - method: 'GET', - headers: _headers, - extra: _extra, - ) - .compose( - _dio.options, - '/app/${platform}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = AppResponse.fromJson(_result.data!); - final httpResponse = HttpResponse(_value, _result); - return httpResponse; - } - - RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && - !(requestOptions.responseType == ResponseType.bytes || - requestOptions.responseType == ResponseType.stream)) { - if (T == String) { - requestOptions.responseType = ResponseType.plain; - } else { - requestOptions.responseType = ResponseType.json; - } - } - return requestOptions; - } - - String _combineBaseUrls( - String dioBaseUrl, - String? baseUrl, - ) { - if (baseUrl == null || baseUrl.trim().isEmpty) { - return dioBaseUrl; - } - - final url = Uri.parse(baseUrl); - - if (url.isAbsolute) { - return url.toString(); - } - - return Uri.parse(dioBaseUrl).resolveUri(url).toString(); - } -} - -// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element - -class _UserClient implements UserClient { - _UserClient( - this._dio, { - this.baseUrl, - }); - - final Dio _dio; - - String? baseUrl; - - @override - Future>> get() async { - final _extra = {}; - final queryParameters = {}; - final _headers = {}; - const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType>>(Options( - method: 'GET', - headers: _headers, - extra: _extra, - ) - .compose( - _dio.options, - '/users/', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - var _value = _result.data! - .map((dynamic i) => UserResponse.fromJson(i as Map)) - .toList(); - final httpResponse = HttpResponse(_value, _result); - return httpResponse; - } - - @override - Future> getDetail(String id) async { - final _extra = {}; - final queryParameters = {}; - final _headers = {}; - const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType>(Options( - method: 'GET', - headers: _headers, - extra: _extra, - ) - .compose( - _dio.options, - '/users/${id}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = UserResponse.fromJson(_result.data!); - final httpResponse = HttpResponse(_value, _result); - return httpResponse; - } - - @override - Future> create(CreateUserRequestBody body) async { - final _extra = {}; - final queryParameters = {}; - final _headers = {}; - final _data = {}; - _data.addAll(body.toJson()); - final _result = await _dio.fetch>( - _setStreamType>(Options( - method: 'POST', - headers: _headers, - extra: _extra, - contentType: 'multipart/form-data', - ) - .compose( - _dio.options, - '/users/', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = UserResponse.fromJson(_result.data!); - final httpResponse = HttpResponse(_value, _result); - return httpResponse; - } - - @override - Future> update( - String id, - UpdateUserRequestBody body, - ) async { - final _extra = {}; - final queryParameters = {}; - final _headers = {}; - final _data = {}; - _data.addAll(body.toJson()); - final _result = await _dio.fetch>( - _setStreamType>(Options( - method: 'PUT', - headers: _headers, - extra: _extra, - ) - .compose( - _dio.options, - '/users/${id}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = UserResponse.fromJson(_result.data!); - final httpResponse = HttpResponse(_value, _result); - return httpResponse; - } - - @override - Future> delete(String id) async { - final _extra = {}; - final queryParameters = {}; - final _headers = {}; - const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType>(Options( - method: 'DELETE', - headers: _headers, - extra: _extra, - ) - .compose( - _dio.options, - '/users/${id}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - final _value = UserResponse.fromJson(_result.data!); - final httpResponse = HttpResponse(_value, _result); - return httpResponse; - } - - RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && - !(requestOptions.responseType == ResponseType.bytes || - requestOptions.responseType == ResponseType.stream)) { - if (T == String) { - requestOptions.responseType = ResponseType.plain; - } else { - requestOptions.responseType = ResponseType.json; - } - } - return requestOptions; - } - - String _combineBaseUrls( - String dioBaseUrl, - String? baseUrl, - ) { - if (baseUrl == null || baseUrl.trim().isEmpty) { - return dioBaseUrl; - } - - final url = Uri.parse(baseUrl); - - if (url.isAbsolute) { - return url.toString(); - } - - return Uri.parse(dioBaseUrl).resolveUri(url).toString(); - } -} diff --git a/packages/postman_collection/example/lib/src/dio.dart b/packages/postman_collection/example/lib/src/dio.dart deleted file mode 100644 index 3d0bb2f6..00000000 --- a/packages/postman_collection/example/lib/src/dio.dart +++ /dev/null @@ -1,14 +0,0 @@ -import 'package:dio/dio.dart'; - -/// immediately invoked function expression -Dio getDocumentationDio() { - final dio = Dio(); - - dio.options - ..baseUrl = 'https://baseurl.com' - ..sendTimeout = Duration.zero - ..receiveTimeout = Duration.zero - ..connectTimeout = Duration.zero; - - return dio; -} diff --git a/packages/postman_collection/example/lib/src/models.dart b/packages/postman_collection/example/lib/src/models.dart deleted file mode 100644 index 646f16a1..00000000 --- a/packages/postman_collection/example/lib/src/models.dart +++ /dev/null @@ -1,123 +0,0 @@ -import 'dart:io'; - -import 'package:dio/dio.dart'; - -class AppResponse { - final String name; - final String version; - - const AppResponse({ - required this.name, - required this.version, - }); - - factory AppResponse.fromJson(Map map) { - return AppResponse( - name: map['name'] as String, - version: map['version'] as String, - ); - } - - Map toJson() { - return { - 'name': name, - 'version': version, - }; - } -} - -class AppDataRequestBody { - final DateTime date; - - AppDataRequestBody({required this.date}); - - Map toJson() { - return { - 'date': date.toIso8601String(), - }; - } -} - -class MessageResponse { - final String message; - - MessageResponse({ - this.message = 'Bad Request', - }); - - factory MessageResponse.fromJson(Map map) { - return MessageResponse( - message: map['message'] as String, - ); - } - - Map toJson() { - return { - 'message': message, - }; - } -} - -class UserResponse { - final String name; - final String email; - - const UserResponse({ - required this.name, - required this.email, - }); - - factory UserResponse.fromJson(Map map) { - return UserResponse( - name: map['name'] as String, - email: map['email'] as String, - ); - } - - Map toJson() { - return { - 'name': name, - 'email': email, - }; - } -} - -class CreateUserRequestBody { - final String name; - final String email; - final File image; - - CreateUserRequestBody({ - required this.name, - required this.email, - required this.image, - }); - - Map toJson() { - return { - 'name': name, - 'email': email, - "image": MultipartFile.fromFileSync( - image.path, - filename: image.path.split(Platform.pathSeparator).last, - ) - }; - } -} - -class UpdateUserRequestBody { - final String name; - final String email; - - UpdateUserRequestBody({ - required this.name, - required this.email, - }); - - Map toJson() { - return { - 'name': name, - 'email': email, - }; - } -} diff --git a/packages/postman_collection/example/pubspec.yaml b/packages/postman_collection/example/pubspec.yaml deleted file mode 100644 index 0c2ed6a0..00000000 --- a/packages/postman_collection/example/pubspec.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: example -description: A starting point for Dart libraries or applications. -version: 1.0.0 -publish_to: "none" - -environment: - sdk: ">=3.5.0 <4.0.0" - -dependencies: - dio: ^5.5.0+1 - retrofit: ^4.1.0 - - postman_collection: - path: ../ - yaml: ^3.1.2 - -dev_dependencies: - test: ^1.24.0 - lints: ^3.0.0 - - build_runner: ^2.4.11 - retrofit_generator: ^8.1.2 diff --git a/packages/postman_collection/example/versions/example.postman_collection.json b/packages/postman_collection/example/versions/example.postman_collection.json deleted file mode 100644 index ce8b375c..00000000 --- a/packages/postman_collection/example/versions/example.postman_collection.json +++ /dev/null @@ -1,306 +0,0 @@ -{ - "info": { - "name": "example", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "version": { - "major": 1, - "minor": 0, - "patch": 0 - } - }, - "item": [ - { - "name": "App Client Doc", - "item": [ - { - "name": "Get App Data", - "request": { - "method": "GET", - "header": [ - { - "key": "Accept-Language", - "value": "en" - }, - { - "key": "content-type", - "value": "application/json" - }, - { - "key": "content-length", - "value": "37" - } - ], - "body": { - "raw": "{\n \"date\": \"2024-07-18T15:05:23.632862\"\n}", - "options": { - "raw": { - "language": "json" - } - }, - "mode": "raw" - }, - "url": { - "raw": "https://baseurl.com/app/android?version=1.0.1", - "host": "https://baseurl.com", - "path": "/app/android", - "query": [ - { - "key": "version", - "value": "1.0.1" - } - ] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"Postman\",\n \"version\": \"1.0.0\"\n}", - "status": "200" - }, - { - "name": "Error", - "_postman_previewlanguage": "json", - "body": "{\n \"message\": \"Bad Request\"\n}", - "status": "400" - } - ] - }, - { - "name": "Upload File", - "request": { - "method": "POST", - "header": [ - { - "key": "content-type", - "value": "multipart/form-data; boundary=--dio-boundary-2932142354" - }, - { - "key": "content-length", - "value": "644" - } - ], - "body": { - "formdata": [ - { - "key": "file", - "src": "pubspec.yaml", - "type": "file" - } - ], - "mode": "formdata" - }, - "url": { - "raw": "https://baseurl.com/upload", - "host": "https://baseurl.com", - "path": "/upload", - "query": [] - }, - "description": "POST" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"url\": \"https://example.com/test.txt\"\n}", - "status": "200" - }, - { - "name": "Error", - "_postman_previewlanguage": "json", - "body": "{\n \"message\": \"Bad Request\"\n}", - "status": "400" - } - ] - } - ] - }, - { - "name": "User Client Doc", - "item": [ - { - "name": "Get", - "request": { - "method": "GET", - "header": [], - "body": { - "options": { - "raw": { - "language": "json" - } - }, - "mode": "raw" - }, - "url": { - "raw": "https://baseurl.com/users/", - "host": "https://baseurl.com", - "path": "/users/", - "query": [] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "[\n {\n \"name\": \"John Doe\",\n \"email\": \"johndoe@email.com\"\n }\n]", - "status": "200" - } - ] - }, - { - "name": "Get Detail", - "request": { - "method": "GET", - "header": [], - "body": { - "options": { - "raw": { - "language": "json" - } - }, - "mode": "raw" - }, - "url": { - "raw": "https://baseurl.com/users/1", - "host": "https://baseurl.com", - "path": "/users/1", - "query": [] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"johndoe@email.com\"\n}", - "status": "200" - } - ] - }, - { - "name": "Create", - "request": { - "method": "POST", - "header": [ - { - "key": "content-type", - "value": "multipart/form-data" - }, - { - "key": "content-length", - "value": "61" - } - ], - "body": { - "formdata": [ - { - "key": "name", - "value": "John Doe", - "type": "text" - }, - { - "key": "email", - "value": "asd", - "type": "text" - }, - { - "key": "image", - "src": "dio.dart", - "type": "file" - } - ], - "mode": "formdata" - }, - "url": { - "raw": "https://baseurl.com/users/", - "host": "https://baseurl.com", - "path": "/users/", - "query": [] - }, - "description": "POST" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "status": "200" - } - ] - }, - { - "name": "Update", - "request": { - "method": "PUT", - "header": [ - { - "key": "content-type", - "value": "application/json" - }, - { - "key": "content-length", - "value": "33" - } - ], - "body": { - "raw": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "options": { - "raw": { - "language": "json" - } - }, - "mode": "raw" - }, - "url": { - "raw": "https://baseurl.com/users/1", - "host": "https://baseurl.com", - "path": "/users/1", - "query": [] - }, - "description": "PUT" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "status": "200" - } - ] - }, - { - "name": "Delete", - "request": { - "method": "DELETE", - "header": [], - "body": { - "options": { - "raw": { - "language": "json" - } - }, - "mode": "raw" - }, - "url": { - "raw": "https://baseurl.com/users/1", - "host": "https://baseurl.com", - "path": "/users/1", - "query": [] - }, - "description": "DELETE" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "status": "200" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/packages/postman_collection/lib/flutter2024-07-17 21:08:19.849384.postman_collection.json b/packages/postman_collection/lib/flutter2024-07-17 21:08:19.849384.postman_collection.json deleted file mode 100644 index 2748e303..00000000 --- a/packages/postman_collection/lib/flutter2024-07-17 21:08:19.849384.postman_collection.json +++ /dev/null @@ -1,259 +0,0 @@ -{ - "info": { - "name": "flutter2024-07-17 21:08:19.849384", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "version": { - "major": 1, - "minor": 0, - "patch": 0 - } - }, - "item": [ - { - "name": "App Client Doc", - "item": [ - { - "name": "Get App Data", - "request": { - "method": "GET", - "header": [ - { - "key": "Accept-Language", - "value": "en" - }, - { - "key": "content-type", - "value": "application/json" - }, - { - "key": "content-length", - "value": "37" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"date\": \"2024-07-17T21:08:19.852633\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://baseurl.com/app/android?version=1.0.1", - "host": "https://baseurl.com", - "path": "/app/android", - "query": [ - { - "key": "version", - "value": "1.0.1" - } - ] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"Postman\",\n \"version\": \"1.0.0\"\n}", - "status": "200" - }, - { - "name": "Error", - "_postman_previewlanguage": "json", - "body": "{\n \"message\": \"Bad Request\"\n}", - "status": "400" - } - ] - } - ] - }, - { - "name": "User Client Doc", - "item": [ - { - "name": "Get", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://baseurl.com/users/", - "host": "https://baseurl.com", - "path": "/users/", - "query": [] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "[\n {\n \"name\": \"John Doe\",\n \"email\": \"johndoe@email.com\"\n }\n]", - "status": "200" - } - ] - }, - { - "name": "Get Detail", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://baseurl.com/users/1", - "host": "https://baseurl.com", - "path": "/users/1", - "query": [] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"johndoe@email.com\"\n}", - "status": "200" - } - ] - }, - { - "name": "Create", - "request": { - "method": "POST", - "header": [ - { - "key": "content-type", - "value": "multipart/form-data" - }, - { - "key": "content-length", - "value": "61" - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "name", - "src": "file.png", - "type": "text" - }, - { - "key": "email", - "src": "file.png", - "type": "text" - }, - { - "key": "image", - "src": "file.png", - "type": "file" - } - ] - }, - "url": { - "raw": "https://baseurl.com/users/", - "host": "https://baseurl.com", - "path": "/users/", - "query": [] - }, - "description": "POST" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "status": "200" - } - ] - }, - { - "name": "Update", - "request": { - "method": "PUT", - "header": [ - { - "key": "content-type", - "value": "application/json" - }, - { - "key": "content-length", - "value": "33" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://baseurl.com/users/1", - "host": "https://baseurl.com", - "path": "/users/1", - "query": [] - }, - "description": "PUT" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "status": "200" - } - ] - }, - { - "name": "Delete", - "request": { - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://baseurl.com/users/1", - "host": "https://baseurl.com", - "path": "/users/1", - "query": [] - }, - "description": "DELETE" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "status": "200" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/packages/postman_collection/lib/flutter2024-07-18 11:21:48.499112.postman_collection.json b/packages/postman_collection/lib/flutter2024-07-18 11:21:48.499112.postman_collection.json deleted file mode 100644 index f50b943d..00000000 --- a/packages/postman_collection/lib/flutter2024-07-18 11:21:48.499112.postman_collection.json +++ /dev/null @@ -1,259 +0,0 @@ -{ - "info": { - "name": "flutter2024-07-18 11:21:48.499112", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "version": { - "major": 1, - "minor": 0, - "patch": 0 - } - }, - "item": [ - { - "name": "App Client Doc", - "item": [ - { - "name": "Get App Data", - "request": { - "method": "GET", - "header": [ - { - "key": "Accept-Language", - "value": "en" - }, - { - "key": "content-type", - "value": "application/json" - }, - { - "key": "content-length", - "value": "37" - } - ], - "body": { - "raw": "{\n \"date\": \"2024-07-18T11:21:48.504596\"\n}", - "options": { - "raw": { - "language": "json" - } - }, - "mode": "raw" - }, - "url": { - "raw": "https://baseurl.com/app/android?version=1.0.1", - "host": "https://baseurl.com", - "path": "/app/android", - "query": [ - { - "key": "version", - "value": "1.0.1" - } - ] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"Postman\",\n \"version\": \"1.0.0\"\n}", - "status": "200" - }, - { - "name": "Error", - "_postman_previewlanguage": "json", - "body": "{\n \"message\": \"Bad Request\"\n}", - "status": "400" - } - ] - } - ] - }, - { - "name": "User Client Doc", - "item": [ - { - "name": "Get", - "request": { - "method": "GET", - "header": [], - "body": { - "options": { - "raw": { - "language": "json" - } - }, - "mode": "raw" - }, - "url": { - "raw": "https://baseurl.com/users/", - "host": "https://baseurl.com", - "path": "/users/", - "query": [] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "[\n {\n \"name\": \"John Doe\",\n \"email\": \"johndoe@email.com\"\n }\n]", - "status": "200" - } - ] - }, - { - "name": "Get Detail", - "request": { - "method": "GET", - "header": [], - "body": { - "options": { - "raw": { - "language": "json" - } - }, - "mode": "raw" - }, - "url": { - "raw": "https://baseurl.com/users/1", - "host": "https://baseurl.com", - "path": "/users/1", - "query": [] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"johndoe@email.com\"\n}", - "status": "200" - } - ] - }, - { - "name": "Create", - "request": { - "method": "POST", - "header": [ - { - "key": "content-type", - "value": "multipart/form-data" - }, - { - "key": "content-length", - "value": "61" - } - ], - "body": { - "formdata": [ - { - "key": "name", - "src": "John Doe", - "type": "text" - }, - { - "key": "email", - "src": "asd", - "type": "text" - }, - { - "key": "image", - "src": "dio.dart", - "type": "file" - } - ], - "mode": "formdata" - }, - "url": { - "raw": "https://baseurl.com/users/", - "host": "https://baseurl.com", - "path": "/users/", - "query": [] - }, - "description": "POST" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "status": "200" - } - ] - }, - { - "name": "Update", - "request": { - "method": "PUT", - "header": [ - { - "key": "content-type", - "value": "application/json" - }, - { - "key": "content-length", - "value": "33" - } - ], - "body": { - "raw": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "options": { - "raw": { - "language": "json" - } - }, - "mode": "raw" - }, - "url": { - "raw": "https://baseurl.com/users/1", - "host": "https://baseurl.com", - "path": "/users/1", - "query": [] - }, - "description": "PUT" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "status": "200" - } - ] - }, - { - "name": "Delete", - "request": { - "method": "DELETE", - "header": [], - "body": { - "options": { - "raw": { - "language": "json" - } - }, - "mode": "raw" - }, - "url": { - "raw": "https://baseurl.com/users/1", - "host": "https://baseurl.com", - "path": "/users/1", - "query": [] - }, - "description": "DELETE" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"asd\"\n}", - "status": "200" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/packages/postman_collection/lib/flutter2024-07-18 11:46:48.321102.postman_collection.json b/packages/postman_collection/lib/flutter2024-07-18 11:46:48.321102.postman_collection.json deleted file mode 100644 index 5130951c..00000000 --- a/packages/postman_collection/lib/flutter2024-07-18 11:46:48.321102.postman_collection.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "info": { - "name": "flutter2024-07-18 11:46:48.321102", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "version": { - "major": 1, - "minor": 0, - "patch": 0 - } - }, - "item": [ - { - "name": "App Client Doc", - "item": [ - { - "name": "Get App Data", - "request": { - "method": "GET", - "header": [ - { - "key": "Accept-Language", - "value": "en" - }, - { - "key": "content-type", - "value": "application/json" - }, - { - "key": "content-length", - "value": "37" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"date\": \"2024-07-18T11:46:48.326561\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://baseurl.com/app/android?version=1.0.1", - "host": "https://baseurl.com", - "path": "/app/android", - "query": [ - { - "key": "version", - "value": "1.0.1" - } - ] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"Postman\",\n \"version\": \"1.0.0\"\n}", - "status": "200" - }, - { - "name": "Error", - "_postman_previewlanguage": "json", - "body": "{\n \"message\": \"Bad Request\"\n}", - "status": "400" - } - ] - } - ] - }, - { - "name": "User Client Doc", - "item": [ - { - "name": "Get", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://baseurl.com/users/", - "host": "https://baseurl.com", - "path": "/users/", - "query": [] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "[\n {\n \"name\": \"John Doe\",\n \"email\": \"johndoe@email.com\"\n }\n]", - "status": "200" - } - ] - }, - { - "name": "Get Detail", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://baseurl.com/users/1", - "host": "https://baseurl.com", - "path": "/users/1", - "query": [] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"johndoe@email.com\"\n}", - "status": "200" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/packages/postman_collection/lib/flutter2024-07-18 11:47:42.983733.postman_collection.json b/packages/postman_collection/lib/flutter2024-07-18 11:47:42.983733.postman_collection.json deleted file mode 100644 index 6338b9f6..00000000 --- a/packages/postman_collection/lib/flutter2024-07-18 11:47:42.983733.postman_collection.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "info": { - "name": "flutter2024-07-18 11:47:42.983733", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "version": { - "major": 1, - "minor": 0, - "patch": 0 - } - }, - "item": [ - { - "name": "App Client Doc", - "item": [ - { - "name": "Get App Data", - "request": { - "method": "GET", - "header": [ - { - "key": "Accept-Language", - "value": "en" - }, - { - "key": "content-type", - "value": "application/json" - }, - { - "key": "content-length", - "value": "37" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"date\": \"2024-07-18T11:47:42.990018\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://baseurl.com/app/android?version=1.0.1", - "host": "https://baseurl.com", - "path": "/app/android", - "query": [ - { - "key": "version", - "value": "1.0.1" - } - ] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"Postman\",\n \"version\": \"1.0.0\"\n}", - "status": "200" - }, - { - "name": "Error", - "_postman_previewlanguage": "json", - "body": "{\n \"message\": \"Bad Request\"\n}", - "status": "400" - } - ] - } - ] - }, - { - "name": "User Client Doc", - "item": [ - { - "name": "Get", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://baseurl.com/users/", - "host": "https://baseurl.com", - "path": "/users/", - "query": [] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "[\n {\n \"name\": \"John Doe\",\n \"email\": \"johndoe@email.com\"\n }\n]", - "status": "200" - } - ] - }, - { - "name": "Get Detail", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://baseurl.com/users/1", - "host": "https://baseurl.com", - "path": "/users/1", - "query": [] - }, - "description": "GET" - }, - "response": [ - { - "name": "Default", - "_postman_previewlanguage": "json", - "body": "{\n \"name\": \"John Doe\",\n \"email\": \"johndoe@email.com\"\n}", - "status": "200" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/packages/postman_collection/lib/postman_collection.dart b/packages/postman_collection/lib/postman_collection.dart deleted file mode 100644 index aa5e38ca..00000000 --- a/packages/postman_collection/lib/postman_collection.dart +++ /dev/null @@ -1,6 +0,0 @@ -library; - -export 'src/client/client.dart'; -export 'src/doc/doc.dart'; -export 'src/format/format.dart'; -export 'src/postman_collection_base.dart'; diff --git a/packages/postman_collection/lib/src/client/client.dart b/packages/postman_collection/lib/src/client/client.dart deleted file mode 100644 index 6cb0c872..00000000 --- a/packages/postman_collection/lib/src/client/client.dart +++ /dev/null @@ -1 +0,0 @@ -export 'retrofit.dart'; diff --git a/packages/postman_collection/lib/src/client/retrofit.dart b/packages/postman_collection/lib/src/client/retrofit.dart deleted file mode 100644 index f5357429..00000000 --- a/packages/postman_collection/lib/src/client/retrofit.dart +++ /dev/null @@ -1,14 +0,0 @@ -import 'package:dio/dio.dart'; -import 'package:retrofit/dio.dart'; - -/// workaround to get RequestOptions from Retrofit -Future getRequestOptionsFromRetrofit( - Future> Function() request, -) async { - try { - final result = await request(); - return result.response.requestOptions; - } on DioException catch (e) { - return e.requestOptions; - } -} diff --git a/packages/postman_collection/lib/src/doc/doc.dart b/packages/postman_collection/lib/src/doc/doc.dart deleted file mode 100644 index 7a3eec8d..00000000 --- a/packages/postman_collection/lib/src/doc/doc.dart +++ /dev/null @@ -1 +0,0 @@ -export 'postman_collection_doc_mixin.dart'; diff --git a/packages/postman_collection/lib/src/doc/postman_collection_doc_mixin.dart b/packages/postman_collection/lib/src/doc/postman_collection_doc_mixin.dart deleted file mode 100644 index b0e0f233..00000000 --- a/packages/postman_collection/lib/src/doc/postman_collection_doc_mixin.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:postman_collection/postman_collection.dart'; - -mixin PostmanCollectionDocumentationMixin { - Future doc(); -} diff --git a/packages/postman_collection/lib/src/format/format.dart b/packages/postman_collection/lib/src/format/format.dart deleted file mode 100644 index 38f0732d..00000000 --- a/packages/postman_collection/lib/src/format/format.dart +++ /dev/null @@ -1 +0,0 @@ -export 'sentence_case.dart'; diff --git a/packages/postman_collection/lib/src/format/sentence_case.dart b/packages/postman_collection/lib/src/format/sentence_case.dart deleted file mode 100644 index ef198978..00000000 --- a/packages/postman_collection/lib/src/format/sentence_case.dart +++ /dev/null @@ -1,7 +0,0 @@ -String toSentenceCase(String text) { - final words = text.split(RegExp(r'(?=[A-Z])')); - final sentenceCase = words.map((word) { - return word[0].toUpperCase() + word.substring(1); - }).join(' '); - return sentenceCase; -} diff --git a/packages/postman_collection/lib/src/postman_collection_base.dart b/packages/postman_collection/lib/src/postman_collection_base.dart deleted file mode 100644 index c6f3f120..00000000 --- a/packages/postman_collection/lib/src/postman_collection_base.dart +++ /dev/null @@ -1,499 +0,0 @@ -import 'dart:convert'; - -import 'package:dio/dio.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; - -import 'format/format.dart'; - -part 'postman_collection_base.freezed.dart'; -part 'postman_collection_base.g.dart'; - -@freezed -class PostmanCollection with _$PostmanCollection { - const PostmanCollection._(); - - const factory PostmanCollection({ - required PostmanCollectionInfo info, - required List item, - PostmanCollectionAuth? auth, - List? event, - Map? protocolProfileBehavior, - List? variable, - }) = _PostmanCollection; - - static String filename(String filename) { - return '$filename.postman_collection.json'; - } - - factory PostmanCollection.fromJson(Map json) => - _$PostmanCollectionFromJson(json); -} - -@freezed -class PostmanCollectionInfo with _$PostmanCollectionInfo { - const PostmanCollectionInfo._(); - - const factory PostmanCollectionInfo({ - @JsonKey(name: '_postman_id') String? postmanId, - required String name, - required String schema, - String? description, - PostmanCollectionVersion? version, - @JsonKey(name: '_exporter_id') String? exporterId, - @JsonKey(name: '_collection_link') String? collectionLink, - }) = _PostmanCollectionInfo; - - static const String schemaV210 = - 'https://schema.getpostman.com/json/collection/v2.1.0/collection.json'; - - factory PostmanCollectionInfo.fromJson(Map json) => - _$PostmanCollectionInfoFromJson(json); -} - -@freezed -class PostmanCollectionVersion with _$PostmanCollectionVersion { - const PostmanCollectionVersion._(); - - const factory PostmanCollectionVersion({ - required int major, - required int minor, - required int patch, - String? identifier, - Object? meta, - }) = _PostmanCollectionVersion; - - // 0.0.1+1-beta - factory PostmanCollectionVersion.fromString(String value) { - final parts = value.split('+'); - final version = parts[0].split('-')[0]; - final preRelease = parts.length > 1 ? parts[1] : null; - final versionParts = version.split('.'); - - return PostmanCollectionVersion( - major: int.parse(versionParts[0]), - minor: int.parse(versionParts[1]), - patch: int.parse(versionParts[2]), - identifier: preRelease, - ); - } - - factory PostmanCollectionVersion.fromJson(Map json) => - _$PostmanCollectionVersionFromJson(json); -} - -@freezed -class PostmanCollectionItem with _$PostmanCollectionItem { - const PostmanCollectionItem._(); - - const factory PostmanCollectionItem({ - String? id, - required String name, - String? description, - List? variable, - List? event, - Map? protocolProfileBehavior, - PostmanCollectionRequest? request, - List? response, - List? item, - }) = _PostmanCollectionItem; - - static String getNameFromFunction(Function function) { - final string = function.toString(); - final firstQuote = string.indexOf("'"); - final secondQuote = string.indexOf("'", firstQuote + 1); - final name = string.substring(firstQuote + 1, secondQuote); - - return toSentenceCase(name); - } - - static String getNameFromClass(Type type) { - final string = type.toString(); - final name = string.substring(string.indexOf('.') + 1); - - return toSentenceCase(name); - } - - factory PostmanCollectionItem.fromJson(Map json) => - _$PostmanCollectionItemFromJson(json); -} - -@freezed -class PostmanCollectionAuth with _$PostmanCollectionAuth { - const PostmanCollectionAuth._(); - - const factory PostmanCollectionAuth({ - required PostmanCollectionAuthType type, - List? noauth, - List? apikey, - List? awsv4, - List? basic, - List? bearer, - List? digest, - List? edgegrid, - List? hawk, - List? ntlm, - List? oauth1, - List? oauth2, - }) = _PostmanCollectionAuth; - - factory PostmanCollectionAuth.fromJson(Map json) => - _$PostmanCollectionAuthFromJson(json); -} - -@freezed -class PostmanCollectionAuthAttribute with _$PostmanCollectionAuthAttribute { - const PostmanCollectionAuthAttribute._(); - - const factory PostmanCollectionAuthAttribute({ - required String key, - Object? value, - String? type, - }) = _PostmanCollectionAuthAttribute; - - factory PostmanCollectionAuthAttribute.fromJson(Map json) => - _$PostmanCollectionAuthAttributeFromJson(json); -} - -@freezed -class PostmanCollectionRequest with _$PostmanCollectionRequest { - const PostmanCollectionRequest._(); - - const factory PostmanCollectionRequest({ - PostmanCollectionAuth? auth, - required String method, - PostmanCollectionProxyConfig? proxy, - PostmanCollectionCertificate? certificate, - List? header, - PostmanCollectionRequestMode? body, - PostmanCollectionUrl? url, - String? description, - }) = _PostmanCollectionRequest; - - factory PostmanCollectionRequest.fromJson(Map json) => - _$PostmanCollectionRequestFromJson(json); - - factory PostmanCollectionRequest.fromRequestOptions(RequestOptions options) { - return PostmanCollectionRequest( - method: options.method, - header: options.headers.isEmpty - ? [] - : options.headers.entries.map((entry) { - return PostmanCollectionHeader( - key: entry.key, - value: entry.value, - ); - }).toList(), - description: options.method, - body: _body(options), - url: PostmanCollectionUrl( - raw: options.uri.toString(), - // protocol: options.uri.scheme, - port: options.uri.port == 443 ? null : options.uri.port.toString(), - host: options.baseUrl, - path: options.path, - query: options.queryParameters.isEmpty - ? [] - : options.queryParameters.entries.map((entry) { - return PostmanCollectionQueryParam( - key: entry.key, - value: entry.value?.toString(), - ); - }).toList(), - ), - ); - } - - static PostmanCollectionRequestMode _body(RequestOptions options) { - PostmanCollectionRequestMode formData(Map data) { - return PostmanCollectionRequestMode.formdata( - formdata: data.entries.map((entry) { - switch (entry.value) { - case MultipartFile file: - return PostmanFormDataEntry( - key: entry.key, - type: 'file', - src: file.filename ?? '', - ); - default: - return PostmanFormDataEntry( - key: entry.key, - type: 'text', - value: entry.value.toString(), - ); - } - }).toList(), - ); - } - - final data = options.data; - - if (data is FormData) { - return formData( - Map.fromEntries( - [...data.fields, ...data.files], - ), - ); - } - - return switch (options.contentType) { - Headers.multipartFormDataContentType => formData(options.data), - _ => PostmanCollectionRequestMode.raw( - raw: options.data == null - ? null - : options.data is Map - ? JsonEncoder.withIndent(' ').convert(options.data) - : options.data?.toString(), - options: { - 'raw': {'language': 'json'}, - }, - ), - }; - } -} - -@Freezed( - unionKey: 'mode', - fallbackUnion: 'raw', -) -class PostmanCollectionRequestMode with _$PostmanCollectionRequestMode { - const PostmanCollectionRequestMode._(); - - @FreezedUnionValue('raw') - const factory PostmanCollectionRequestMode.raw({ - String? raw, - Map? options, - }) = _PostmanCollectionRequestMode; - - @FreezedUnionValue('formdata') - const factory PostmanCollectionRequestMode.formdata({ - List? formdata, - }) = _PostmanCollectionRequestModeFormdata; - - factory PostmanCollectionRequestMode.fromJson(Map json) => - _$PostmanCollectionRequestModeFromJson(json); -} - -@freezed -class PostmanFormDataEntry with _$PostmanFormDataEntry { - const PostmanFormDataEntry._(); - - const factory PostmanFormDataEntry({ - required String key, - String? src, - String? value, - String? type, - }) = _PostmanFormDataEntry; - - factory PostmanFormDataEntry.fromJson(Map json) => - _$PostmanFormDataEntryFromJson(json); -} - -@freezed -class PostmanCollectionUrl with _$PostmanCollectionUrl { - const PostmanCollectionUrl._(); - - const factory PostmanCollectionUrl({ - String? raw, - String? protocol, - Object? host, - Object? path, - String? port, - List? query, - String? hash, - List? variable, - }) = _PostmanCollectionUrl; - - factory PostmanCollectionUrl.fromJson(Map json) => - _$PostmanCollectionUrlFromJson(json); -} - -@freezed -class PostmanCollectionQueryParam with _$PostmanCollectionQueryParam { - const PostmanCollectionQueryParam._(); - - const factory PostmanCollectionQueryParam({ - String? key, - String? value, - bool? disabled, - String? description, - }) = _PostmanCollectionQueryParam; - - factory PostmanCollectionQueryParam.fromJson(Map json) => - _$PostmanCollectionQueryParamFromJson(json); -} - -@freezed -class PostmanCollectionVariable with _$PostmanCollectionVariable { - const PostmanCollectionVariable._(); - - const factory PostmanCollectionVariable({ - String? id, - String? key, - Object? value, - PostmanCollectionVariableType? type, - String? name, - String? description, - bool? system, - bool? disabled, - }) = _PostmanCollectionVariable; - - factory PostmanCollectionVariable.fromJson(Map json) => - _$PostmanCollectionVariableFromJson(json); -} - -@freezed -class PostmanCollectionEvent with _$PostmanCollectionEvent { - const PostmanCollectionEvent._(); - - const factory PostmanCollectionEvent({ - String? id, - required String listen, - PostmanCollectionScript? script, - bool? disabled, - }) = _PostmanCollectionEvent; - - factory PostmanCollectionEvent.fromJson(Map json) => - _$PostmanCollectionEventFromJson(json); -} - -@freezed -class PostmanCollectionScript with _$PostmanCollectionScript { - const PostmanCollectionScript._(); - - const factory PostmanCollectionScript({ - String? id, - Map? packages, - String? type, - Object? exec, - PostmanCollectionUrl? src, - String? name, - }) = _PostmanCollectionScript; - - factory PostmanCollectionScript.fromJson(Map json) => - _$PostmanCollectionScriptFromJson(json); -} - -@freezed -class PostmanCollectionResponse with _$PostmanCollectionResponse { - const PostmanCollectionResponse._(); - - const factory PostmanCollectionResponse({ - String? name, - String? id, - PostmanCollectionRequest? originalRequest, - @JsonKey(name: '_postman_previewlanguage') String? postmanPreviewLanguage, - Object? responseTime, - Object? timings, - Object? header, - List? cookie, - String? body, - String? status, - int? code, - }) = _PostmanCollectionResponse; - - factory PostmanCollectionResponse.fromJson(Map json) => - _$PostmanCollectionResponseFromJson(json); -} - -@freezed -class PostmanCollectionCookie with _$PostmanCollectionCookie { - const PostmanCollectionCookie._(); - - const factory PostmanCollectionCookie({ - required String domain, - Object? expires, - String? maxAge, - bool? hostOnly, - bool? httpOnly, - String? name, - String? path, - bool? secure, - bool? session, - String? value, - Object? extensions, - }) = _PostmanCollectionCookie; - - factory PostmanCollectionCookie.fromJson(Map json) => - _$PostmanCollectionCookieFromJson(json); -} - -@freezed -class PostmanCollectionCertificate with _$PostmanCollectionCertificate { - const PostmanCollectionCertificate._(); - - const factory PostmanCollectionCertificate({ - String? name, - List? matches, - PostmanCollectionCertificateSrc? key, - PostmanCollectionCertificateSrc? cert, - String? passphrase, - }) = _PostmanCollectionCertificate; - - factory PostmanCollectionCertificate.fromJson(Map json) => - _$PostmanCollectionCertificateFromJson(json); -} - -@freezed -class PostmanCollectionCertificateSrc with _$PostmanCollectionCertificateSrc { - const PostmanCollectionCertificateSrc._(); - - const factory PostmanCollectionCertificateSrc({ - String? src, - }) = _PostmanCollectionCertificateSrc; - - factory PostmanCollectionCertificateSrc.fromJson(Map json) => - _$PostmanCollectionCertificateSrcFromJson(json); -} - -@freezed -class PostmanCollectionProxyConfig with _$PostmanCollectionProxyConfig { - const PostmanCollectionProxyConfig._(); - - const factory PostmanCollectionProxyConfig({ - String? match, - String? host, - int? port, - bool? tunnel, - bool? disabled, - }) = _PostmanCollectionProxyConfig; - - factory PostmanCollectionProxyConfig.fromJson(Map json) => - _$PostmanCollectionProxyConfigFromJson(json); -} - -enum PostmanCollectionAuthType { - apikey, - awsv4, - basic, - bearer, - digest, - edgegrid, - hawk, - noauth, - oauth1, - oauth2, - ntlm, -} - -enum PostmanCollectionVariableType { - string, - boolean, - any, - number, -} - -@freezed -class PostmanCollectionHeader with _$PostmanCollectionHeader { - const PostmanCollectionHeader._(); - - const factory PostmanCollectionHeader({ - required String key, - required String value, - String? type, - bool? disabled, - String? description, - }) = _PostmanCollectionHeader; - - factory PostmanCollectionHeader.fromJson(Map json) => - _$PostmanCollectionHeaderFromJson(json); -} diff --git a/packages/postman_collection/lib/src/postman_collection_base.freezed.dart b/packages/postman_collection/lib/src/postman_collection_base.freezed.dart deleted file mode 100644 index 128d6eb5..00000000 --- a/packages/postman_collection/lib/src/postman_collection_base.freezed.dart +++ /dev/null @@ -1,8469 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'postman_collection_base.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -PostmanCollection _$PostmanCollectionFromJson(Map json) { - return _PostmanCollection.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollection { - PostmanCollectionInfo get info => throw _privateConstructorUsedError; - List get item => throw _privateConstructorUsedError; - PostmanCollectionAuth? get auth => throw _privateConstructorUsedError; - List? get event => throw _privateConstructorUsedError; - Map? get protocolProfileBehavior => - throw _privateConstructorUsedError; - List? get variable => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - PostmanCollectionInfo info, - List item, - PostmanCollectionAuth? auth, - List? event, - Map? protocolProfileBehavior, - List? variable) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - PostmanCollectionInfo info, - List item, - PostmanCollectionAuth? auth, - List? event, - Map? protocolProfileBehavior, - List? variable)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - PostmanCollectionInfo info, - List item, - PostmanCollectionAuth? auth, - List? event, - Map? protocolProfileBehavior, - List? variable)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollection value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollection value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollection value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollection to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollection - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionCopyWith<$Res> { - factory $PostmanCollectionCopyWith( - PostmanCollection value, $Res Function(PostmanCollection) then) = - _$PostmanCollectionCopyWithImpl<$Res, PostmanCollection>; - @useResult - $Res call( - {PostmanCollectionInfo info, - List item, - PostmanCollectionAuth? auth, - List? event, - Map? protocolProfileBehavior, - List? variable}); - - $PostmanCollectionInfoCopyWith<$Res> get info; - $PostmanCollectionAuthCopyWith<$Res>? get auth; -} - -/// @nodoc -class _$PostmanCollectionCopyWithImpl<$Res, $Val extends PostmanCollection> - implements $PostmanCollectionCopyWith<$Res> { - _$PostmanCollectionCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollection - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? info = null, - Object? item = null, - Object? auth = freezed, - Object? event = freezed, - Object? protocolProfileBehavior = freezed, - Object? variable = freezed, - }) { - return _then(_value.copyWith( - info: null == info - ? _value.info - : info // ignore: cast_nullable_to_non_nullable - as PostmanCollectionInfo, - item: null == item - ? _value.item - : item // ignore: cast_nullable_to_non_nullable - as List, - auth: freezed == auth - ? _value.auth - : auth // ignore: cast_nullable_to_non_nullable - as PostmanCollectionAuth?, - event: freezed == event - ? _value.event - : event // ignore: cast_nullable_to_non_nullable - as List?, - protocolProfileBehavior: freezed == protocolProfileBehavior - ? _value.protocolProfileBehavior - : protocolProfileBehavior // ignore: cast_nullable_to_non_nullable - as Map?, - variable: freezed == variable - ? _value.variable - : variable // ignore: cast_nullable_to_non_nullable - as List?, - ) as $Val); - } - - /// Create a copy of PostmanCollection - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionInfoCopyWith<$Res> get info { - return $PostmanCollectionInfoCopyWith<$Res>(_value.info, (value) { - return _then(_value.copyWith(info: value) as $Val); - }); - } - - /// Create a copy of PostmanCollection - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionAuthCopyWith<$Res>? get auth { - if (_value.auth == null) { - return null; - } - - return $PostmanCollectionAuthCopyWith<$Res>(_value.auth!, (value) { - return _then(_value.copyWith(auth: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionImplCopyWith<$Res> - implements $PostmanCollectionCopyWith<$Res> { - factory _$$PostmanCollectionImplCopyWith(_$PostmanCollectionImpl value, - $Res Function(_$PostmanCollectionImpl) then) = - __$$PostmanCollectionImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {PostmanCollectionInfo info, - List item, - PostmanCollectionAuth? auth, - List? event, - Map? protocolProfileBehavior, - List? variable}); - - @override - $PostmanCollectionInfoCopyWith<$Res> get info; - @override - $PostmanCollectionAuthCopyWith<$Res>? get auth; -} - -/// @nodoc -class __$$PostmanCollectionImplCopyWithImpl<$Res> - extends _$PostmanCollectionCopyWithImpl<$Res, _$PostmanCollectionImpl> - implements _$$PostmanCollectionImplCopyWith<$Res> { - __$$PostmanCollectionImplCopyWithImpl(_$PostmanCollectionImpl _value, - $Res Function(_$PostmanCollectionImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollection - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? info = null, - Object? item = null, - Object? auth = freezed, - Object? event = freezed, - Object? protocolProfileBehavior = freezed, - Object? variable = freezed, - }) { - return _then(_$PostmanCollectionImpl( - info: null == info - ? _value.info - : info // ignore: cast_nullable_to_non_nullable - as PostmanCollectionInfo, - item: null == item - ? _value._item - : item // ignore: cast_nullable_to_non_nullable - as List, - auth: freezed == auth - ? _value.auth - : auth // ignore: cast_nullable_to_non_nullable - as PostmanCollectionAuth?, - event: freezed == event - ? _value._event - : event // ignore: cast_nullable_to_non_nullable - as List?, - protocolProfileBehavior: freezed == protocolProfileBehavior - ? _value._protocolProfileBehavior - : protocolProfileBehavior // ignore: cast_nullable_to_non_nullable - as Map?, - variable: freezed == variable - ? _value._variable - : variable // ignore: cast_nullable_to_non_nullable - as List?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionImpl extends _PostmanCollection { - const _$PostmanCollectionImpl( - {required this.info, - required final List item, - this.auth, - final List? event, - final Map? protocolProfileBehavior, - final List? variable}) - : _item = item, - _event = event, - _protocolProfileBehavior = protocolProfileBehavior, - _variable = variable, - super._(); - - factory _$PostmanCollectionImpl.fromJson(Map json) => - _$$PostmanCollectionImplFromJson(json); - - @override - final PostmanCollectionInfo info; - final List _item; - @override - List get item { - if (_item is EqualUnmodifiableListView) return _item; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_item); - } - - @override - final PostmanCollectionAuth? auth; - final List? _event; - @override - List? get event { - final value = _event; - if (value == null) return null; - if (_event is EqualUnmodifiableListView) return _event; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final Map? _protocolProfileBehavior; - @override - Map? get protocolProfileBehavior { - final value = _protocolProfileBehavior; - if (value == null) return null; - if (_protocolProfileBehavior is EqualUnmodifiableMapView) - return _protocolProfileBehavior; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final List? _variable; - @override - List? get variable { - final value = _variable; - if (value == null) return null; - if (_variable is EqualUnmodifiableListView) return _variable; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - String toString() { - return 'PostmanCollection(info: $info, item: $item, auth: $auth, event: $event, protocolProfileBehavior: $protocolProfileBehavior, variable: $variable)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionImpl && - (identical(other.info, info) || other.info == info) && - const DeepCollectionEquality().equals(other._item, _item) && - (identical(other.auth, auth) || other.auth == auth) && - const DeepCollectionEquality().equals(other._event, _event) && - const DeepCollectionEquality().equals( - other._protocolProfileBehavior, _protocolProfileBehavior) && - const DeepCollectionEquality().equals(other._variable, _variable)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - info, - const DeepCollectionEquality().hash(_item), - auth, - const DeepCollectionEquality().hash(_event), - const DeepCollectionEquality().hash(_protocolProfileBehavior), - const DeepCollectionEquality().hash(_variable)); - - /// Create a copy of PostmanCollection - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionImplCopyWith<_$PostmanCollectionImpl> get copyWith => - __$$PostmanCollectionImplCopyWithImpl<_$PostmanCollectionImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - PostmanCollectionInfo info, - List item, - PostmanCollectionAuth? auth, - List? event, - Map? protocolProfileBehavior, - List? variable) - $default, - ) { - return $default(info, item, auth, event, protocolProfileBehavior, variable); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - PostmanCollectionInfo info, - List item, - PostmanCollectionAuth? auth, - List? event, - Map? protocolProfileBehavior, - List? variable)? - $default, - ) { - return $default?.call( - info, item, auth, event, protocolProfileBehavior, variable); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - PostmanCollectionInfo info, - List item, - PostmanCollectionAuth? auth, - List? event, - Map? protocolProfileBehavior, - List? variable)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default( - info, item, auth, event, protocolProfileBehavior, variable); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollection value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollection value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollection value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionImplToJson( - this, - ); - } -} - -abstract class _PostmanCollection extends PostmanCollection { - const factory _PostmanCollection( - {required final PostmanCollectionInfo info, - required final List item, - final PostmanCollectionAuth? auth, - final List? event, - final Map? protocolProfileBehavior, - final List? variable}) = - _$PostmanCollectionImpl; - const _PostmanCollection._() : super._(); - - factory _PostmanCollection.fromJson(Map json) = - _$PostmanCollectionImpl.fromJson; - - @override - PostmanCollectionInfo get info; - @override - List get item; - @override - PostmanCollectionAuth? get auth; - @override - List? get event; - @override - Map? get protocolProfileBehavior; - @override - List? get variable; - - /// Create a copy of PostmanCollection - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionImplCopyWith<_$PostmanCollectionImpl> get copyWith => - throw _privateConstructorUsedError; -} - -PostmanCollectionInfo _$PostmanCollectionInfoFromJson( - Map json) { - return _PostmanCollectionInfo.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionInfo { - @JsonKey(name: '_postman_id') - String? get postmanId => throw _privateConstructorUsedError; - String get name => throw _privateConstructorUsedError; - String get schema => throw _privateConstructorUsedError; - String? get description => throw _privateConstructorUsedError; - PostmanCollectionVersion? get version => throw _privateConstructorUsedError; - @JsonKey(name: '_exporter_id') - String? get exporterId => throw _privateConstructorUsedError; - @JsonKey(name: '_collection_link') - String? get collectionLink => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - @JsonKey(name: '_postman_id') String? postmanId, - String name, - String schema, - String? description, - PostmanCollectionVersion? version, - @JsonKey(name: '_exporter_id') String? exporterId, - @JsonKey(name: '_collection_link') String? collectionLink) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - @JsonKey(name: '_postman_id') String? postmanId, - String name, - String schema, - String? description, - PostmanCollectionVersion? version, - @JsonKey(name: '_exporter_id') String? exporterId, - @JsonKey(name: '_collection_link') String? collectionLink)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - @JsonKey(name: '_postman_id') String? postmanId, - String name, - String schema, - String? description, - PostmanCollectionVersion? version, - @JsonKey(name: '_exporter_id') String? exporterId, - @JsonKey(name: '_collection_link') String? collectionLink)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionInfo value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionInfo value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionInfo value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionInfo to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionInfo - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionInfoCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionInfoCopyWith<$Res> { - factory $PostmanCollectionInfoCopyWith(PostmanCollectionInfo value, - $Res Function(PostmanCollectionInfo) then) = - _$PostmanCollectionInfoCopyWithImpl<$Res, PostmanCollectionInfo>; - @useResult - $Res call( - {@JsonKey(name: '_postman_id') String? postmanId, - String name, - String schema, - String? description, - PostmanCollectionVersion? version, - @JsonKey(name: '_exporter_id') String? exporterId, - @JsonKey(name: '_collection_link') String? collectionLink}); - - $PostmanCollectionVersionCopyWith<$Res>? get version; -} - -/// @nodoc -class _$PostmanCollectionInfoCopyWithImpl<$Res, - $Val extends PostmanCollectionInfo> - implements $PostmanCollectionInfoCopyWith<$Res> { - _$PostmanCollectionInfoCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionInfo - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? postmanId = freezed, - Object? name = null, - Object? schema = null, - Object? description = freezed, - Object? version = freezed, - Object? exporterId = freezed, - Object? collectionLink = freezed, - }) { - return _then(_value.copyWith( - postmanId: freezed == postmanId - ? _value.postmanId - : postmanId // ignore: cast_nullable_to_non_nullable - as String?, - name: null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - schema: null == schema - ? _value.schema - : schema // ignore: cast_nullable_to_non_nullable - as String, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - version: freezed == version - ? _value.version - : version // ignore: cast_nullable_to_non_nullable - as PostmanCollectionVersion?, - exporterId: freezed == exporterId - ? _value.exporterId - : exporterId // ignore: cast_nullable_to_non_nullable - as String?, - collectionLink: freezed == collectionLink - ? _value.collectionLink - : collectionLink // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } - - /// Create a copy of PostmanCollectionInfo - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionVersionCopyWith<$Res>? get version { - if (_value.version == null) { - return null; - } - - return $PostmanCollectionVersionCopyWith<$Res>(_value.version!, (value) { - return _then(_value.copyWith(version: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionInfoImplCopyWith<$Res> - implements $PostmanCollectionInfoCopyWith<$Res> { - factory _$$PostmanCollectionInfoImplCopyWith( - _$PostmanCollectionInfoImpl value, - $Res Function(_$PostmanCollectionInfoImpl) then) = - __$$PostmanCollectionInfoImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {@JsonKey(name: '_postman_id') String? postmanId, - String name, - String schema, - String? description, - PostmanCollectionVersion? version, - @JsonKey(name: '_exporter_id') String? exporterId, - @JsonKey(name: '_collection_link') String? collectionLink}); - - @override - $PostmanCollectionVersionCopyWith<$Res>? get version; -} - -/// @nodoc -class __$$PostmanCollectionInfoImplCopyWithImpl<$Res> - extends _$PostmanCollectionInfoCopyWithImpl<$Res, - _$PostmanCollectionInfoImpl> - implements _$$PostmanCollectionInfoImplCopyWith<$Res> { - __$$PostmanCollectionInfoImplCopyWithImpl(_$PostmanCollectionInfoImpl _value, - $Res Function(_$PostmanCollectionInfoImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionInfo - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? postmanId = freezed, - Object? name = null, - Object? schema = null, - Object? description = freezed, - Object? version = freezed, - Object? exporterId = freezed, - Object? collectionLink = freezed, - }) { - return _then(_$PostmanCollectionInfoImpl( - postmanId: freezed == postmanId - ? _value.postmanId - : postmanId // ignore: cast_nullable_to_non_nullable - as String?, - name: null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - schema: null == schema - ? _value.schema - : schema // ignore: cast_nullable_to_non_nullable - as String, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - version: freezed == version - ? _value.version - : version // ignore: cast_nullable_to_non_nullable - as PostmanCollectionVersion?, - exporterId: freezed == exporterId - ? _value.exporterId - : exporterId // ignore: cast_nullable_to_non_nullable - as String?, - collectionLink: freezed == collectionLink - ? _value.collectionLink - : collectionLink // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionInfoImpl extends _PostmanCollectionInfo { - const _$PostmanCollectionInfoImpl( - {@JsonKey(name: '_postman_id') this.postmanId, - required this.name, - required this.schema, - this.description, - this.version, - @JsonKey(name: '_exporter_id') this.exporterId, - @JsonKey(name: '_collection_link') this.collectionLink}) - : super._(); - - factory _$PostmanCollectionInfoImpl.fromJson(Map json) => - _$$PostmanCollectionInfoImplFromJson(json); - - @override - @JsonKey(name: '_postman_id') - final String? postmanId; - @override - final String name; - @override - final String schema; - @override - final String? description; - @override - final PostmanCollectionVersion? version; - @override - @JsonKey(name: '_exporter_id') - final String? exporterId; - @override - @JsonKey(name: '_collection_link') - final String? collectionLink; - - @override - String toString() { - return 'PostmanCollectionInfo(postmanId: $postmanId, name: $name, schema: $schema, description: $description, version: $version, exporterId: $exporterId, collectionLink: $collectionLink)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionInfoImpl && - (identical(other.postmanId, postmanId) || - other.postmanId == postmanId) && - (identical(other.name, name) || other.name == name) && - (identical(other.schema, schema) || other.schema == schema) && - (identical(other.description, description) || - other.description == description) && - (identical(other.version, version) || other.version == version) && - (identical(other.exporterId, exporterId) || - other.exporterId == exporterId) && - (identical(other.collectionLink, collectionLink) || - other.collectionLink == collectionLink)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, postmanId, name, schema, - description, version, exporterId, collectionLink); - - /// Create a copy of PostmanCollectionInfo - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionInfoImplCopyWith<_$PostmanCollectionInfoImpl> - get copyWith => __$$PostmanCollectionInfoImplCopyWithImpl< - _$PostmanCollectionInfoImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - @JsonKey(name: '_postman_id') String? postmanId, - String name, - String schema, - String? description, - PostmanCollectionVersion? version, - @JsonKey(name: '_exporter_id') String? exporterId, - @JsonKey(name: '_collection_link') String? collectionLink) - $default, - ) { - return $default(postmanId, name, schema, description, version, exporterId, - collectionLink); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - @JsonKey(name: '_postman_id') String? postmanId, - String name, - String schema, - String? description, - PostmanCollectionVersion? version, - @JsonKey(name: '_exporter_id') String? exporterId, - @JsonKey(name: '_collection_link') String? collectionLink)? - $default, - ) { - return $default?.call(postmanId, name, schema, description, version, - exporterId, collectionLink); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - @JsonKey(name: '_postman_id') String? postmanId, - String name, - String schema, - String? description, - PostmanCollectionVersion? version, - @JsonKey(name: '_exporter_id') String? exporterId, - @JsonKey(name: '_collection_link') String? collectionLink)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(postmanId, name, schema, description, version, exporterId, - collectionLink); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionInfo value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionInfo value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionInfo value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionInfoImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionInfo extends PostmanCollectionInfo { - const factory _PostmanCollectionInfo( - {@JsonKey(name: '_postman_id') final String? postmanId, - required final String name, - required final String schema, - final String? description, - final PostmanCollectionVersion? version, - @JsonKey(name: '_exporter_id') final String? exporterId, - @JsonKey(name: '_collection_link') final String? collectionLink}) = - _$PostmanCollectionInfoImpl; - const _PostmanCollectionInfo._() : super._(); - - factory _PostmanCollectionInfo.fromJson(Map json) = - _$PostmanCollectionInfoImpl.fromJson; - - @override - @JsonKey(name: '_postman_id') - String? get postmanId; - @override - String get name; - @override - String get schema; - @override - String? get description; - @override - PostmanCollectionVersion? get version; - @override - @JsonKey(name: '_exporter_id') - String? get exporterId; - @override - @JsonKey(name: '_collection_link') - String? get collectionLink; - - /// Create a copy of PostmanCollectionInfo - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionInfoImplCopyWith<_$PostmanCollectionInfoImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionVersion _$PostmanCollectionVersionFromJson( - Map json) { - return _PostmanCollectionVersion.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionVersion { - int get major => throw _privateConstructorUsedError; - int get minor => throw _privateConstructorUsedError; - int get patch => throw _privateConstructorUsedError; - String? get identifier => throw _privateConstructorUsedError; - Object? get meta => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - int major, int minor, int patch, String? identifier, Object? meta) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - int major, int minor, int patch, String? identifier, Object? meta)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - int major, int minor, int patch, String? identifier, Object? meta)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionVersion value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionVersion value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionVersion value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionVersion to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionVersion - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionVersionCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionVersionCopyWith<$Res> { - factory $PostmanCollectionVersionCopyWith(PostmanCollectionVersion value, - $Res Function(PostmanCollectionVersion) then) = - _$PostmanCollectionVersionCopyWithImpl<$Res, PostmanCollectionVersion>; - @useResult - $Res call( - {int major, int minor, int patch, String? identifier, Object? meta}); -} - -/// @nodoc -class _$PostmanCollectionVersionCopyWithImpl<$Res, - $Val extends PostmanCollectionVersion> - implements $PostmanCollectionVersionCopyWith<$Res> { - _$PostmanCollectionVersionCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionVersion - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? major = null, - Object? minor = null, - Object? patch = null, - Object? identifier = freezed, - Object? meta = freezed, - }) { - return _then(_value.copyWith( - major: null == major - ? _value.major - : major // ignore: cast_nullable_to_non_nullable - as int, - minor: null == minor - ? _value.minor - : minor // ignore: cast_nullable_to_non_nullable - as int, - patch: null == patch - ? _value.patch - : patch // ignore: cast_nullable_to_non_nullable - as int, - identifier: freezed == identifier - ? _value.identifier - : identifier // ignore: cast_nullable_to_non_nullable - as String?, - meta: freezed == meta ? _value.meta : meta, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionVersionImplCopyWith<$Res> - implements $PostmanCollectionVersionCopyWith<$Res> { - factory _$$PostmanCollectionVersionImplCopyWith( - _$PostmanCollectionVersionImpl value, - $Res Function(_$PostmanCollectionVersionImpl) then) = - __$$PostmanCollectionVersionImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {int major, int minor, int patch, String? identifier, Object? meta}); -} - -/// @nodoc -class __$$PostmanCollectionVersionImplCopyWithImpl<$Res> - extends _$PostmanCollectionVersionCopyWithImpl<$Res, - _$PostmanCollectionVersionImpl> - implements _$$PostmanCollectionVersionImplCopyWith<$Res> { - __$$PostmanCollectionVersionImplCopyWithImpl( - _$PostmanCollectionVersionImpl _value, - $Res Function(_$PostmanCollectionVersionImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionVersion - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? major = null, - Object? minor = null, - Object? patch = null, - Object? identifier = freezed, - Object? meta = freezed, - }) { - return _then(_$PostmanCollectionVersionImpl( - major: null == major - ? _value.major - : major // ignore: cast_nullable_to_non_nullable - as int, - minor: null == minor - ? _value.minor - : minor // ignore: cast_nullable_to_non_nullable - as int, - patch: null == patch - ? _value.patch - : patch // ignore: cast_nullable_to_non_nullable - as int, - identifier: freezed == identifier - ? _value.identifier - : identifier // ignore: cast_nullable_to_non_nullable - as String?, - meta: freezed == meta ? _value.meta : meta, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionVersionImpl extends _PostmanCollectionVersion { - const _$PostmanCollectionVersionImpl( - {required this.major, - required this.minor, - required this.patch, - this.identifier, - this.meta}) - : super._(); - - factory _$PostmanCollectionVersionImpl.fromJson(Map json) => - _$$PostmanCollectionVersionImplFromJson(json); - - @override - final int major; - @override - final int minor; - @override - final int patch; - @override - final String? identifier; - @override - final Object? meta; - - @override - String toString() { - return 'PostmanCollectionVersion(major: $major, minor: $minor, patch: $patch, identifier: $identifier, meta: $meta)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionVersionImpl && - (identical(other.major, major) || other.major == major) && - (identical(other.minor, minor) || other.minor == minor) && - (identical(other.patch, patch) || other.patch == patch) && - (identical(other.identifier, identifier) || - other.identifier == identifier) && - const DeepCollectionEquality().equals(other.meta, meta)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, major, minor, patch, identifier, - const DeepCollectionEquality().hash(meta)); - - /// Create a copy of PostmanCollectionVersion - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionVersionImplCopyWith<_$PostmanCollectionVersionImpl> - get copyWith => __$$PostmanCollectionVersionImplCopyWithImpl< - _$PostmanCollectionVersionImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - int major, int minor, int patch, String? identifier, Object? meta) - $default, - ) { - return $default(major, minor, patch, identifier, meta); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - int major, int minor, int patch, String? identifier, Object? meta)? - $default, - ) { - return $default?.call(major, minor, patch, identifier, meta); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - int major, int minor, int patch, String? identifier, Object? meta)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(major, minor, patch, identifier, meta); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionVersion value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionVersion value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionVersion value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionVersionImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionVersion extends PostmanCollectionVersion { - const factory _PostmanCollectionVersion( - {required final int major, - required final int minor, - required final int patch, - final String? identifier, - final Object? meta}) = _$PostmanCollectionVersionImpl; - const _PostmanCollectionVersion._() : super._(); - - factory _PostmanCollectionVersion.fromJson(Map json) = - _$PostmanCollectionVersionImpl.fromJson; - - @override - int get major; - @override - int get minor; - @override - int get patch; - @override - String? get identifier; - @override - Object? get meta; - - /// Create a copy of PostmanCollectionVersion - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionVersionImplCopyWith<_$PostmanCollectionVersionImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionItem _$PostmanCollectionItemFromJson( - Map json) { - return _PostmanCollectionItem.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionItem { - String? get id => throw _privateConstructorUsedError; - String get name => throw _privateConstructorUsedError; - String? get description => throw _privateConstructorUsedError; - List? get variable => - throw _privateConstructorUsedError; - List? get event => throw _privateConstructorUsedError; - Map? get protocolProfileBehavior => - throw _privateConstructorUsedError; - PostmanCollectionRequest? get request => throw _privateConstructorUsedError; - List? get response => - throw _privateConstructorUsedError; - List? get item => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - String? id, - String name, - String? description, - List? variable, - List? event, - Map? protocolProfileBehavior, - PostmanCollectionRequest? request, - List? response, - List? item) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? id, - String name, - String? description, - List? variable, - List? event, - Map? protocolProfileBehavior, - PostmanCollectionRequest? request, - List? response, - List? item)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? id, - String name, - String? description, - List? variable, - List? event, - Map? protocolProfileBehavior, - PostmanCollectionRequest? request, - List? response, - List? item)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionItem value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionItem value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionItem value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionItem to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionItem - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionItemCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionItemCopyWith<$Res> { - factory $PostmanCollectionItemCopyWith(PostmanCollectionItem value, - $Res Function(PostmanCollectionItem) then) = - _$PostmanCollectionItemCopyWithImpl<$Res, PostmanCollectionItem>; - @useResult - $Res call( - {String? id, - String name, - String? description, - List? variable, - List? event, - Map? protocolProfileBehavior, - PostmanCollectionRequest? request, - List? response, - List? item}); - - $PostmanCollectionRequestCopyWith<$Res>? get request; -} - -/// @nodoc -class _$PostmanCollectionItemCopyWithImpl<$Res, - $Val extends PostmanCollectionItem> - implements $PostmanCollectionItemCopyWith<$Res> { - _$PostmanCollectionItemCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionItem - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? name = null, - Object? description = freezed, - Object? variable = freezed, - Object? event = freezed, - Object? protocolProfileBehavior = freezed, - Object? request = freezed, - Object? response = freezed, - Object? item = freezed, - }) { - return _then(_value.copyWith( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - name: null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - variable: freezed == variable - ? _value.variable - : variable // ignore: cast_nullable_to_non_nullable - as List?, - event: freezed == event - ? _value.event - : event // ignore: cast_nullable_to_non_nullable - as List?, - protocolProfileBehavior: freezed == protocolProfileBehavior - ? _value.protocolProfileBehavior - : protocolProfileBehavior // ignore: cast_nullable_to_non_nullable - as Map?, - request: freezed == request - ? _value.request - : request // ignore: cast_nullable_to_non_nullable - as PostmanCollectionRequest?, - response: freezed == response - ? _value.response - : response // ignore: cast_nullable_to_non_nullable - as List?, - item: freezed == item - ? _value.item - : item // ignore: cast_nullable_to_non_nullable - as List?, - ) as $Val); - } - - /// Create a copy of PostmanCollectionItem - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionRequestCopyWith<$Res>? get request { - if (_value.request == null) { - return null; - } - - return $PostmanCollectionRequestCopyWith<$Res>(_value.request!, (value) { - return _then(_value.copyWith(request: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionItemImplCopyWith<$Res> - implements $PostmanCollectionItemCopyWith<$Res> { - factory _$$PostmanCollectionItemImplCopyWith( - _$PostmanCollectionItemImpl value, - $Res Function(_$PostmanCollectionItemImpl) then) = - __$$PostmanCollectionItemImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? id, - String name, - String? description, - List? variable, - List? event, - Map? protocolProfileBehavior, - PostmanCollectionRequest? request, - List? response, - List? item}); - - @override - $PostmanCollectionRequestCopyWith<$Res>? get request; -} - -/// @nodoc -class __$$PostmanCollectionItemImplCopyWithImpl<$Res> - extends _$PostmanCollectionItemCopyWithImpl<$Res, - _$PostmanCollectionItemImpl> - implements _$$PostmanCollectionItemImplCopyWith<$Res> { - __$$PostmanCollectionItemImplCopyWithImpl(_$PostmanCollectionItemImpl _value, - $Res Function(_$PostmanCollectionItemImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionItem - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? name = null, - Object? description = freezed, - Object? variable = freezed, - Object? event = freezed, - Object? protocolProfileBehavior = freezed, - Object? request = freezed, - Object? response = freezed, - Object? item = freezed, - }) { - return _then(_$PostmanCollectionItemImpl( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - name: null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - variable: freezed == variable - ? _value._variable - : variable // ignore: cast_nullable_to_non_nullable - as List?, - event: freezed == event - ? _value._event - : event // ignore: cast_nullable_to_non_nullable - as List?, - protocolProfileBehavior: freezed == protocolProfileBehavior - ? _value._protocolProfileBehavior - : protocolProfileBehavior // ignore: cast_nullable_to_non_nullable - as Map?, - request: freezed == request - ? _value.request - : request // ignore: cast_nullable_to_non_nullable - as PostmanCollectionRequest?, - response: freezed == response - ? _value._response - : response // ignore: cast_nullable_to_non_nullable - as List?, - item: freezed == item - ? _value._item - : item // ignore: cast_nullable_to_non_nullable - as List?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionItemImpl extends _PostmanCollectionItem { - const _$PostmanCollectionItemImpl( - {this.id, - required this.name, - this.description, - final List? variable, - final List? event, - final Map? protocolProfileBehavior, - this.request, - final List? response, - final List? item}) - : _variable = variable, - _event = event, - _protocolProfileBehavior = protocolProfileBehavior, - _response = response, - _item = item, - super._(); - - factory _$PostmanCollectionItemImpl.fromJson(Map json) => - _$$PostmanCollectionItemImplFromJson(json); - - @override - final String? id; - @override - final String name; - @override - final String? description; - final List? _variable; - @override - List? get variable { - final value = _variable; - if (value == null) return null; - if (_variable is EqualUnmodifiableListView) return _variable; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _event; - @override - List? get event { - final value = _event; - if (value == null) return null; - if (_event is EqualUnmodifiableListView) return _event; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final Map? _protocolProfileBehavior; - @override - Map? get protocolProfileBehavior { - final value = _protocolProfileBehavior; - if (value == null) return null; - if (_protocolProfileBehavior is EqualUnmodifiableMapView) - return _protocolProfileBehavior; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final PostmanCollectionRequest? request; - final List? _response; - @override - List? get response { - final value = _response; - if (value == null) return null; - if (_response is EqualUnmodifiableListView) return _response; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _item; - @override - List? get item { - final value = _item; - if (value == null) return null; - if (_item is EqualUnmodifiableListView) return _item; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - String toString() { - return 'PostmanCollectionItem(id: $id, name: $name, description: $description, variable: $variable, event: $event, protocolProfileBehavior: $protocolProfileBehavior, request: $request, response: $response, item: $item)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionItemImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.name, name) || other.name == name) && - (identical(other.description, description) || - other.description == description) && - const DeepCollectionEquality().equals(other._variable, _variable) && - const DeepCollectionEquality().equals(other._event, _event) && - const DeepCollectionEquality().equals( - other._protocolProfileBehavior, _protocolProfileBehavior) && - (identical(other.request, request) || other.request == request) && - const DeepCollectionEquality().equals(other._response, _response) && - const DeepCollectionEquality().equals(other._item, _item)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - id, - name, - description, - const DeepCollectionEquality().hash(_variable), - const DeepCollectionEquality().hash(_event), - const DeepCollectionEquality().hash(_protocolProfileBehavior), - request, - const DeepCollectionEquality().hash(_response), - const DeepCollectionEquality().hash(_item)); - - /// Create a copy of PostmanCollectionItem - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionItemImplCopyWith<_$PostmanCollectionItemImpl> - get copyWith => __$$PostmanCollectionItemImplCopyWithImpl< - _$PostmanCollectionItemImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - String? id, - String name, - String? description, - List? variable, - List? event, - Map? protocolProfileBehavior, - PostmanCollectionRequest? request, - List? response, - List? item) - $default, - ) { - return $default(id, name, description, variable, event, - protocolProfileBehavior, request, response, item); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? id, - String name, - String? description, - List? variable, - List? event, - Map? protocolProfileBehavior, - PostmanCollectionRequest? request, - List? response, - List? item)? - $default, - ) { - return $default?.call(id, name, description, variable, event, - protocolProfileBehavior, request, response, item); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? id, - String name, - String? description, - List? variable, - List? event, - Map? protocolProfileBehavior, - PostmanCollectionRequest? request, - List? response, - List? item)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(id, name, description, variable, event, - protocolProfileBehavior, request, response, item); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionItem value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionItem value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionItem value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionItemImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionItem extends PostmanCollectionItem { - const factory _PostmanCollectionItem( - {final String? id, - required final String name, - final String? description, - final List? variable, - final List? event, - final Map? protocolProfileBehavior, - final PostmanCollectionRequest? request, - final List? response, - final List? item}) = _$PostmanCollectionItemImpl; - const _PostmanCollectionItem._() : super._(); - - factory _PostmanCollectionItem.fromJson(Map json) = - _$PostmanCollectionItemImpl.fromJson; - - @override - String? get id; - @override - String get name; - @override - String? get description; - @override - List? get variable; - @override - List? get event; - @override - Map? get protocolProfileBehavior; - @override - PostmanCollectionRequest? get request; - @override - List? get response; - @override - List? get item; - - /// Create a copy of PostmanCollectionItem - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionItemImplCopyWith<_$PostmanCollectionItemImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionAuth _$PostmanCollectionAuthFromJson( - Map json) { - return _PostmanCollectionAuth.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionAuth { - PostmanCollectionAuthType get type => throw _privateConstructorUsedError; - List? get noauth => - throw _privateConstructorUsedError; - List? get apikey => - throw _privateConstructorUsedError; - List? get awsv4 => - throw _privateConstructorUsedError; - List? get basic => - throw _privateConstructorUsedError; - List? get bearer => - throw _privateConstructorUsedError; - List? get digest => - throw _privateConstructorUsedError; - List? get edgegrid => - throw _privateConstructorUsedError; - List? get hawk => - throw _privateConstructorUsedError; - List? get ntlm => - throw _privateConstructorUsedError; - List? get oauth1 => - throw _privateConstructorUsedError; - List? get oauth2 => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - PostmanCollectionAuthType type, - List? noauth, - List? apikey, - List? awsv4, - List? basic, - List? bearer, - List? digest, - List? edgegrid, - List? hawk, - List? ntlm, - List? oauth1, - List? oauth2) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - PostmanCollectionAuthType type, - List? noauth, - List? apikey, - List? awsv4, - List? basic, - List? bearer, - List? digest, - List? edgegrid, - List? hawk, - List? ntlm, - List? oauth1, - List? oauth2)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - PostmanCollectionAuthType type, - List? noauth, - List? apikey, - List? awsv4, - List? basic, - List? bearer, - List? digest, - List? edgegrid, - List? hawk, - List? ntlm, - List? oauth1, - List? oauth2)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionAuth value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionAuth value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionAuth value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionAuth to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionAuth - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionAuthCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionAuthCopyWith<$Res> { - factory $PostmanCollectionAuthCopyWith(PostmanCollectionAuth value, - $Res Function(PostmanCollectionAuth) then) = - _$PostmanCollectionAuthCopyWithImpl<$Res, PostmanCollectionAuth>; - @useResult - $Res call( - {PostmanCollectionAuthType type, - List? noauth, - List? apikey, - List? awsv4, - List? basic, - List? bearer, - List? digest, - List? edgegrid, - List? hawk, - List? ntlm, - List? oauth1, - List? oauth2}); -} - -/// @nodoc -class _$PostmanCollectionAuthCopyWithImpl<$Res, - $Val extends PostmanCollectionAuth> - implements $PostmanCollectionAuthCopyWith<$Res> { - _$PostmanCollectionAuthCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionAuth - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? type = null, - Object? noauth = freezed, - Object? apikey = freezed, - Object? awsv4 = freezed, - Object? basic = freezed, - Object? bearer = freezed, - Object? digest = freezed, - Object? edgegrid = freezed, - Object? hawk = freezed, - Object? ntlm = freezed, - Object? oauth1 = freezed, - Object? oauth2 = freezed, - }) { - return _then(_value.copyWith( - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as PostmanCollectionAuthType, - noauth: freezed == noauth - ? _value.noauth - : noauth // ignore: cast_nullable_to_non_nullable - as List?, - apikey: freezed == apikey - ? _value.apikey - : apikey // ignore: cast_nullable_to_non_nullable - as List?, - awsv4: freezed == awsv4 - ? _value.awsv4 - : awsv4 // ignore: cast_nullable_to_non_nullable - as List?, - basic: freezed == basic - ? _value.basic - : basic // ignore: cast_nullable_to_non_nullable - as List?, - bearer: freezed == bearer - ? _value.bearer - : bearer // ignore: cast_nullable_to_non_nullable - as List?, - digest: freezed == digest - ? _value.digest - : digest // ignore: cast_nullable_to_non_nullable - as List?, - edgegrid: freezed == edgegrid - ? _value.edgegrid - : edgegrid // ignore: cast_nullable_to_non_nullable - as List?, - hawk: freezed == hawk - ? _value.hawk - : hawk // ignore: cast_nullable_to_non_nullable - as List?, - ntlm: freezed == ntlm - ? _value.ntlm - : ntlm // ignore: cast_nullable_to_non_nullable - as List?, - oauth1: freezed == oauth1 - ? _value.oauth1 - : oauth1 // ignore: cast_nullable_to_non_nullable - as List?, - oauth2: freezed == oauth2 - ? _value.oauth2 - : oauth2 // ignore: cast_nullable_to_non_nullable - as List?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionAuthImplCopyWith<$Res> - implements $PostmanCollectionAuthCopyWith<$Res> { - factory _$$PostmanCollectionAuthImplCopyWith( - _$PostmanCollectionAuthImpl value, - $Res Function(_$PostmanCollectionAuthImpl) then) = - __$$PostmanCollectionAuthImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {PostmanCollectionAuthType type, - List? noauth, - List? apikey, - List? awsv4, - List? basic, - List? bearer, - List? digest, - List? edgegrid, - List? hawk, - List? ntlm, - List? oauth1, - List? oauth2}); -} - -/// @nodoc -class __$$PostmanCollectionAuthImplCopyWithImpl<$Res> - extends _$PostmanCollectionAuthCopyWithImpl<$Res, - _$PostmanCollectionAuthImpl> - implements _$$PostmanCollectionAuthImplCopyWith<$Res> { - __$$PostmanCollectionAuthImplCopyWithImpl(_$PostmanCollectionAuthImpl _value, - $Res Function(_$PostmanCollectionAuthImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionAuth - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? type = null, - Object? noauth = freezed, - Object? apikey = freezed, - Object? awsv4 = freezed, - Object? basic = freezed, - Object? bearer = freezed, - Object? digest = freezed, - Object? edgegrid = freezed, - Object? hawk = freezed, - Object? ntlm = freezed, - Object? oauth1 = freezed, - Object? oauth2 = freezed, - }) { - return _then(_$PostmanCollectionAuthImpl( - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as PostmanCollectionAuthType, - noauth: freezed == noauth - ? _value._noauth - : noauth // ignore: cast_nullable_to_non_nullable - as List?, - apikey: freezed == apikey - ? _value._apikey - : apikey // ignore: cast_nullable_to_non_nullable - as List?, - awsv4: freezed == awsv4 - ? _value._awsv4 - : awsv4 // ignore: cast_nullable_to_non_nullable - as List?, - basic: freezed == basic - ? _value._basic - : basic // ignore: cast_nullable_to_non_nullable - as List?, - bearer: freezed == bearer - ? _value._bearer - : bearer // ignore: cast_nullable_to_non_nullable - as List?, - digest: freezed == digest - ? _value._digest - : digest // ignore: cast_nullable_to_non_nullable - as List?, - edgegrid: freezed == edgegrid - ? _value._edgegrid - : edgegrid // ignore: cast_nullable_to_non_nullable - as List?, - hawk: freezed == hawk - ? _value._hawk - : hawk // ignore: cast_nullable_to_non_nullable - as List?, - ntlm: freezed == ntlm - ? _value._ntlm - : ntlm // ignore: cast_nullable_to_non_nullable - as List?, - oauth1: freezed == oauth1 - ? _value._oauth1 - : oauth1 // ignore: cast_nullable_to_non_nullable - as List?, - oauth2: freezed == oauth2 - ? _value._oauth2 - : oauth2 // ignore: cast_nullable_to_non_nullable - as List?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionAuthImpl extends _PostmanCollectionAuth { - const _$PostmanCollectionAuthImpl( - {required this.type, - final List? noauth, - final List? apikey, - final List? awsv4, - final List? basic, - final List? bearer, - final List? digest, - final List? edgegrid, - final List? hawk, - final List? ntlm, - final List? oauth1, - final List? oauth2}) - : _noauth = noauth, - _apikey = apikey, - _awsv4 = awsv4, - _basic = basic, - _bearer = bearer, - _digest = digest, - _edgegrid = edgegrid, - _hawk = hawk, - _ntlm = ntlm, - _oauth1 = oauth1, - _oauth2 = oauth2, - super._(); - - factory _$PostmanCollectionAuthImpl.fromJson(Map json) => - _$$PostmanCollectionAuthImplFromJson(json); - - @override - final PostmanCollectionAuthType type; - final List? _noauth; - @override - List? get noauth { - final value = _noauth; - if (value == null) return null; - if (_noauth is EqualUnmodifiableListView) return _noauth; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _apikey; - @override - List? get apikey { - final value = _apikey; - if (value == null) return null; - if (_apikey is EqualUnmodifiableListView) return _apikey; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _awsv4; - @override - List? get awsv4 { - final value = _awsv4; - if (value == null) return null; - if (_awsv4 is EqualUnmodifiableListView) return _awsv4; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _basic; - @override - List? get basic { - final value = _basic; - if (value == null) return null; - if (_basic is EqualUnmodifiableListView) return _basic; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _bearer; - @override - List? get bearer { - final value = _bearer; - if (value == null) return null; - if (_bearer is EqualUnmodifiableListView) return _bearer; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _digest; - @override - List? get digest { - final value = _digest; - if (value == null) return null; - if (_digest is EqualUnmodifiableListView) return _digest; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _edgegrid; - @override - List? get edgegrid { - final value = _edgegrid; - if (value == null) return null; - if (_edgegrid is EqualUnmodifiableListView) return _edgegrid; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _hawk; - @override - List? get hawk { - final value = _hawk; - if (value == null) return null; - if (_hawk is EqualUnmodifiableListView) return _hawk; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _ntlm; - @override - List? get ntlm { - final value = _ntlm; - if (value == null) return null; - if (_ntlm is EqualUnmodifiableListView) return _ntlm; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _oauth1; - @override - List? get oauth1 { - final value = _oauth1; - if (value == null) return null; - if (_oauth1 is EqualUnmodifiableListView) return _oauth1; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _oauth2; - @override - List? get oauth2 { - final value = _oauth2; - if (value == null) return null; - if (_oauth2 is EqualUnmodifiableListView) return _oauth2; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - String toString() { - return 'PostmanCollectionAuth(type: $type, noauth: $noauth, apikey: $apikey, awsv4: $awsv4, basic: $basic, bearer: $bearer, digest: $digest, edgegrid: $edgegrid, hawk: $hawk, ntlm: $ntlm, oauth1: $oauth1, oauth2: $oauth2)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionAuthImpl && - (identical(other.type, type) || other.type == type) && - const DeepCollectionEquality().equals(other._noauth, _noauth) && - const DeepCollectionEquality().equals(other._apikey, _apikey) && - const DeepCollectionEquality().equals(other._awsv4, _awsv4) && - const DeepCollectionEquality().equals(other._basic, _basic) && - const DeepCollectionEquality().equals(other._bearer, _bearer) && - const DeepCollectionEquality().equals(other._digest, _digest) && - const DeepCollectionEquality().equals(other._edgegrid, _edgegrid) && - const DeepCollectionEquality().equals(other._hawk, _hawk) && - const DeepCollectionEquality().equals(other._ntlm, _ntlm) && - const DeepCollectionEquality().equals(other._oauth1, _oauth1) && - const DeepCollectionEquality().equals(other._oauth2, _oauth2)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - type, - const DeepCollectionEquality().hash(_noauth), - const DeepCollectionEquality().hash(_apikey), - const DeepCollectionEquality().hash(_awsv4), - const DeepCollectionEquality().hash(_basic), - const DeepCollectionEquality().hash(_bearer), - const DeepCollectionEquality().hash(_digest), - const DeepCollectionEquality().hash(_edgegrid), - const DeepCollectionEquality().hash(_hawk), - const DeepCollectionEquality().hash(_ntlm), - const DeepCollectionEquality().hash(_oauth1), - const DeepCollectionEquality().hash(_oauth2)); - - /// Create a copy of PostmanCollectionAuth - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionAuthImplCopyWith<_$PostmanCollectionAuthImpl> - get copyWith => __$$PostmanCollectionAuthImplCopyWithImpl< - _$PostmanCollectionAuthImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - PostmanCollectionAuthType type, - List? noauth, - List? apikey, - List? awsv4, - List? basic, - List? bearer, - List? digest, - List? edgegrid, - List? hawk, - List? ntlm, - List? oauth1, - List? oauth2) - $default, - ) { - return $default(type, noauth, apikey, awsv4, basic, bearer, digest, - edgegrid, hawk, ntlm, oauth1, oauth2); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - PostmanCollectionAuthType type, - List? noauth, - List? apikey, - List? awsv4, - List? basic, - List? bearer, - List? digest, - List? edgegrid, - List? hawk, - List? ntlm, - List? oauth1, - List? oauth2)? - $default, - ) { - return $default?.call(type, noauth, apikey, awsv4, basic, bearer, digest, - edgegrid, hawk, ntlm, oauth1, oauth2); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - PostmanCollectionAuthType type, - List? noauth, - List? apikey, - List? awsv4, - List? basic, - List? bearer, - List? digest, - List? edgegrid, - List? hawk, - List? ntlm, - List? oauth1, - List? oauth2)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(type, noauth, apikey, awsv4, basic, bearer, digest, - edgegrid, hawk, ntlm, oauth1, oauth2); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionAuth value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionAuth value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionAuth value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionAuthImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionAuth extends PostmanCollectionAuth { - const factory _PostmanCollectionAuth( - {required final PostmanCollectionAuthType type, - final List? noauth, - final List? apikey, - final List? awsv4, - final List? basic, - final List? bearer, - final List? digest, - final List? edgegrid, - final List? hawk, - final List? ntlm, - final List? oauth1, - final List? oauth2}) = - _$PostmanCollectionAuthImpl; - const _PostmanCollectionAuth._() : super._(); - - factory _PostmanCollectionAuth.fromJson(Map json) = - _$PostmanCollectionAuthImpl.fromJson; - - @override - PostmanCollectionAuthType get type; - @override - List? get noauth; - @override - List? get apikey; - @override - List? get awsv4; - @override - List? get basic; - @override - List? get bearer; - @override - List? get digest; - @override - List? get edgegrid; - @override - List? get hawk; - @override - List? get ntlm; - @override - List? get oauth1; - @override - List? get oauth2; - - /// Create a copy of PostmanCollectionAuth - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionAuthImplCopyWith<_$PostmanCollectionAuthImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionAuthAttribute _$PostmanCollectionAuthAttributeFromJson( - Map json) { - return _PostmanCollectionAuthAttribute.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionAuthAttribute { - String get key => throw _privateConstructorUsedError; - Object? get value => throw _privateConstructorUsedError; - String? get type => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function(String key, Object? value, String? type) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String key, Object? value, String? type)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String key, Object? value, String? type)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionAuthAttribute value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionAuthAttribute value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionAuthAttribute value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionAuthAttribute to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionAuthAttribute - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionAuthAttributeCopyWith - get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionAuthAttributeCopyWith<$Res> { - factory $PostmanCollectionAuthAttributeCopyWith( - PostmanCollectionAuthAttribute value, - $Res Function(PostmanCollectionAuthAttribute) then) = - _$PostmanCollectionAuthAttributeCopyWithImpl<$Res, - PostmanCollectionAuthAttribute>; - @useResult - $Res call({String key, Object? value, String? type}); -} - -/// @nodoc -class _$PostmanCollectionAuthAttributeCopyWithImpl<$Res, - $Val extends PostmanCollectionAuthAttribute> - implements $PostmanCollectionAuthAttributeCopyWith<$Res> { - _$PostmanCollectionAuthAttributeCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionAuthAttribute - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? key = null, - Object? value = freezed, - Object? type = freezed, - }) { - return _then(_value.copyWith( - key: null == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String, - value: freezed == value ? _value.value : value, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionAuthAttributeImplCopyWith<$Res> - implements $PostmanCollectionAuthAttributeCopyWith<$Res> { - factory _$$PostmanCollectionAuthAttributeImplCopyWith( - _$PostmanCollectionAuthAttributeImpl value, - $Res Function(_$PostmanCollectionAuthAttributeImpl) then) = - __$$PostmanCollectionAuthAttributeImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String key, Object? value, String? type}); -} - -/// @nodoc -class __$$PostmanCollectionAuthAttributeImplCopyWithImpl<$Res> - extends _$PostmanCollectionAuthAttributeCopyWithImpl<$Res, - _$PostmanCollectionAuthAttributeImpl> - implements _$$PostmanCollectionAuthAttributeImplCopyWith<$Res> { - __$$PostmanCollectionAuthAttributeImplCopyWithImpl( - _$PostmanCollectionAuthAttributeImpl _value, - $Res Function(_$PostmanCollectionAuthAttributeImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionAuthAttribute - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? key = null, - Object? value = freezed, - Object? type = freezed, - }) { - return _then(_$PostmanCollectionAuthAttributeImpl( - key: null == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String, - value: freezed == value ? _value.value : value, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionAuthAttributeImpl - extends _PostmanCollectionAuthAttribute { - const _$PostmanCollectionAuthAttributeImpl( - {required this.key, this.value, this.type}) - : super._(); - - factory _$PostmanCollectionAuthAttributeImpl.fromJson( - Map json) => - _$$PostmanCollectionAuthAttributeImplFromJson(json); - - @override - final String key; - @override - final Object? value; - @override - final String? type; - - @override - String toString() { - return 'PostmanCollectionAuthAttribute(key: $key, value: $value, type: $type)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionAuthAttributeImpl && - (identical(other.key, key) || other.key == key) && - const DeepCollectionEquality().equals(other.value, value) && - (identical(other.type, type) || other.type == type)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, key, const DeepCollectionEquality().hash(value), type); - - /// Create a copy of PostmanCollectionAuthAttribute - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionAuthAttributeImplCopyWith< - _$PostmanCollectionAuthAttributeImpl> - get copyWith => __$$PostmanCollectionAuthAttributeImplCopyWithImpl< - _$PostmanCollectionAuthAttributeImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function(String key, Object? value, String? type) $default, - ) { - return $default(key, value, type); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String key, Object? value, String? type)? $default, - ) { - return $default?.call(key, value, type); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String key, Object? value, String? type)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(key, value, type); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionAuthAttribute value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionAuthAttribute value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionAuthAttribute value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionAuthAttributeImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionAuthAttribute - extends PostmanCollectionAuthAttribute { - const factory _PostmanCollectionAuthAttribute( - {required final String key, - final Object? value, - final String? type}) = _$PostmanCollectionAuthAttributeImpl; - const _PostmanCollectionAuthAttribute._() : super._(); - - factory _PostmanCollectionAuthAttribute.fromJson(Map json) = - _$PostmanCollectionAuthAttributeImpl.fromJson; - - @override - String get key; - @override - Object? get value; - @override - String? get type; - - /// Create a copy of PostmanCollectionAuthAttribute - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionAuthAttributeImplCopyWith< - _$PostmanCollectionAuthAttributeImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionRequest _$PostmanCollectionRequestFromJson( - Map json) { - return _PostmanCollectionRequest.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionRequest { - PostmanCollectionAuth? get auth => throw _privateConstructorUsedError; - String get method => throw _privateConstructorUsedError; - PostmanCollectionProxyConfig? get proxy => throw _privateConstructorUsedError; - PostmanCollectionCertificate? get certificate => - throw _privateConstructorUsedError; - List? get header => - throw _privateConstructorUsedError; - PostmanCollectionRequestMode? get body => throw _privateConstructorUsedError; - PostmanCollectionUrl? get url => throw _privateConstructorUsedError; - String? get description => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - PostmanCollectionAuth? auth, - String method, - PostmanCollectionProxyConfig? proxy, - PostmanCollectionCertificate? certificate, - List? header, - PostmanCollectionRequestMode? body, - PostmanCollectionUrl? url, - String? description) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - PostmanCollectionAuth? auth, - String method, - PostmanCollectionProxyConfig? proxy, - PostmanCollectionCertificate? certificate, - List? header, - PostmanCollectionRequestMode? body, - PostmanCollectionUrl? url, - String? description)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - PostmanCollectionAuth? auth, - String method, - PostmanCollectionProxyConfig? proxy, - PostmanCollectionCertificate? certificate, - List? header, - PostmanCollectionRequestMode? body, - PostmanCollectionUrl? url, - String? description)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionRequest value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionRequest value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionRequest value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionRequest to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionRequest - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionRequestCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionRequestCopyWith<$Res> { - factory $PostmanCollectionRequestCopyWith(PostmanCollectionRequest value, - $Res Function(PostmanCollectionRequest) then) = - _$PostmanCollectionRequestCopyWithImpl<$Res, PostmanCollectionRequest>; - @useResult - $Res call( - {PostmanCollectionAuth? auth, - String method, - PostmanCollectionProxyConfig? proxy, - PostmanCollectionCertificate? certificate, - List? header, - PostmanCollectionRequestMode? body, - PostmanCollectionUrl? url, - String? description}); - - $PostmanCollectionAuthCopyWith<$Res>? get auth; - $PostmanCollectionProxyConfigCopyWith<$Res>? get proxy; - $PostmanCollectionCertificateCopyWith<$Res>? get certificate; - $PostmanCollectionRequestModeCopyWith<$Res>? get body; - $PostmanCollectionUrlCopyWith<$Res>? get url; -} - -/// @nodoc -class _$PostmanCollectionRequestCopyWithImpl<$Res, - $Val extends PostmanCollectionRequest> - implements $PostmanCollectionRequestCopyWith<$Res> { - _$PostmanCollectionRequestCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionRequest - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? auth = freezed, - Object? method = null, - Object? proxy = freezed, - Object? certificate = freezed, - Object? header = freezed, - Object? body = freezed, - Object? url = freezed, - Object? description = freezed, - }) { - return _then(_value.copyWith( - auth: freezed == auth - ? _value.auth - : auth // ignore: cast_nullable_to_non_nullable - as PostmanCollectionAuth?, - method: null == method - ? _value.method - : method // ignore: cast_nullable_to_non_nullable - as String, - proxy: freezed == proxy - ? _value.proxy - : proxy // ignore: cast_nullable_to_non_nullable - as PostmanCollectionProxyConfig?, - certificate: freezed == certificate - ? _value.certificate - : certificate // ignore: cast_nullable_to_non_nullable - as PostmanCollectionCertificate?, - header: freezed == header - ? _value.header - : header // ignore: cast_nullable_to_non_nullable - as List?, - body: freezed == body - ? _value.body - : body // ignore: cast_nullable_to_non_nullable - as PostmanCollectionRequestMode?, - url: freezed == url - ? _value.url - : url // ignore: cast_nullable_to_non_nullable - as PostmanCollectionUrl?, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } - - /// Create a copy of PostmanCollectionRequest - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionAuthCopyWith<$Res>? get auth { - if (_value.auth == null) { - return null; - } - - return $PostmanCollectionAuthCopyWith<$Res>(_value.auth!, (value) { - return _then(_value.copyWith(auth: value) as $Val); - }); - } - - /// Create a copy of PostmanCollectionRequest - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionProxyConfigCopyWith<$Res>? get proxy { - if (_value.proxy == null) { - return null; - } - - return $PostmanCollectionProxyConfigCopyWith<$Res>(_value.proxy!, (value) { - return _then(_value.copyWith(proxy: value) as $Val); - }); - } - - /// Create a copy of PostmanCollectionRequest - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionCertificateCopyWith<$Res>? get certificate { - if (_value.certificate == null) { - return null; - } - - return $PostmanCollectionCertificateCopyWith<$Res>(_value.certificate!, - (value) { - return _then(_value.copyWith(certificate: value) as $Val); - }); - } - - /// Create a copy of PostmanCollectionRequest - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionRequestModeCopyWith<$Res>? get body { - if (_value.body == null) { - return null; - } - - return $PostmanCollectionRequestModeCopyWith<$Res>(_value.body!, (value) { - return _then(_value.copyWith(body: value) as $Val); - }); - } - - /// Create a copy of PostmanCollectionRequest - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionUrlCopyWith<$Res>? get url { - if (_value.url == null) { - return null; - } - - return $PostmanCollectionUrlCopyWith<$Res>(_value.url!, (value) { - return _then(_value.copyWith(url: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionRequestImplCopyWith<$Res> - implements $PostmanCollectionRequestCopyWith<$Res> { - factory _$$PostmanCollectionRequestImplCopyWith( - _$PostmanCollectionRequestImpl value, - $Res Function(_$PostmanCollectionRequestImpl) then) = - __$$PostmanCollectionRequestImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {PostmanCollectionAuth? auth, - String method, - PostmanCollectionProxyConfig? proxy, - PostmanCollectionCertificate? certificate, - List? header, - PostmanCollectionRequestMode? body, - PostmanCollectionUrl? url, - String? description}); - - @override - $PostmanCollectionAuthCopyWith<$Res>? get auth; - @override - $PostmanCollectionProxyConfigCopyWith<$Res>? get proxy; - @override - $PostmanCollectionCertificateCopyWith<$Res>? get certificate; - @override - $PostmanCollectionRequestModeCopyWith<$Res>? get body; - @override - $PostmanCollectionUrlCopyWith<$Res>? get url; -} - -/// @nodoc -class __$$PostmanCollectionRequestImplCopyWithImpl<$Res> - extends _$PostmanCollectionRequestCopyWithImpl<$Res, - _$PostmanCollectionRequestImpl> - implements _$$PostmanCollectionRequestImplCopyWith<$Res> { - __$$PostmanCollectionRequestImplCopyWithImpl( - _$PostmanCollectionRequestImpl _value, - $Res Function(_$PostmanCollectionRequestImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionRequest - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? auth = freezed, - Object? method = null, - Object? proxy = freezed, - Object? certificate = freezed, - Object? header = freezed, - Object? body = freezed, - Object? url = freezed, - Object? description = freezed, - }) { - return _then(_$PostmanCollectionRequestImpl( - auth: freezed == auth - ? _value.auth - : auth // ignore: cast_nullable_to_non_nullable - as PostmanCollectionAuth?, - method: null == method - ? _value.method - : method // ignore: cast_nullable_to_non_nullable - as String, - proxy: freezed == proxy - ? _value.proxy - : proxy // ignore: cast_nullable_to_non_nullable - as PostmanCollectionProxyConfig?, - certificate: freezed == certificate - ? _value.certificate - : certificate // ignore: cast_nullable_to_non_nullable - as PostmanCollectionCertificate?, - header: freezed == header - ? _value._header - : header // ignore: cast_nullable_to_non_nullable - as List?, - body: freezed == body - ? _value.body - : body // ignore: cast_nullable_to_non_nullable - as PostmanCollectionRequestMode?, - url: freezed == url - ? _value.url - : url // ignore: cast_nullable_to_non_nullable - as PostmanCollectionUrl?, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionRequestImpl extends _PostmanCollectionRequest { - const _$PostmanCollectionRequestImpl( - {this.auth, - required this.method, - this.proxy, - this.certificate, - final List? header, - this.body, - this.url, - this.description}) - : _header = header, - super._(); - - factory _$PostmanCollectionRequestImpl.fromJson(Map json) => - _$$PostmanCollectionRequestImplFromJson(json); - - @override - final PostmanCollectionAuth? auth; - @override - final String method; - @override - final PostmanCollectionProxyConfig? proxy; - @override - final PostmanCollectionCertificate? certificate; - final List? _header; - @override - List? get header { - final value = _header; - if (value == null) return null; - if (_header is EqualUnmodifiableListView) return _header; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - final PostmanCollectionRequestMode? body; - @override - final PostmanCollectionUrl? url; - @override - final String? description; - - @override - String toString() { - return 'PostmanCollectionRequest(auth: $auth, method: $method, proxy: $proxy, certificate: $certificate, header: $header, body: $body, url: $url, description: $description)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionRequestImpl && - (identical(other.auth, auth) || other.auth == auth) && - (identical(other.method, method) || other.method == method) && - (identical(other.proxy, proxy) || other.proxy == proxy) && - (identical(other.certificate, certificate) || - other.certificate == certificate) && - const DeepCollectionEquality().equals(other._header, _header) && - (identical(other.body, body) || other.body == body) && - (identical(other.url, url) || other.url == url) && - (identical(other.description, description) || - other.description == description)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, auth, method, proxy, certificate, - const DeepCollectionEquality().hash(_header), body, url, description); - - /// Create a copy of PostmanCollectionRequest - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionRequestImplCopyWith<_$PostmanCollectionRequestImpl> - get copyWith => __$$PostmanCollectionRequestImplCopyWithImpl< - _$PostmanCollectionRequestImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - PostmanCollectionAuth? auth, - String method, - PostmanCollectionProxyConfig? proxy, - PostmanCollectionCertificate? certificate, - List? header, - PostmanCollectionRequestMode? body, - PostmanCollectionUrl? url, - String? description) - $default, - ) { - return $default( - auth, method, proxy, certificate, header, body, url, description); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - PostmanCollectionAuth? auth, - String method, - PostmanCollectionProxyConfig? proxy, - PostmanCollectionCertificate? certificate, - List? header, - PostmanCollectionRequestMode? body, - PostmanCollectionUrl? url, - String? description)? - $default, - ) { - return $default?.call( - auth, method, proxy, certificate, header, body, url, description); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - PostmanCollectionAuth? auth, - String method, - PostmanCollectionProxyConfig? proxy, - PostmanCollectionCertificate? certificate, - List? header, - PostmanCollectionRequestMode? body, - PostmanCollectionUrl? url, - String? description)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default( - auth, method, proxy, certificate, header, body, url, description); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionRequest value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionRequest value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionRequest value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionRequestImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionRequest extends PostmanCollectionRequest { - const factory _PostmanCollectionRequest( - {final PostmanCollectionAuth? auth, - required final String method, - final PostmanCollectionProxyConfig? proxy, - final PostmanCollectionCertificate? certificate, - final List? header, - final PostmanCollectionRequestMode? body, - final PostmanCollectionUrl? url, - final String? description}) = _$PostmanCollectionRequestImpl; - const _PostmanCollectionRequest._() : super._(); - - factory _PostmanCollectionRequest.fromJson(Map json) = - _$PostmanCollectionRequestImpl.fromJson; - - @override - PostmanCollectionAuth? get auth; - @override - String get method; - @override - PostmanCollectionProxyConfig? get proxy; - @override - PostmanCollectionCertificate? get certificate; - @override - List? get header; - @override - PostmanCollectionRequestMode? get body; - @override - PostmanCollectionUrl? get url; - @override - String? get description; - - /// Create a copy of PostmanCollectionRequest - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionRequestImplCopyWith<_$PostmanCollectionRequestImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionRequestMode _$PostmanCollectionRequestModeFromJson( - Map json) { - switch (json['mode']) { - case 'formdata': - return _PostmanCollectionRequestModeFormdata.fromJson(json); - - default: - return _PostmanCollectionRequestMode.fromJson(json); - } -} - -/// @nodoc -mixin _$PostmanCollectionRequestMode { - @optionalTypeArgs - TResult when({ - required TResult Function(String? raw, Map? options) raw, - required TResult Function(List? formdata) formdata, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(String? raw, Map? options)? raw, - TResult? Function(List? formdata)? formdata, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(String? raw, Map? options)? raw, - TResult Function(List? formdata)? formdata, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(_PostmanCollectionRequestMode value) raw, - required TResult Function(_PostmanCollectionRequestModeFormdata value) - formdata, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_PostmanCollectionRequestMode value)? raw, - TResult? Function(_PostmanCollectionRequestModeFormdata value)? formdata, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_PostmanCollectionRequestMode value)? raw, - TResult Function(_PostmanCollectionRequestModeFormdata value)? formdata, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionRequestMode to a JSON map. - Map toJson() => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionRequestModeCopyWith<$Res> { - factory $PostmanCollectionRequestModeCopyWith( - PostmanCollectionRequestMode value, - $Res Function(PostmanCollectionRequestMode) then) = - _$PostmanCollectionRequestModeCopyWithImpl<$Res, - PostmanCollectionRequestMode>; -} - -/// @nodoc -class _$PostmanCollectionRequestModeCopyWithImpl<$Res, - $Val extends PostmanCollectionRequestMode> - implements $PostmanCollectionRequestModeCopyWith<$Res> { - _$PostmanCollectionRequestModeCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionRequestMode - /// with the given fields replaced by the non-null parameter values. -} - -/// @nodoc -abstract class _$$PostmanCollectionRequestModeImplCopyWith<$Res> { - factory _$$PostmanCollectionRequestModeImplCopyWith( - _$PostmanCollectionRequestModeImpl value, - $Res Function(_$PostmanCollectionRequestModeImpl) then) = - __$$PostmanCollectionRequestModeImplCopyWithImpl<$Res>; - @useResult - $Res call({String? raw, Map? options}); -} - -/// @nodoc -class __$$PostmanCollectionRequestModeImplCopyWithImpl<$Res> - extends _$PostmanCollectionRequestModeCopyWithImpl<$Res, - _$PostmanCollectionRequestModeImpl> - implements _$$PostmanCollectionRequestModeImplCopyWith<$Res> { - __$$PostmanCollectionRequestModeImplCopyWithImpl( - _$PostmanCollectionRequestModeImpl _value, - $Res Function(_$PostmanCollectionRequestModeImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionRequestMode - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? raw = freezed, - Object? options = freezed, - }) { - return _then(_$PostmanCollectionRequestModeImpl( - raw: freezed == raw - ? _value.raw - : raw // ignore: cast_nullable_to_non_nullable - as String?, - options: freezed == options - ? _value._options - : options // ignore: cast_nullable_to_non_nullable - as Map?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionRequestModeImpl extends _PostmanCollectionRequestMode { - const _$PostmanCollectionRequestModeImpl( - {this.raw, final Map? options, final String? $type}) - : _options = options, - $type = $type ?? 'raw', - super._(); - - factory _$PostmanCollectionRequestModeImpl.fromJson( - Map json) => - _$$PostmanCollectionRequestModeImplFromJson(json); - - @override - final String? raw; - final Map? _options; - @override - Map? get options { - final value = _options; - if (value == null) return null; - if (_options is EqualUnmodifiableMapView) return _options; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @JsonKey(name: 'mode') - final String $type; - - @override - String toString() { - return 'PostmanCollectionRequestMode.raw(raw: $raw, options: $options)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionRequestModeImpl && - (identical(other.raw, raw) || other.raw == raw) && - const DeepCollectionEquality().equals(other._options, _options)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, raw, const DeepCollectionEquality().hash(_options)); - - /// Create a copy of PostmanCollectionRequestMode - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionRequestModeImplCopyWith< - _$PostmanCollectionRequestModeImpl> - get copyWith => __$$PostmanCollectionRequestModeImplCopyWithImpl< - _$PostmanCollectionRequestModeImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(String? raw, Map? options) raw, - required TResult Function(List? formdata) formdata, - }) { - return raw(this.raw, options); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(String? raw, Map? options)? raw, - TResult? Function(List? formdata)? formdata, - }) { - return raw?.call(this.raw, options); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(String? raw, Map? options)? raw, - TResult Function(List? formdata)? formdata, - required TResult orElse(), - }) { - if (raw != null) { - return raw(this.raw, options); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_PostmanCollectionRequestMode value) raw, - required TResult Function(_PostmanCollectionRequestModeFormdata value) - formdata, - }) { - return raw(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_PostmanCollectionRequestMode value)? raw, - TResult? Function(_PostmanCollectionRequestModeFormdata value)? formdata, - }) { - return raw?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_PostmanCollectionRequestMode value)? raw, - TResult Function(_PostmanCollectionRequestModeFormdata value)? formdata, - required TResult orElse(), - }) { - if (raw != null) { - return raw(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionRequestModeImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionRequestMode - extends PostmanCollectionRequestMode { - const factory _PostmanCollectionRequestMode( - {final String? raw, final Map? options}) = - _$PostmanCollectionRequestModeImpl; - const _PostmanCollectionRequestMode._() : super._(); - - factory _PostmanCollectionRequestMode.fromJson(Map json) = - _$PostmanCollectionRequestModeImpl.fromJson; - - String? get raw; - Map? get options; - - /// Create a copy of PostmanCollectionRequestMode - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionRequestModeImplCopyWith< - _$PostmanCollectionRequestModeImpl> - get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class _$$PostmanCollectionRequestModeFormdataImplCopyWith<$Res> { - factory _$$PostmanCollectionRequestModeFormdataImplCopyWith( - _$PostmanCollectionRequestModeFormdataImpl value, - $Res Function(_$PostmanCollectionRequestModeFormdataImpl) then) = - __$$PostmanCollectionRequestModeFormdataImplCopyWithImpl<$Res>; - @useResult - $Res call({List? formdata}); -} - -/// @nodoc -class __$$PostmanCollectionRequestModeFormdataImplCopyWithImpl<$Res> - extends _$PostmanCollectionRequestModeCopyWithImpl<$Res, - _$PostmanCollectionRequestModeFormdataImpl> - implements _$$PostmanCollectionRequestModeFormdataImplCopyWith<$Res> { - __$$PostmanCollectionRequestModeFormdataImplCopyWithImpl( - _$PostmanCollectionRequestModeFormdataImpl _value, - $Res Function(_$PostmanCollectionRequestModeFormdataImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionRequestMode - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? formdata = freezed, - }) { - return _then(_$PostmanCollectionRequestModeFormdataImpl( - formdata: freezed == formdata - ? _value._formdata - : formdata // ignore: cast_nullable_to_non_nullable - as List?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionRequestModeFormdataImpl - extends _PostmanCollectionRequestModeFormdata { - const _$PostmanCollectionRequestModeFormdataImpl( - {final List? formdata, final String? $type}) - : _formdata = formdata, - $type = $type ?? 'formdata', - super._(); - - factory _$PostmanCollectionRequestModeFormdataImpl.fromJson( - Map json) => - _$$PostmanCollectionRequestModeFormdataImplFromJson(json); - - final List? _formdata; - @override - List? get formdata { - final value = _formdata; - if (value == null) return null; - if (_formdata is EqualUnmodifiableListView) return _formdata; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @JsonKey(name: 'mode') - final String $type; - - @override - String toString() { - return 'PostmanCollectionRequestMode.formdata(formdata: $formdata)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionRequestModeFormdataImpl && - const DeepCollectionEquality().equals(other._formdata, _formdata)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(_formdata)); - - /// Create a copy of PostmanCollectionRequestMode - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionRequestModeFormdataImplCopyWith< - _$PostmanCollectionRequestModeFormdataImpl> - get copyWith => __$$PostmanCollectionRequestModeFormdataImplCopyWithImpl< - _$PostmanCollectionRequestModeFormdataImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(String? raw, Map? options) raw, - required TResult Function(List? formdata) formdata, - }) { - return formdata(this.formdata); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(String? raw, Map? options)? raw, - TResult? Function(List? formdata)? formdata, - }) { - return formdata?.call(this.formdata); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(String? raw, Map? options)? raw, - TResult Function(List? formdata)? formdata, - required TResult orElse(), - }) { - if (formdata != null) { - return formdata(this.formdata); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_PostmanCollectionRequestMode value) raw, - required TResult Function(_PostmanCollectionRequestModeFormdata value) - formdata, - }) { - return formdata(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_PostmanCollectionRequestMode value)? raw, - TResult? Function(_PostmanCollectionRequestModeFormdata value)? formdata, - }) { - return formdata?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_PostmanCollectionRequestMode value)? raw, - TResult Function(_PostmanCollectionRequestModeFormdata value)? formdata, - required TResult orElse(), - }) { - if (formdata != null) { - return formdata(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionRequestModeFormdataImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionRequestModeFormdata - extends PostmanCollectionRequestMode { - const factory _PostmanCollectionRequestModeFormdata( - {final List? formdata}) = - _$PostmanCollectionRequestModeFormdataImpl; - const _PostmanCollectionRequestModeFormdata._() : super._(); - - factory _PostmanCollectionRequestModeFormdata.fromJson( - Map json) = - _$PostmanCollectionRequestModeFormdataImpl.fromJson; - - List? get formdata; - - /// Create a copy of PostmanCollectionRequestMode - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionRequestModeFormdataImplCopyWith< - _$PostmanCollectionRequestModeFormdataImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanFormDataEntry _$PostmanFormDataEntryFromJson(Map json) { - return _PostmanFormDataEntry.fromJson(json); -} - -/// @nodoc -mixin _$PostmanFormDataEntry { - String get key => throw _privateConstructorUsedError; - String? get src => throw _privateConstructorUsedError; - String? get value => throw _privateConstructorUsedError; - String? get type => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function(String key, String? src, String? value, String? type) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String key, String? src, String? value, String? type)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String key, String? src, String? value, String? type)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanFormDataEntry value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanFormDataEntry value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanFormDataEntry value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanFormDataEntry to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanFormDataEntry - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanFormDataEntryCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanFormDataEntryCopyWith<$Res> { - factory $PostmanFormDataEntryCopyWith(PostmanFormDataEntry value, - $Res Function(PostmanFormDataEntry) then) = - _$PostmanFormDataEntryCopyWithImpl<$Res, PostmanFormDataEntry>; - @useResult - $Res call({String key, String? src, String? value, String? type}); -} - -/// @nodoc -class _$PostmanFormDataEntryCopyWithImpl<$Res, - $Val extends PostmanFormDataEntry> - implements $PostmanFormDataEntryCopyWith<$Res> { - _$PostmanFormDataEntryCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanFormDataEntry - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? key = null, - Object? src = freezed, - Object? value = freezed, - Object? type = freezed, - }) { - return _then(_value.copyWith( - key: null == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String, - src: freezed == src - ? _value.src - : src // ignore: cast_nullable_to_non_nullable - as String?, - value: freezed == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String?, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PostmanFormDataEntryImplCopyWith<$Res> - implements $PostmanFormDataEntryCopyWith<$Res> { - factory _$$PostmanFormDataEntryImplCopyWith(_$PostmanFormDataEntryImpl value, - $Res Function(_$PostmanFormDataEntryImpl) then) = - __$$PostmanFormDataEntryImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String key, String? src, String? value, String? type}); -} - -/// @nodoc -class __$$PostmanFormDataEntryImplCopyWithImpl<$Res> - extends _$PostmanFormDataEntryCopyWithImpl<$Res, _$PostmanFormDataEntryImpl> - implements _$$PostmanFormDataEntryImplCopyWith<$Res> { - __$$PostmanFormDataEntryImplCopyWithImpl(_$PostmanFormDataEntryImpl _value, - $Res Function(_$PostmanFormDataEntryImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanFormDataEntry - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? key = null, - Object? src = freezed, - Object? value = freezed, - Object? type = freezed, - }) { - return _then(_$PostmanFormDataEntryImpl( - key: null == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String, - src: freezed == src - ? _value.src - : src // ignore: cast_nullable_to_non_nullable - as String?, - value: freezed == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String?, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanFormDataEntryImpl extends _PostmanFormDataEntry { - const _$PostmanFormDataEntryImpl( - {required this.key, this.src, this.value, this.type}) - : super._(); - - factory _$PostmanFormDataEntryImpl.fromJson(Map json) => - _$$PostmanFormDataEntryImplFromJson(json); - - @override - final String key; - @override - final String? src; - @override - final String? value; - @override - final String? type; - - @override - String toString() { - return 'PostmanFormDataEntry(key: $key, src: $src, value: $value, type: $type)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanFormDataEntryImpl && - (identical(other.key, key) || other.key == key) && - (identical(other.src, src) || other.src == src) && - (identical(other.value, value) || other.value == value) && - (identical(other.type, type) || other.type == type)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, key, src, value, type); - - /// Create a copy of PostmanFormDataEntry - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanFormDataEntryImplCopyWith<_$PostmanFormDataEntryImpl> - get copyWith => - __$$PostmanFormDataEntryImplCopyWithImpl<_$PostmanFormDataEntryImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function(String key, String? src, String? value, String? type) - $default, - ) { - return $default(key, src, value, type); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String key, String? src, String? value, String? type)? - $default, - ) { - return $default?.call(key, src, value, type); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String key, String? src, String? value, String? type)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(key, src, value, type); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanFormDataEntry value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanFormDataEntry value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanFormDataEntry value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanFormDataEntryImplToJson( - this, - ); - } -} - -abstract class _PostmanFormDataEntry extends PostmanFormDataEntry { - const factory _PostmanFormDataEntry( - {required final String key, - final String? src, - final String? value, - final String? type}) = _$PostmanFormDataEntryImpl; - const _PostmanFormDataEntry._() : super._(); - - factory _PostmanFormDataEntry.fromJson(Map json) = - _$PostmanFormDataEntryImpl.fromJson; - - @override - String get key; - @override - String? get src; - @override - String? get value; - @override - String? get type; - - /// Create a copy of PostmanFormDataEntry - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanFormDataEntryImplCopyWith<_$PostmanFormDataEntryImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionUrl _$PostmanCollectionUrlFromJson(Map json) { - return _PostmanCollectionUrl.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionUrl { - String? get raw => throw _privateConstructorUsedError; - String? get protocol => throw _privateConstructorUsedError; - Object? get host => throw _privateConstructorUsedError; - Object? get path => throw _privateConstructorUsedError; - String? get port => throw _privateConstructorUsedError; - List? get query => - throw _privateConstructorUsedError; - String? get hash => throw _privateConstructorUsedError; - List? get variable => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - String? raw, - String? protocol, - Object? host, - Object? path, - String? port, - List? query, - String? hash, - List? variable) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? raw, - String? protocol, - Object? host, - Object? path, - String? port, - List? query, - String? hash, - List? variable)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? raw, - String? protocol, - Object? host, - Object? path, - String? port, - List? query, - String? hash, - List? variable)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionUrl value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionUrl value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionUrl value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionUrl to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionUrl - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionUrlCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionUrlCopyWith<$Res> { - factory $PostmanCollectionUrlCopyWith(PostmanCollectionUrl value, - $Res Function(PostmanCollectionUrl) then) = - _$PostmanCollectionUrlCopyWithImpl<$Res, PostmanCollectionUrl>; - @useResult - $Res call( - {String? raw, - String? protocol, - Object? host, - Object? path, - String? port, - List? query, - String? hash, - List? variable}); -} - -/// @nodoc -class _$PostmanCollectionUrlCopyWithImpl<$Res, - $Val extends PostmanCollectionUrl> - implements $PostmanCollectionUrlCopyWith<$Res> { - _$PostmanCollectionUrlCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionUrl - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? raw = freezed, - Object? protocol = freezed, - Object? host = freezed, - Object? path = freezed, - Object? port = freezed, - Object? query = freezed, - Object? hash = freezed, - Object? variable = freezed, - }) { - return _then(_value.copyWith( - raw: freezed == raw - ? _value.raw - : raw // ignore: cast_nullable_to_non_nullable - as String?, - protocol: freezed == protocol - ? _value.protocol - : protocol // ignore: cast_nullable_to_non_nullable - as String?, - host: freezed == host ? _value.host : host, - path: freezed == path ? _value.path : path, - port: freezed == port - ? _value.port - : port // ignore: cast_nullable_to_non_nullable - as String?, - query: freezed == query - ? _value.query - : query // ignore: cast_nullable_to_non_nullable - as List?, - hash: freezed == hash - ? _value.hash - : hash // ignore: cast_nullable_to_non_nullable - as String?, - variable: freezed == variable - ? _value.variable - : variable // ignore: cast_nullable_to_non_nullable - as List?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionUrlImplCopyWith<$Res> - implements $PostmanCollectionUrlCopyWith<$Res> { - factory _$$PostmanCollectionUrlImplCopyWith(_$PostmanCollectionUrlImpl value, - $Res Function(_$PostmanCollectionUrlImpl) then) = - __$$PostmanCollectionUrlImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? raw, - String? protocol, - Object? host, - Object? path, - String? port, - List? query, - String? hash, - List? variable}); -} - -/// @nodoc -class __$$PostmanCollectionUrlImplCopyWithImpl<$Res> - extends _$PostmanCollectionUrlCopyWithImpl<$Res, _$PostmanCollectionUrlImpl> - implements _$$PostmanCollectionUrlImplCopyWith<$Res> { - __$$PostmanCollectionUrlImplCopyWithImpl(_$PostmanCollectionUrlImpl _value, - $Res Function(_$PostmanCollectionUrlImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionUrl - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? raw = freezed, - Object? protocol = freezed, - Object? host = freezed, - Object? path = freezed, - Object? port = freezed, - Object? query = freezed, - Object? hash = freezed, - Object? variable = freezed, - }) { - return _then(_$PostmanCollectionUrlImpl( - raw: freezed == raw - ? _value.raw - : raw // ignore: cast_nullable_to_non_nullable - as String?, - protocol: freezed == protocol - ? _value.protocol - : protocol // ignore: cast_nullable_to_non_nullable - as String?, - host: freezed == host ? _value.host : host, - path: freezed == path ? _value.path : path, - port: freezed == port - ? _value.port - : port // ignore: cast_nullable_to_non_nullable - as String?, - query: freezed == query - ? _value._query - : query // ignore: cast_nullable_to_non_nullable - as List?, - hash: freezed == hash - ? _value.hash - : hash // ignore: cast_nullable_to_non_nullable - as String?, - variable: freezed == variable - ? _value._variable - : variable // ignore: cast_nullable_to_non_nullable - as List?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionUrlImpl extends _PostmanCollectionUrl { - const _$PostmanCollectionUrlImpl( - {this.raw, - this.protocol, - this.host, - this.path, - this.port, - final List? query, - this.hash, - final List? variable}) - : _query = query, - _variable = variable, - super._(); - - factory _$PostmanCollectionUrlImpl.fromJson(Map json) => - _$$PostmanCollectionUrlImplFromJson(json); - - @override - final String? raw; - @override - final String? protocol; - @override - final Object? host; - @override - final Object? path; - @override - final String? port; - final List? _query; - @override - List? get query { - final value = _query; - if (value == null) return null; - if (_query is EqualUnmodifiableListView) return _query; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - final String? hash; - final List? _variable; - @override - List? get variable { - final value = _variable; - if (value == null) return null; - if (_variable is EqualUnmodifiableListView) return _variable; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - String toString() { - return 'PostmanCollectionUrl(raw: $raw, protocol: $protocol, host: $host, path: $path, port: $port, query: $query, hash: $hash, variable: $variable)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionUrlImpl && - (identical(other.raw, raw) || other.raw == raw) && - (identical(other.protocol, protocol) || - other.protocol == protocol) && - const DeepCollectionEquality().equals(other.host, host) && - const DeepCollectionEquality().equals(other.path, path) && - (identical(other.port, port) || other.port == port) && - const DeepCollectionEquality().equals(other._query, _query) && - (identical(other.hash, hash) || other.hash == hash) && - const DeepCollectionEquality().equals(other._variable, _variable)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - raw, - protocol, - const DeepCollectionEquality().hash(host), - const DeepCollectionEquality().hash(path), - port, - const DeepCollectionEquality().hash(_query), - hash, - const DeepCollectionEquality().hash(_variable)); - - /// Create a copy of PostmanCollectionUrl - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionUrlImplCopyWith<_$PostmanCollectionUrlImpl> - get copyWith => - __$$PostmanCollectionUrlImplCopyWithImpl<_$PostmanCollectionUrlImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - String? raw, - String? protocol, - Object? host, - Object? path, - String? port, - List? query, - String? hash, - List? variable) - $default, - ) { - return $default(raw, protocol, host, path, port, query, hash, variable); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? raw, - String? protocol, - Object? host, - Object? path, - String? port, - List? query, - String? hash, - List? variable)? - $default, - ) { - return $default?.call( - raw, protocol, host, path, port, query, hash, variable); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? raw, - String? protocol, - Object? host, - Object? path, - String? port, - List? query, - String? hash, - List? variable)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(raw, protocol, host, path, port, query, hash, variable); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionUrl value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionUrl value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionUrl value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionUrlImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionUrl extends PostmanCollectionUrl { - const factory _PostmanCollectionUrl( - {final String? raw, - final String? protocol, - final Object? host, - final Object? path, - final String? port, - final List? query, - final String? hash, - final List? variable}) = - _$PostmanCollectionUrlImpl; - const _PostmanCollectionUrl._() : super._(); - - factory _PostmanCollectionUrl.fromJson(Map json) = - _$PostmanCollectionUrlImpl.fromJson; - - @override - String? get raw; - @override - String? get protocol; - @override - Object? get host; - @override - Object? get path; - @override - String? get port; - @override - List? get query; - @override - String? get hash; - @override - List? get variable; - - /// Create a copy of PostmanCollectionUrl - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionUrlImplCopyWith<_$PostmanCollectionUrlImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionQueryParam _$PostmanCollectionQueryParamFromJson( - Map json) { - return _PostmanCollectionQueryParam.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionQueryParam { - String? get key => throw _privateConstructorUsedError; - String? get value => throw _privateConstructorUsedError; - bool? get disabled => throw _privateConstructorUsedError; - String? get description => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - String? key, String? value, bool? disabled, String? description) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? key, String? value, bool? disabled, String? description)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? key, String? value, bool? disabled, String? description)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionQueryParam value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionQueryParam value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionQueryParam value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionQueryParam to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionQueryParam - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionQueryParamCopyWith - get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionQueryParamCopyWith<$Res> { - factory $PostmanCollectionQueryParamCopyWith( - PostmanCollectionQueryParam value, - $Res Function(PostmanCollectionQueryParam) then) = - _$PostmanCollectionQueryParamCopyWithImpl<$Res, - PostmanCollectionQueryParam>; - @useResult - $Res call({String? key, String? value, bool? disabled, String? description}); -} - -/// @nodoc -class _$PostmanCollectionQueryParamCopyWithImpl<$Res, - $Val extends PostmanCollectionQueryParam> - implements $PostmanCollectionQueryParamCopyWith<$Res> { - _$PostmanCollectionQueryParamCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionQueryParam - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? key = freezed, - Object? value = freezed, - Object? disabled = freezed, - Object? description = freezed, - }) { - return _then(_value.copyWith( - key: freezed == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String?, - value: freezed == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String?, - disabled: freezed == disabled - ? _value.disabled - : disabled // ignore: cast_nullable_to_non_nullable - as bool?, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionQueryParamImplCopyWith<$Res> - implements $PostmanCollectionQueryParamCopyWith<$Res> { - factory _$$PostmanCollectionQueryParamImplCopyWith( - _$PostmanCollectionQueryParamImpl value, - $Res Function(_$PostmanCollectionQueryParamImpl) then) = - __$$PostmanCollectionQueryParamImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String? key, String? value, bool? disabled, String? description}); -} - -/// @nodoc -class __$$PostmanCollectionQueryParamImplCopyWithImpl<$Res> - extends _$PostmanCollectionQueryParamCopyWithImpl<$Res, - _$PostmanCollectionQueryParamImpl> - implements _$$PostmanCollectionQueryParamImplCopyWith<$Res> { - __$$PostmanCollectionQueryParamImplCopyWithImpl( - _$PostmanCollectionQueryParamImpl _value, - $Res Function(_$PostmanCollectionQueryParamImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionQueryParam - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? key = freezed, - Object? value = freezed, - Object? disabled = freezed, - Object? description = freezed, - }) { - return _then(_$PostmanCollectionQueryParamImpl( - key: freezed == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String?, - value: freezed == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String?, - disabled: freezed == disabled - ? _value.disabled - : disabled // ignore: cast_nullable_to_non_nullable - as bool?, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionQueryParamImpl extends _PostmanCollectionQueryParam { - const _$PostmanCollectionQueryParamImpl( - {this.key, this.value, this.disabled, this.description}) - : super._(); - - factory _$PostmanCollectionQueryParamImpl.fromJson( - Map json) => - _$$PostmanCollectionQueryParamImplFromJson(json); - - @override - final String? key; - @override - final String? value; - @override - final bool? disabled; - @override - final String? description; - - @override - String toString() { - return 'PostmanCollectionQueryParam(key: $key, value: $value, disabled: $disabled, description: $description)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionQueryParamImpl && - (identical(other.key, key) || other.key == key) && - (identical(other.value, value) || other.value == value) && - (identical(other.disabled, disabled) || - other.disabled == disabled) && - (identical(other.description, description) || - other.description == description)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, key, value, disabled, description); - - /// Create a copy of PostmanCollectionQueryParam - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionQueryParamImplCopyWith<_$PostmanCollectionQueryParamImpl> - get copyWith => __$$PostmanCollectionQueryParamImplCopyWithImpl< - _$PostmanCollectionQueryParamImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - String? key, String? value, bool? disabled, String? description) - $default, - ) { - return $default(key, value, disabled, description); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? key, String? value, bool? disabled, String? description)? - $default, - ) { - return $default?.call(key, value, disabled, description); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? key, String? value, bool? disabled, String? description)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(key, value, disabled, description); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionQueryParam value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionQueryParam value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionQueryParam value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionQueryParamImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionQueryParam - extends PostmanCollectionQueryParam { - const factory _PostmanCollectionQueryParam( - {final String? key, - final String? value, - final bool? disabled, - final String? description}) = _$PostmanCollectionQueryParamImpl; - const _PostmanCollectionQueryParam._() : super._(); - - factory _PostmanCollectionQueryParam.fromJson(Map json) = - _$PostmanCollectionQueryParamImpl.fromJson; - - @override - String? get key; - @override - String? get value; - @override - bool? get disabled; - @override - String? get description; - - /// Create a copy of PostmanCollectionQueryParam - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionQueryParamImplCopyWith<_$PostmanCollectionQueryParamImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionVariable _$PostmanCollectionVariableFromJson( - Map json) { - return _PostmanCollectionVariable.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionVariable { - String? get id => throw _privateConstructorUsedError; - String? get key => throw _privateConstructorUsedError; - Object? get value => throw _privateConstructorUsedError; - PostmanCollectionVariableType? get type => throw _privateConstructorUsedError; - String? get name => throw _privateConstructorUsedError; - String? get description => throw _privateConstructorUsedError; - bool? get system => throw _privateConstructorUsedError; - bool? get disabled => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - String? id, - String? key, - Object? value, - PostmanCollectionVariableType? type, - String? name, - String? description, - bool? system, - bool? disabled) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? id, - String? key, - Object? value, - PostmanCollectionVariableType? type, - String? name, - String? description, - bool? system, - bool? disabled)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? id, - String? key, - Object? value, - PostmanCollectionVariableType? type, - String? name, - String? description, - bool? system, - bool? disabled)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionVariable value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionVariable value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionVariable value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionVariable to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionVariable - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionVariableCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionVariableCopyWith<$Res> { - factory $PostmanCollectionVariableCopyWith(PostmanCollectionVariable value, - $Res Function(PostmanCollectionVariable) then) = - _$PostmanCollectionVariableCopyWithImpl<$Res, PostmanCollectionVariable>; - @useResult - $Res call( - {String? id, - String? key, - Object? value, - PostmanCollectionVariableType? type, - String? name, - String? description, - bool? system, - bool? disabled}); -} - -/// @nodoc -class _$PostmanCollectionVariableCopyWithImpl<$Res, - $Val extends PostmanCollectionVariable> - implements $PostmanCollectionVariableCopyWith<$Res> { - _$PostmanCollectionVariableCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionVariable - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? key = freezed, - Object? value = freezed, - Object? type = freezed, - Object? name = freezed, - Object? description = freezed, - Object? system = freezed, - Object? disabled = freezed, - }) { - return _then(_value.copyWith( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - key: freezed == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String?, - value: freezed == value ? _value.value : value, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as PostmanCollectionVariableType?, - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - system: freezed == system - ? _value.system - : system // ignore: cast_nullable_to_non_nullable - as bool?, - disabled: freezed == disabled - ? _value.disabled - : disabled // ignore: cast_nullable_to_non_nullable - as bool?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionVariableImplCopyWith<$Res> - implements $PostmanCollectionVariableCopyWith<$Res> { - factory _$$PostmanCollectionVariableImplCopyWith( - _$PostmanCollectionVariableImpl value, - $Res Function(_$PostmanCollectionVariableImpl) then) = - __$$PostmanCollectionVariableImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? id, - String? key, - Object? value, - PostmanCollectionVariableType? type, - String? name, - String? description, - bool? system, - bool? disabled}); -} - -/// @nodoc -class __$$PostmanCollectionVariableImplCopyWithImpl<$Res> - extends _$PostmanCollectionVariableCopyWithImpl<$Res, - _$PostmanCollectionVariableImpl> - implements _$$PostmanCollectionVariableImplCopyWith<$Res> { - __$$PostmanCollectionVariableImplCopyWithImpl( - _$PostmanCollectionVariableImpl _value, - $Res Function(_$PostmanCollectionVariableImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionVariable - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? key = freezed, - Object? value = freezed, - Object? type = freezed, - Object? name = freezed, - Object? description = freezed, - Object? system = freezed, - Object? disabled = freezed, - }) { - return _then(_$PostmanCollectionVariableImpl( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - key: freezed == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String?, - value: freezed == value ? _value.value : value, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as PostmanCollectionVariableType?, - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - system: freezed == system - ? _value.system - : system // ignore: cast_nullable_to_non_nullable - as bool?, - disabled: freezed == disabled - ? _value.disabled - : disabled // ignore: cast_nullable_to_non_nullable - as bool?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionVariableImpl extends _PostmanCollectionVariable { - const _$PostmanCollectionVariableImpl( - {this.id, - this.key, - this.value, - this.type, - this.name, - this.description, - this.system, - this.disabled}) - : super._(); - - factory _$PostmanCollectionVariableImpl.fromJson(Map json) => - _$$PostmanCollectionVariableImplFromJson(json); - - @override - final String? id; - @override - final String? key; - @override - final Object? value; - @override - final PostmanCollectionVariableType? type; - @override - final String? name; - @override - final String? description; - @override - final bool? system; - @override - final bool? disabled; - - @override - String toString() { - return 'PostmanCollectionVariable(id: $id, key: $key, value: $value, type: $type, name: $name, description: $description, system: $system, disabled: $disabled)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionVariableImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.key, key) || other.key == key) && - const DeepCollectionEquality().equals(other.value, value) && - (identical(other.type, type) || other.type == type) && - (identical(other.name, name) || other.name == name) && - (identical(other.description, description) || - other.description == description) && - (identical(other.system, system) || other.system == system) && - (identical(other.disabled, disabled) || - other.disabled == disabled)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - id, - key, - const DeepCollectionEquality().hash(value), - type, - name, - description, - system, - disabled); - - /// Create a copy of PostmanCollectionVariable - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionVariableImplCopyWith<_$PostmanCollectionVariableImpl> - get copyWith => __$$PostmanCollectionVariableImplCopyWithImpl< - _$PostmanCollectionVariableImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - String? id, - String? key, - Object? value, - PostmanCollectionVariableType? type, - String? name, - String? description, - bool? system, - bool? disabled) - $default, - ) { - return $default(id, key, value, type, name, description, system, disabled); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? id, - String? key, - Object? value, - PostmanCollectionVariableType? type, - String? name, - String? description, - bool? system, - bool? disabled)? - $default, - ) { - return $default?.call( - id, key, value, type, name, description, system, disabled); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? id, - String? key, - Object? value, - PostmanCollectionVariableType? type, - String? name, - String? description, - bool? system, - bool? disabled)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default( - id, key, value, type, name, description, system, disabled); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionVariable value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionVariable value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionVariable value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionVariableImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionVariable extends PostmanCollectionVariable { - const factory _PostmanCollectionVariable( - {final String? id, - final String? key, - final Object? value, - final PostmanCollectionVariableType? type, - final String? name, - final String? description, - final bool? system, - final bool? disabled}) = _$PostmanCollectionVariableImpl; - const _PostmanCollectionVariable._() : super._(); - - factory _PostmanCollectionVariable.fromJson(Map json) = - _$PostmanCollectionVariableImpl.fromJson; - - @override - String? get id; - @override - String? get key; - @override - Object? get value; - @override - PostmanCollectionVariableType? get type; - @override - String? get name; - @override - String? get description; - @override - bool? get system; - @override - bool? get disabled; - - /// Create a copy of PostmanCollectionVariable - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionVariableImplCopyWith<_$PostmanCollectionVariableImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionEvent _$PostmanCollectionEventFromJson( - Map json) { - return _PostmanCollectionEvent.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionEvent { - String? get id => throw _privateConstructorUsedError; - String get listen => throw _privateConstructorUsedError; - PostmanCollectionScript? get script => throw _privateConstructorUsedError; - bool? get disabled => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function(String? id, String listen, PostmanCollectionScript? script, - bool? disabled) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String? id, String listen, - PostmanCollectionScript? script, bool? disabled)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String? id, String listen, PostmanCollectionScript? script, - bool? disabled)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionEvent value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionEvent value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionEvent value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionEvent to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionEvent - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionEventCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionEventCopyWith<$Res> { - factory $PostmanCollectionEventCopyWith(PostmanCollectionEvent value, - $Res Function(PostmanCollectionEvent) then) = - _$PostmanCollectionEventCopyWithImpl<$Res, PostmanCollectionEvent>; - @useResult - $Res call( - {String? id, - String listen, - PostmanCollectionScript? script, - bool? disabled}); - - $PostmanCollectionScriptCopyWith<$Res>? get script; -} - -/// @nodoc -class _$PostmanCollectionEventCopyWithImpl<$Res, - $Val extends PostmanCollectionEvent> - implements $PostmanCollectionEventCopyWith<$Res> { - _$PostmanCollectionEventCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionEvent - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? listen = null, - Object? script = freezed, - Object? disabled = freezed, - }) { - return _then(_value.copyWith( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - listen: null == listen - ? _value.listen - : listen // ignore: cast_nullable_to_non_nullable - as String, - script: freezed == script - ? _value.script - : script // ignore: cast_nullable_to_non_nullable - as PostmanCollectionScript?, - disabled: freezed == disabled - ? _value.disabled - : disabled // ignore: cast_nullable_to_non_nullable - as bool?, - ) as $Val); - } - - /// Create a copy of PostmanCollectionEvent - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionScriptCopyWith<$Res>? get script { - if (_value.script == null) { - return null; - } - - return $PostmanCollectionScriptCopyWith<$Res>(_value.script!, (value) { - return _then(_value.copyWith(script: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionEventImplCopyWith<$Res> - implements $PostmanCollectionEventCopyWith<$Res> { - factory _$$PostmanCollectionEventImplCopyWith( - _$PostmanCollectionEventImpl value, - $Res Function(_$PostmanCollectionEventImpl) then) = - __$$PostmanCollectionEventImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? id, - String listen, - PostmanCollectionScript? script, - bool? disabled}); - - @override - $PostmanCollectionScriptCopyWith<$Res>? get script; -} - -/// @nodoc -class __$$PostmanCollectionEventImplCopyWithImpl<$Res> - extends _$PostmanCollectionEventCopyWithImpl<$Res, - _$PostmanCollectionEventImpl> - implements _$$PostmanCollectionEventImplCopyWith<$Res> { - __$$PostmanCollectionEventImplCopyWithImpl( - _$PostmanCollectionEventImpl _value, - $Res Function(_$PostmanCollectionEventImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionEvent - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? listen = null, - Object? script = freezed, - Object? disabled = freezed, - }) { - return _then(_$PostmanCollectionEventImpl( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - listen: null == listen - ? _value.listen - : listen // ignore: cast_nullable_to_non_nullable - as String, - script: freezed == script - ? _value.script - : script // ignore: cast_nullable_to_non_nullable - as PostmanCollectionScript?, - disabled: freezed == disabled - ? _value.disabled - : disabled // ignore: cast_nullable_to_non_nullable - as bool?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionEventImpl extends _PostmanCollectionEvent { - const _$PostmanCollectionEventImpl( - {this.id, required this.listen, this.script, this.disabled}) - : super._(); - - factory _$PostmanCollectionEventImpl.fromJson(Map json) => - _$$PostmanCollectionEventImplFromJson(json); - - @override - final String? id; - @override - final String listen; - @override - final PostmanCollectionScript? script; - @override - final bool? disabled; - - @override - String toString() { - return 'PostmanCollectionEvent(id: $id, listen: $listen, script: $script, disabled: $disabled)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionEventImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.listen, listen) || other.listen == listen) && - (identical(other.script, script) || other.script == script) && - (identical(other.disabled, disabled) || - other.disabled == disabled)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, id, listen, script, disabled); - - /// Create a copy of PostmanCollectionEvent - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionEventImplCopyWith<_$PostmanCollectionEventImpl> - get copyWith => __$$PostmanCollectionEventImplCopyWithImpl< - _$PostmanCollectionEventImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function(String? id, String listen, PostmanCollectionScript? script, - bool? disabled) - $default, - ) { - return $default(id, listen, script, disabled); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String? id, String listen, - PostmanCollectionScript? script, bool? disabled)? - $default, - ) { - return $default?.call(id, listen, script, disabled); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String? id, String listen, PostmanCollectionScript? script, - bool? disabled)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(id, listen, script, disabled); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionEvent value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionEvent value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionEvent value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionEventImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionEvent extends PostmanCollectionEvent { - const factory _PostmanCollectionEvent( - {final String? id, - required final String listen, - final PostmanCollectionScript? script, - final bool? disabled}) = _$PostmanCollectionEventImpl; - const _PostmanCollectionEvent._() : super._(); - - factory _PostmanCollectionEvent.fromJson(Map json) = - _$PostmanCollectionEventImpl.fromJson; - - @override - String? get id; - @override - String get listen; - @override - PostmanCollectionScript? get script; - @override - bool? get disabled; - - /// Create a copy of PostmanCollectionEvent - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionEventImplCopyWith<_$PostmanCollectionEventImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionScript _$PostmanCollectionScriptFromJson( - Map json) { - return _PostmanCollectionScript.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionScript { - String? get id => throw _privateConstructorUsedError; - Map? get packages => throw _privateConstructorUsedError; - String? get type => throw _privateConstructorUsedError; - Object? get exec => throw _privateConstructorUsedError; - PostmanCollectionUrl? get src => throw _privateConstructorUsedError; - String? get name => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function(String? id, Map? packages, String? type, - Object? exec, PostmanCollectionUrl? src, String? name) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String? id, Map? packages, String? type, - Object? exec, PostmanCollectionUrl? src, String? name)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String? id, Map? packages, String? type, - Object? exec, PostmanCollectionUrl? src, String? name)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionScript value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionScript value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionScript value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionScript to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionScript - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionScriptCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionScriptCopyWith<$Res> { - factory $PostmanCollectionScriptCopyWith(PostmanCollectionScript value, - $Res Function(PostmanCollectionScript) then) = - _$PostmanCollectionScriptCopyWithImpl<$Res, PostmanCollectionScript>; - @useResult - $Res call( - {String? id, - Map? packages, - String? type, - Object? exec, - PostmanCollectionUrl? src, - String? name}); - - $PostmanCollectionUrlCopyWith<$Res>? get src; -} - -/// @nodoc -class _$PostmanCollectionScriptCopyWithImpl<$Res, - $Val extends PostmanCollectionScript> - implements $PostmanCollectionScriptCopyWith<$Res> { - _$PostmanCollectionScriptCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionScript - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? packages = freezed, - Object? type = freezed, - Object? exec = freezed, - Object? src = freezed, - Object? name = freezed, - }) { - return _then(_value.copyWith( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - packages: freezed == packages - ? _value.packages - : packages // ignore: cast_nullable_to_non_nullable - as Map?, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - exec: freezed == exec ? _value.exec : exec, - src: freezed == src - ? _value.src - : src // ignore: cast_nullable_to_non_nullable - as PostmanCollectionUrl?, - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } - - /// Create a copy of PostmanCollectionScript - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionUrlCopyWith<$Res>? get src { - if (_value.src == null) { - return null; - } - - return $PostmanCollectionUrlCopyWith<$Res>(_value.src!, (value) { - return _then(_value.copyWith(src: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionScriptImplCopyWith<$Res> - implements $PostmanCollectionScriptCopyWith<$Res> { - factory _$$PostmanCollectionScriptImplCopyWith( - _$PostmanCollectionScriptImpl value, - $Res Function(_$PostmanCollectionScriptImpl) then) = - __$$PostmanCollectionScriptImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? id, - Map? packages, - String? type, - Object? exec, - PostmanCollectionUrl? src, - String? name}); - - @override - $PostmanCollectionUrlCopyWith<$Res>? get src; -} - -/// @nodoc -class __$$PostmanCollectionScriptImplCopyWithImpl<$Res> - extends _$PostmanCollectionScriptCopyWithImpl<$Res, - _$PostmanCollectionScriptImpl> - implements _$$PostmanCollectionScriptImplCopyWith<$Res> { - __$$PostmanCollectionScriptImplCopyWithImpl( - _$PostmanCollectionScriptImpl _value, - $Res Function(_$PostmanCollectionScriptImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionScript - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? packages = freezed, - Object? type = freezed, - Object? exec = freezed, - Object? src = freezed, - Object? name = freezed, - }) { - return _then(_$PostmanCollectionScriptImpl( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - packages: freezed == packages - ? _value._packages - : packages // ignore: cast_nullable_to_non_nullable - as Map?, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - exec: freezed == exec ? _value.exec : exec, - src: freezed == src - ? _value.src - : src // ignore: cast_nullable_to_non_nullable - as PostmanCollectionUrl?, - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionScriptImpl extends _PostmanCollectionScript { - const _$PostmanCollectionScriptImpl( - {this.id, - final Map? packages, - this.type, - this.exec, - this.src, - this.name}) - : _packages = packages, - super._(); - - factory _$PostmanCollectionScriptImpl.fromJson(Map json) => - _$$PostmanCollectionScriptImplFromJson(json); - - @override - final String? id; - final Map? _packages; - @override - Map? get packages { - final value = _packages; - if (value == null) return null; - if (_packages is EqualUnmodifiableMapView) return _packages; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final String? type; - @override - final Object? exec; - @override - final PostmanCollectionUrl? src; - @override - final String? name; - - @override - String toString() { - return 'PostmanCollectionScript(id: $id, packages: $packages, type: $type, exec: $exec, src: $src, name: $name)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionScriptImpl && - (identical(other.id, id) || other.id == id) && - const DeepCollectionEquality().equals(other._packages, _packages) && - (identical(other.type, type) || other.type == type) && - const DeepCollectionEquality().equals(other.exec, exec) && - (identical(other.src, src) || other.src == src) && - (identical(other.name, name) || other.name == name)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - id, - const DeepCollectionEquality().hash(_packages), - type, - const DeepCollectionEquality().hash(exec), - src, - name); - - /// Create a copy of PostmanCollectionScript - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionScriptImplCopyWith<_$PostmanCollectionScriptImpl> - get copyWith => __$$PostmanCollectionScriptImplCopyWithImpl< - _$PostmanCollectionScriptImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function(String? id, Map? packages, String? type, - Object? exec, PostmanCollectionUrl? src, String? name) - $default, - ) { - return $default(id, packages, type, exec, src, name); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String? id, Map? packages, String? type, - Object? exec, PostmanCollectionUrl? src, String? name)? - $default, - ) { - return $default?.call(id, packages, type, exec, src, name); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String? id, Map? packages, String? type, - Object? exec, PostmanCollectionUrl? src, String? name)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(id, packages, type, exec, src, name); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionScript value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionScript value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionScript value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionScriptImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionScript extends PostmanCollectionScript { - const factory _PostmanCollectionScript( - {final String? id, - final Map? packages, - final String? type, - final Object? exec, - final PostmanCollectionUrl? src, - final String? name}) = _$PostmanCollectionScriptImpl; - const _PostmanCollectionScript._() : super._(); - - factory _PostmanCollectionScript.fromJson(Map json) = - _$PostmanCollectionScriptImpl.fromJson; - - @override - String? get id; - @override - Map? get packages; - @override - String? get type; - @override - Object? get exec; - @override - PostmanCollectionUrl? get src; - @override - String? get name; - - /// Create a copy of PostmanCollectionScript - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionScriptImplCopyWith<_$PostmanCollectionScriptImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionResponse _$PostmanCollectionResponseFromJson( - Map json) { - return _PostmanCollectionResponse.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionResponse { - String? get name => throw _privateConstructorUsedError; - String? get id => throw _privateConstructorUsedError; - PostmanCollectionRequest? get originalRequest => - throw _privateConstructorUsedError; - @JsonKey(name: '_postman_previewlanguage') - String? get postmanPreviewLanguage => throw _privateConstructorUsedError; - Object? get responseTime => throw _privateConstructorUsedError; - Object? get timings => throw _privateConstructorUsedError; - Object? get header => throw _privateConstructorUsedError; - List? get cookie => - throw _privateConstructorUsedError; - String? get body => throw _privateConstructorUsedError; - String? get status => throw _privateConstructorUsedError; - int? get code => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - String? name, - String? id, - PostmanCollectionRequest? originalRequest, - @JsonKey(name: '_postman_previewlanguage') - String? postmanPreviewLanguage, - Object? responseTime, - Object? timings, - Object? header, - List? cookie, - String? body, - String? status, - int? code) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? name, - String? id, - PostmanCollectionRequest? originalRequest, - @JsonKey(name: '_postman_previewlanguage') - String? postmanPreviewLanguage, - Object? responseTime, - Object? timings, - Object? header, - List? cookie, - String? body, - String? status, - int? code)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? name, - String? id, - PostmanCollectionRequest? originalRequest, - @JsonKey(name: '_postman_previewlanguage') - String? postmanPreviewLanguage, - Object? responseTime, - Object? timings, - Object? header, - List? cookie, - String? body, - String? status, - int? code)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionResponse value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionResponse value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionResponse value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionResponse to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionResponse - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionResponseCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionResponseCopyWith<$Res> { - factory $PostmanCollectionResponseCopyWith(PostmanCollectionResponse value, - $Res Function(PostmanCollectionResponse) then) = - _$PostmanCollectionResponseCopyWithImpl<$Res, PostmanCollectionResponse>; - @useResult - $Res call( - {String? name, - String? id, - PostmanCollectionRequest? originalRequest, - @JsonKey(name: '_postman_previewlanguage') String? postmanPreviewLanguage, - Object? responseTime, - Object? timings, - Object? header, - List? cookie, - String? body, - String? status, - int? code}); - - $PostmanCollectionRequestCopyWith<$Res>? get originalRequest; -} - -/// @nodoc -class _$PostmanCollectionResponseCopyWithImpl<$Res, - $Val extends PostmanCollectionResponse> - implements $PostmanCollectionResponseCopyWith<$Res> { - _$PostmanCollectionResponseCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionResponse - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? name = freezed, - Object? id = freezed, - Object? originalRequest = freezed, - Object? postmanPreviewLanguage = freezed, - Object? responseTime = freezed, - Object? timings = freezed, - Object? header = freezed, - Object? cookie = freezed, - Object? body = freezed, - Object? status = freezed, - Object? code = freezed, - }) { - return _then(_value.copyWith( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - originalRequest: freezed == originalRequest - ? _value.originalRequest - : originalRequest // ignore: cast_nullable_to_non_nullable - as PostmanCollectionRequest?, - postmanPreviewLanguage: freezed == postmanPreviewLanguage - ? _value.postmanPreviewLanguage - : postmanPreviewLanguage // ignore: cast_nullable_to_non_nullable - as String?, - responseTime: - freezed == responseTime ? _value.responseTime : responseTime, - timings: freezed == timings ? _value.timings : timings, - header: freezed == header ? _value.header : header, - cookie: freezed == cookie - ? _value.cookie - : cookie // ignore: cast_nullable_to_non_nullable - as List?, - body: freezed == body - ? _value.body - : body // ignore: cast_nullable_to_non_nullable - as String?, - status: freezed == status - ? _value.status - : status // ignore: cast_nullable_to_non_nullable - as String?, - code: freezed == code - ? _value.code - : code // ignore: cast_nullable_to_non_nullable - as int?, - ) as $Val); - } - - /// Create a copy of PostmanCollectionResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionRequestCopyWith<$Res>? get originalRequest { - if (_value.originalRequest == null) { - return null; - } - - return $PostmanCollectionRequestCopyWith<$Res>(_value.originalRequest!, - (value) { - return _then(_value.copyWith(originalRequest: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionResponseImplCopyWith<$Res> - implements $PostmanCollectionResponseCopyWith<$Res> { - factory _$$PostmanCollectionResponseImplCopyWith( - _$PostmanCollectionResponseImpl value, - $Res Function(_$PostmanCollectionResponseImpl) then) = - __$$PostmanCollectionResponseImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? name, - String? id, - PostmanCollectionRequest? originalRequest, - @JsonKey(name: '_postman_previewlanguage') String? postmanPreviewLanguage, - Object? responseTime, - Object? timings, - Object? header, - List? cookie, - String? body, - String? status, - int? code}); - - @override - $PostmanCollectionRequestCopyWith<$Res>? get originalRequest; -} - -/// @nodoc -class __$$PostmanCollectionResponseImplCopyWithImpl<$Res> - extends _$PostmanCollectionResponseCopyWithImpl<$Res, - _$PostmanCollectionResponseImpl> - implements _$$PostmanCollectionResponseImplCopyWith<$Res> { - __$$PostmanCollectionResponseImplCopyWithImpl( - _$PostmanCollectionResponseImpl _value, - $Res Function(_$PostmanCollectionResponseImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionResponse - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? name = freezed, - Object? id = freezed, - Object? originalRequest = freezed, - Object? postmanPreviewLanguage = freezed, - Object? responseTime = freezed, - Object? timings = freezed, - Object? header = freezed, - Object? cookie = freezed, - Object? body = freezed, - Object? status = freezed, - Object? code = freezed, - }) { - return _then(_$PostmanCollectionResponseImpl( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - originalRequest: freezed == originalRequest - ? _value.originalRequest - : originalRequest // ignore: cast_nullable_to_non_nullable - as PostmanCollectionRequest?, - postmanPreviewLanguage: freezed == postmanPreviewLanguage - ? _value.postmanPreviewLanguage - : postmanPreviewLanguage // ignore: cast_nullable_to_non_nullable - as String?, - responseTime: - freezed == responseTime ? _value.responseTime : responseTime, - timings: freezed == timings ? _value.timings : timings, - header: freezed == header ? _value.header : header, - cookie: freezed == cookie - ? _value._cookie - : cookie // ignore: cast_nullable_to_non_nullable - as List?, - body: freezed == body - ? _value.body - : body // ignore: cast_nullable_to_non_nullable - as String?, - status: freezed == status - ? _value.status - : status // ignore: cast_nullable_to_non_nullable - as String?, - code: freezed == code - ? _value.code - : code // ignore: cast_nullable_to_non_nullable - as int?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionResponseImpl extends _PostmanCollectionResponse { - const _$PostmanCollectionResponseImpl( - {this.name, - this.id, - this.originalRequest, - @JsonKey(name: '_postman_previewlanguage') this.postmanPreviewLanguage, - this.responseTime, - this.timings, - this.header, - final List? cookie, - this.body, - this.status, - this.code}) - : _cookie = cookie, - super._(); - - factory _$PostmanCollectionResponseImpl.fromJson(Map json) => - _$$PostmanCollectionResponseImplFromJson(json); - - @override - final String? name; - @override - final String? id; - @override - final PostmanCollectionRequest? originalRequest; - @override - @JsonKey(name: '_postman_previewlanguage') - final String? postmanPreviewLanguage; - @override - final Object? responseTime; - @override - final Object? timings; - @override - final Object? header; - final List? _cookie; - @override - List? get cookie { - final value = _cookie; - if (value == null) return null; - if (_cookie is EqualUnmodifiableListView) return _cookie; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - final String? body; - @override - final String? status; - @override - final int? code; - - @override - String toString() { - return 'PostmanCollectionResponse(name: $name, id: $id, originalRequest: $originalRequest, postmanPreviewLanguage: $postmanPreviewLanguage, responseTime: $responseTime, timings: $timings, header: $header, cookie: $cookie, body: $body, status: $status, code: $code)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionResponseImpl && - (identical(other.name, name) || other.name == name) && - (identical(other.id, id) || other.id == id) && - (identical(other.originalRequest, originalRequest) || - other.originalRequest == originalRequest) && - (identical(other.postmanPreviewLanguage, postmanPreviewLanguage) || - other.postmanPreviewLanguage == postmanPreviewLanguage) && - const DeepCollectionEquality() - .equals(other.responseTime, responseTime) && - const DeepCollectionEquality().equals(other.timings, timings) && - const DeepCollectionEquality().equals(other.header, header) && - const DeepCollectionEquality().equals(other._cookie, _cookie) && - (identical(other.body, body) || other.body == body) && - (identical(other.status, status) || other.status == status) && - (identical(other.code, code) || other.code == code)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - name, - id, - originalRequest, - postmanPreviewLanguage, - const DeepCollectionEquality().hash(responseTime), - const DeepCollectionEquality().hash(timings), - const DeepCollectionEquality().hash(header), - const DeepCollectionEquality().hash(_cookie), - body, - status, - code); - - /// Create a copy of PostmanCollectionResponse - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionResponseImplCopyWith<_$PostmanCollectionResponseImpl> - get copyWith => __$$PostmanCollectionResponseImplCopyWithImpl< - _$PostmanCollectionResponseImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - String? name, - String? id, - PostmanCollectionRequest? originalRequest, - @JsonKey(name: '_postman_previewlanguage') - String? postmanPreviewLanguage, - Object? responseTime, - Object? timings, - Object? header, - List? cookie, - String? body, - String? status, - int? code) - $default, - ) { - return $default(name, id, originalRequest, postmanPreviewLanguage, - responseTime, timings, header, cookie, body, status, code); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? name, - String? id, - PostmanCollectionRequest? originalRequest, - @JsonKey(name: '_postman_previewlanguage') - String? postmanPreviewLanguage, - Object? responseTime, - Object? timings, - Object? header, - List? cookie, - String? body, - String? status, - int? code)? - $default, - ) { - return $default?.call(name, id, originalRequest, postmanPreviewLanguage, - responseTime, timings, header, cookie, body, status, code); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? name, - String? id, - PostmanCollectionRequest? originalRequest, - @JsonKey(name: '_postman_previewlanguage') - String? postmanPreviewLanguage, - Object? responseTime, - Object? timings, - Object? header, - List? cookie, - String? body, - String? status, - int? code)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(name, id, originalRequest, postmanPreviewLanguage, - responseTime, timings, header, cookie, body, status, code); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionResponse value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionResponse value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionResponse value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionResponseImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionResponse extends PostmanCollectionResponse { - const factory _PostmanCollectionResponse( - {final String? name, - final String? id, - final PostmanCollectionRequest? originalRequest, - @JsonKey(name: '_postman_previewlanguage') - final String? postmanPreviewLanguage, - final Object? responseTime, - final Object? timings, - final Object? header, - final List? cookie, - final String? body, - final String? status, - final int? code}) = _$PostmanCollectionResponseImpl; - const _PostmanCollectionResponse._() : super._(); - - factory _PostmanCollectionResponse.fromJson(Map json) = - _$PostmanCollectionResponseImpl.fromJson; - - @override - String? get name; - @override - String? get id; - @override - PostmanCollectionRequest? get originalRequest; - @override - @JsonKey(name: '_postman_previewlanguage') - String? get postmanPreviewLanguage; - @override - Object? get responseTime; - @override - Object? get timings; - @override - Object? get header; - @override - List? get cookie; - @override - String? get body; - @override - String? get status; - @override - int? get code; - - /// Create a copy of PostmanCollectionResponse - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionResponseImplCopyWith<_$PostmanCollectionResponseImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionCookie _$PostmanCollectionCookieFromJson( - Map json) { - return _PostmanCollectionCookie.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionCookie { - String get domain => throw _privateConstructorUsedError; - Object? get expires => throw _privateConstructorUsedError; - String? get maxAge => throw _privateConstructorUsedError; - bool? get hostOnly => throw _privateConstructorUsedError; - bool? get httpOnly => throw _privateConstructorUsedError; - String? get name => throw _privateConstructorUsedError; - String? get path => throw _privateConstructorUsedError; - bool? get secure => throw _privateConstructorUsedError; - bool? get session => throw _privateConstructorUsedError; - String? get value => throw _privateConstructorUsedError; - Object? get extensions => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - String domain, - Object? expires, - String? maxAge, - bool? hostOnly, - bool? httpOnly, - String? name, - String? path, - bool? secure, - bool? session, - String? value, - Object? extensions) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String domain, - Object? expires, - String? maxAge, - bool? hostOnly, - bool? httpOnly, - String? name, - String? path, - bool? secure, - bool? session, - String? value, - Object? extensions)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String domain, - Object? expires, - String? maxAge, - bool? hostOnly, - bool? httpOnly, - String? name, - String? path, - bool? secure, - bool? session, - String? value, - Object? extensions)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionCookie value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionCookie value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionCookie value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionCookie to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionCookie - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionCookieCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionCookieCopyWith<$Res> { - factory $PostmanCollectionCookieCopyWith(PostmanCollectionCookie value, - $Res Function(PostmanCollectionCookie) then) = - _$PostmanCollectionCookieCopyWithImpl<$Res, PostmanCollectionCookie>; - @useResult - $Res call( - {String domain, - Object? expires, - String? maxAge, - bool? hostOnly, - bool? httpOnly, - String? name, - String? path, - bool? secure, - bool? session, - String? value, - Object? extensions}); -} - -/// @nodoc -class _$PostmanCollectionCookieCopyWithImpl<$Res, - $Val extends PostmanCollectionCookie> - implements $PostmanCollectionCookieCopyWith<$Res> { - _$PostmanCollectionCookieCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionCookie - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? domain = null, - Object? expires = freezed, - Object? maxAge = freezed, - Object? hostOnly = freezed, - Object? httpOnly = freezed, - Object? name = freezed, - Object? path = freezed, - Object? secure = freezed, - Object? session = freezed, - Object? value = freezed, - Object? extensions = freezed, - }) { - return _then(_value.copyWith( - domain: null == domain - ? _value.domain - : domain // ignore: cast_nullable_to_non_nullable - as String, - expires: freezed == expires ? _value.expires : expires, - maxAge: freezed == maxAge - ? _value.maxAge - : maxAge // ignore: cast_nullable_to_non_nullable - as String?, - hostOnly: freezed == hostOnly - ? _value.hostOnly - : hostOnly // ignore: cast_nullable_to_non_nullable - as bool?, - httpOnly: freezed == httpOnly - ? _value.httpOnly - : httpOnly // ignore: cast_nullable_to_non_nullable - as bool?, - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - path: freezed == path - ? _value.path - : path // ignore: cast_nullable_to_non_nullable - as String?, - secure: freezed == secure - ? _value.secure - : secure // ignore: cast_nullable_to_non_nullable - as bool?, - session: freezed == session - ? _value.session - : session // ignore: cast_nullable_to_non_nullable - as bool?, - value: freezed == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String?, - extensions: freezed == extensions ? _value.extensions : extensions, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionCookieImplCopyWith<$Res> - implements $PostmanCollectionCookieCopyWith<$Res> { - factory _$$PostmanCollectionCookieImplCopyWith( - _$PostmanCollectionCookieImpl value, - $Res Function(_$PostmanCollectionCookieImpl) then) = - __$$PostmanCollectionCookieImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String domain, - Object? expires, - String? maxAge, - bool? hostOnly, - bool? httpOnly, - String? name, - String? path, - bool? secure, - bool? session, - String? value, - Object? extensions}); -} - -/// @nodoc -class __$$PostmanCollectionCookieImplCopyWithImpl<$Res> - extends _$PostmanCollectionCookieCopyWithImpl<$Res, - _$PostmanCollectionCookieImpl> - implements _$$PostmanCollectionCookieImplCopyWith<$Res> { - __$$PostmanCollectionCookieImplCopyWithImpl( - _$PostmanCollectionCookieImpl _value, - $Res Function(_$PostmanCollectionCookieImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionCookie - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? domain = null, - Object? expires = freezed, - Object? maxAge = freezed, - Object? hostOnly = freezed, - Object? httpOnly = freezed, - Object? name = freezed, - Object? path = freezed, - Object? secure = freezed, - Object? session = freezed, - Object? value = freezed, - Object? extensions = freezed, - }) { - return _then(_$PostmanCollectionCookieImpl( - domain: null == domain - ? _value.domain - : domain // ignore: cast_nullable_to_non_nullable - as String, - expires: freezed == expires ? _value.expires : expires, - maxAge: freezed == maxAge - ? _value.maxAge - : maxAge // ignore: cast_nullable_to_non_nullable - as String?, - hostOnly: freezed == hostOnly - ? _value.hostOnly - : hostOnly // ignore: cast_nullable_to_non_nullable - as bool?, - httpOnly: freezed == httpOnly - ? _value.httpOnly - : httpOnly // ignore: cast_nullable_to_non_nullable - as bool?, - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - path: freezed == path - ? _value.path - : path // ignore: cast_nullable_to_non_nullable - as String?, - secure: freezed == secure - ? _value.secure - : secure // ignore: cast_nullable_to_non_nullable - as bool?, - session: freezed == session - ? _value.session - : session // ignore: cast_nullable_to_non_nullable - as bool?, - value: freezed == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String?, - extensions: freezed == extensions ? _value.extensions : extensions, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionCookieImpl extends _PostmanCollectionCookie { - const _$PostmanCollectionCookieImpl( - {required this.domain, - this.expires, - this.maxAge, - this.hostOnly, - this.httpOnly, - this.name, - this.path, - this.secure, - this.session, - this.value, - this.extensions}) - : super._(); - - factory _$PostmanCollectionCookieImpl.fromJson(Map json) => - _$$PostmanCollectionCookieImplFromJson(json); - - @override - final String domain; - @override - final Object? expires; - @override - final String? maxAge; - @override - final bool? hostOnly; - @override - final bool? httpOnly; - @override - final String? name; - @override - final String? path; - @override - final bool? secure; - @override - final bool? session; - @override - final String? value; - @override - final Object? extensions; - - @override - String toString() { - return 'PostmanCollectionCookie(domain: $domain, expires: $expires, maxAge: $maxAge, hostOnly: $hostOnly, httpOnly: $httpOnly, name: $name, path: $path, secure: $secure, session: $session, value: $value, extensions: $extensions)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionCookieImpl && - (identical(other.domain, domain) || other.domain == domain) && - const DeepCollectionEquality().equals(other.expires, expires) && - (identical(other.maxAge, maxAge) || other.maxAge == maxAge) && - (identical(other.hostOnly, hostOnly) || - other.hostOnly == hostOnly) && - (identical(other.httpOnly, httpOnly) || - other.httpOnly == httpOnly) && - (identical(other.name, name) || other.name == name) && - (identical(other.path, path) || other.path == path) && - (identical(other.secure, secure) || other.secure == secure) && - (identical(other.session, session) || other.session == session) && - (identical(other.value, value) || other.value == value) && - const DeepCollectionEquality() - .equals(other.extensions, extensions)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - domain, - const DeepCollectionEquality().hash(expires), - maxAge, - hostOnly, - httpOnly, - name, - path, - secure, - session, - value, - const DeepCollectionEquality().hash(extensions)); - - /// Create a copy of PostmanCollectionCookie - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionCookieImplCopyWith<_$PostmanCollectionCookieImpl> - get copyWith => __$$PostmanCollectionCookieImplCopyWithImpl< - _$PostmanCollectionCookieImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - String domain, - Object? expires, - String? maxAge, - bool? hostOnly, - bool? httpOnly, - String? name, - String? path, - bool? secure, - bool? session, - String? value, - Object? extensions) - $default, - ) { - return $default(domain, expires, maxAge, hostOnly, httpOnly, name, path, - secure, session, value, extensions); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String domain, - Object? expires, - String? maxAge, - bool? hostOnly, - bool? httpOnly, - String? name, - String? path, - bool? secure, - bool? session, - String? value, - Object? extensions)? - $default, - ) { - return $default?.call(domain, expires, maxAge, hostOnly, httpOnly, name, - path, secure, session, value, extensions); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String domain, - Object? expires, - String? maxAge, - bool? hostOnly, - bool? httpOnly, - String? name, - String? path, - bool? secure, - bool? session, - String? value, - Object? extensions)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(domain, expires, maxAge, hostOnly, httpOnly, name, path, - secure, session, value, extensions); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionCookie value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionCookie value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionCookie value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionCookieImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionCookie extends PostmanCollectionCookie { - const factory _PostmanCollectionCookie( - {required final String domain, - final Object? expires, - final String? maxAge, - final bool? hostOnly, - final bool? httpOnly, - final String? name, - final String? path, - final bool? secure, - final bool? session, - final String? value, - final Object? extensions}) = _$PostmanCollectionCookieImpl; - const _PostmanCollectionCookie._() : super._(); - - factory _PostmanCollectionCookie.fromJson(Map json) = - _$PostmanCollectionCookieImpl.fromJson; - - @override - String get domain; - @override - Object? get expires; - @override - String? get maxAge; - @override - bool? get hostOnly; - @override - bool? get httpOnly; - @override - String? get name; - @override - String? get path; - @override - bool? get secure; - @override - bool? get session; - @override - String? get value; - @override - Object? get extensions; - - /// Create a copy of PostmanCollectionCookie - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionCookieImplCopyWith<_$PostmanCollectionCookieImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionCertificate _$PostmanCollectionCertificateFromJson( - Map json) { - return _PostmanCollectionCertificate.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionCertificate { - String? get name => throw _privateConstructorUsedError; - List? get matches => throw _privateConstructorUsedError; - PostmanCollectionCertificateSrc? get key => - throw _privateConstructorUsedError; - PostmanCollectionCertificateSrc? get cert => - throw _privateConstructorUsedError; - String? get passphrase => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function( - String? name, - List? matches, - PostmanCollectionCertificateSrc? key, - PostmanCollectionCertificateSrc? cert, - String? passphrase) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? name, - List? matches, - PostmanCollectionCertificateSrc? key, - PostmanCollectionCertificateSrc? cert, - String? passphrase)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? name, - List? matches, - PostmanCollectionCertificateSrc? key, - PostmanCollectionCertificateSrc? cert, - String? passphrase)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionCertificate value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionCertificate value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionCertificate value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionCertificate to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionCertificate - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionCertificateCopyWith - get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionCertificateCopyWith<$Res> { - factory $PostmanCollectionCertificateCopyWith( - PostmanCollectionCertificate value, - $Res Function(PostmanCollectionCertificate) then) = - _$PostmanCollectionCertificateCopyWithImpl<$Res, - PostmanCollectionCertificate>; - @useResult - $Res call( - {String? name, - List? matches, - PostmanCollectionCertificateSrc? key, - PostmanCollectionCertificateSrc? cert, - String? passphrase}); - - $PostmanCollectionCertificateSrcCopyWith<$Res>? get key; - $PostmanCollectionCertificateSrcCopyWith<$Res>? get cert; -} - -/// @nodoc -class _$PostmanCollectionCertificateCopyWithImpl<$Res, - $Val extends PostmanCollectionCertificate> - implements $PostmanCollectionCertificateCopyWith<$Res> { - _$PostmanCollectionCertificateCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionCertificate - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? name = freezed, - Object? matches = freezed, - Object? key = freezed, - Object? cert = freezed, - Object? passphrase = freezed, - }) { - return _then(_value.copyWith( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - matches: freezed == matches - ? _value.matches - : matches // ignore: cast_nullable_to_non_nullable - as List?, - key: freezed == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as PostmanCollectionCertificateSrc?, - cert: freezed == cert - ? _value.cert - : cert // ignore: cast_nullable_to_non_nullable - as PostmanCollectionCertificateSrc?, - passphrase: freezed == passphrase - ? _value.passphrase - : passphrase // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } - - /// Create a copy of PostmanCollectionCertificate - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionCertificateSrcCopyWith<$Res>? get key { - if (_value.key == null) { - return null; - } - - return $PostmanCollectionCertificateSrcCopyWith<$Res>(_value.key!, (value) { - return _then(_value.copyWith(key: value) as $Val); - }); - } - - /// Create a copy of PostmanCollectionCertificate - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $PostmanCollectionCertificateSrcCopyWith<$Res>? get cert { - if (_value.cert == null) { - return null; - } - - return $PostmanCollectionCertificateSrcCopyWith<$Res>(_value.cert!, - (value) { - return _then(_value.copyWith(cert: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionCertificateImplCopyWith<$Res> - implements $PostmanCollectionCertificateCopyWith<$Res> { - factory _$$PostmanCollectionCertificateImplCopyWith( - _$PostmanCollectionCertificateImpl value, - $Res Function(_$PostmanCollectionCertificateImpl) then) = - __$$PostmanCollectionCertificateImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? name, - List? matches, - PostmanCollectionCertificateSrc? key, - PostmanCollectionCertificateSrc? cert, - String? passphrase}); - - @override - $PostmanCollectionCertificateSrcCopyWith<$Res>? get key; - @override - $PostmanCollectionCertificateSrcCopyWith<$Res>? get cert; -} - -/// @nodoc -class __$$PostmanCollectionCertificateImplCopyWithImpl<$Res> - extends _$PostmanCollectionCertificateCopyWithImpl<$Res, - _$PostmanCollectionCertificateImpl> - implements _$$PostmanCollectionCertificateImplCopyWith<$Res> { - __$$PostmanCollectionCertificateImplCopyWithImpl( - _$PostmanCollectionCertificateImpl _value, - $Res Function(_$PostmanCollectionCertificateImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionCertificate - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? name = freezed, - Object? matches = freezed, - Object? key = freezed, - Object? cert = freezed, - Object? passphrase = freezed, - }) { - return _then(_$PostmanCollectionCertificateImpl( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - matches: freezed == matches - ? _value._matches - : matches // ignore: cast_nullable_to_non_nullable - as List?, - key: freezed == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as PostmanCollectionCertificateSrc?, - cert: freezed == cert - ? _value.cert - : cert // ignore: cast_nullable_to_non_nullable - as PostmanCollectionCertificateSrc?, - passphrase: freezed == passphrase - ? _value.passphrase - : passphrase // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionCertificateImpl extends _PostmanCollectionCertificate { - const _$PostmanCollectionCertificateImpl( - {this.name, - final List? matches, - this.key, - this.cert, - this.passphrase}) - : _matches = matches, - super._(); - - factory _$PostmanCollectionCertificateImpl.fromJson( - Map json) => - _$$PostmanCollectionCertificateImplFromJson(json); - - @override - final String? name; - final List? _matches; - @override - List? get matches { - final value = _matches; - if (value == null) return null; - if (_matches is EqualUnmodifiableListView) return _matches; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - final PostmanCollectionCertificateSrc? key; - @override - final PostmanCollectionCertificateSrc? cert; - @override - final String? passphrase; - - @override - String toString() { - return 'PostmanCollectionCertificate(name: $name, matches: $matches, key: $key, cert: $cert, passphrase: $passphrase)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionCertificateImpl && - (identical(other.name, name) || other.name == name) && - const DeepCollectionEquality().equals(other._matches, _matches) && - (identical(other.key, key) || other.key == key) && - (identical(other.cert, cert) || other.cert == cert) && - (identical(other.passphrase, passphrase) || - other.passphrase == passphrase)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, name, - const DeepCollectionEquality().hash(_matches), key, cert, passphrase); - - /// Create a copy of PostmanCollectionCertificate - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionCertificateImplCopyWith< - _$PostmanCollectionCertificateImpl> - get copyWith => __$$PostmanCollectionCertificateImplCopyWithImpl< - _$PostmanCollectionCertificateImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - String? name, - List? matches, - PostmanCollectionCertificateSrc? key, - PostmanCollectionCertificateSrc? cert, - String? passphrase) - $default, - ) { - return $default(name, matches, key, cert, passphrase); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String? name, - List? matches, - PostmanCollectionCertificateSrc? key, - PostmanCollectionCertificateSrc? cert, - String? passphrase)? - $default, - ) { - return $default?.call(name, matches, key, cert, passphrase); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String? name, - List? matches, - PostmanCollectionCertificateSrc? key, - PostmanCollectionCertificateSrc? cert, - String? passphrase)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(name, matches, key, cert, passphrase); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionCertificate value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionCertificate value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionCertificate value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionCertificateImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionCertificate - extends PostmanCollectionCertificate { - const factory _PostmanCollectionCertificate( - {final String? name, - final List? matches, - final PostmanCollectionCertificateSrc? key, - final PostmanCollectionCertificateSrc? cert, - final String? passphrase}) = _$PostmanCollectionCertificateImpl; - const _PostmanCollectionCertificate._() : super._(); - - factory _PostmanCollectionCertificate.fromJson(Map json) = - _$PostmanCollectionCertificateImpl.fromJson; - - @override - String? get name; - @override - List? get matches; - @override - PostmanCollectionCertificateSrc? get key; - @override - PostmanCollectionCertificateSrc? get cert; - @override - String? get passphrase; - - /// Create a copy of PostmanCollectionCertificate - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionCertificateImplCopyWith< - _$PostmanCollectionCertificateImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionCertificateSrc _$PostmanCollectionCertificateSrcFromJson( - Map json) { - return _PostmanCollectionCertificateSrc.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionCertificateSrc { - String? get src => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function(String? src) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String? src)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String? src)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionCertificateSrc value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionCertificateSrc value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionCertificateSrc value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionCertificateSrc to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionCertificateSrc - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionCertificateSrcCopyWith - get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionCertificateSrcCopyWith<$Res> { - factory $PostmanCollectionCertificateSrcCopyWith( - PostmanCollectionCertificateSrc value, - $Res Function(PostmanCollectionCertificateSrc) then) = - _$PostmanCollectionCertificateSrcCopyWithImpl<$Res, - PostmanCollectionCertificateSrc>; - @useResult - $Res call({String? src}); -} - -/// @nodoc -class _$PostmanCollectionCertificateSrcCopyWithImpl<$Res, - $Val extends PostmanCollectionCertificateSrc> - implements $PostmanCollectionCertificateSrcCopyWith<$Res> { - _$PostmanCollectionCertificateSrcCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionCertificateSrc - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? src = freezed, - }) { - return _then(_value.copyWith( - src: freezed == src - ? _value.src - : src // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionCertificateSrcImplCopyWith<$Res> - implements $PostmanCollectionCertificateSrcCopyWith<$Res> { - factory _$$PostmanCollectionCertificateSrcImplCopyWith( - _$PostmanCollectionCertificateSrcImpl value, - $Res Function(_$PostmanCollectionCertificateSrcImpl) then) = - __$$PostmanCollectionCertificateSrcImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String? src}); -} - -/// @nodoc -class __$$PostmanCollectionCertificateSrcImplCopyWithImpl<$Res> - extends _$PostmanCollectionCertificateSrcCopyWithImpl<$Res, - _$PostmanCollectionCertificateSrcImpl> - implements _$$PostmanCollectionCertificateSrcImplCopyWith<$Res> { - __$$PostmanCollectionCertificateSrcImplCopyWithImpl( - _$PostmanCollectionCertificateSrcImpl _value, - $Res Function(_$PostmanCollectionCertificateSrcImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionCertificateSrc - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? src = freezed, - }) { - return _then(_$PostmanCollectionCertificateSrcImpl( - src: freezed == src - ? _value.src - : src // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionCertificateSrcImpl - extends _PostmanCollectionCertificateSrc { - const _$PostmanCollectionCertificateSrcImpl({this.src}) : super._(); - - factory _$PostmanCollectionCertificateSrcImpl.fromJson( - Map json) => - _$$PostmanCollectionCertificateSrcImplFromJson(json); - - @override - final String? src; - - @override - String toString() { - return 'PostmanCollectionCertificateSrc(src: $src)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionCertificateSrcImpl && - (identical(other.src, src) || other.src == src)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, src); - - /// Create a copy of PostmanCollectionCertificateSrc - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionCertificateSrcImplCopyWith< - _$PostmanCollectionCertificateSrcImpl> - get copyWith => __$$PostmanCollectionCertificateSrcImplCopyWithImpl< - _$PostmanCollectionCertificateSrcImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function(String? src) $default, - ) { - return $default(src); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String? src)? $default, - ) { - return $default?.call(src); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String? src)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(src); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionCertificateSrc value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionCertificateSrc value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionCertificateSrc value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionCertificateSrcImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionCertificateSrc - extends PostmanCollectionCertificateSrc { - const factory _PostmanCollectionCertificateSrc({final String? src}) = - _$PostmanCollectionCertificateSrcImpl; - const _PostmanCollectionCertificateSrc._() : super._(); - - factory _PostmanCollectionCertificateSrc.fromJson(Map json) = - _$PostmanCollectionCertificateSrcImpl.fromJson; - - @override - String? get src; - - /// Create a copy of PostmanCollectionCertificateSrc - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionCertificateSrcImplCopyWith< - _$PostmanCollectionCertificateSrcImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionProxyConfig _$PostmanCollectionProxyConfigFromJson( - Map json) { - return _PostmanCollectionProxyConfig.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionProxyConfig { - String? get match => throw _privateConstructorUsedError; - String? get host => throw _privateConstructorUsedError; - int? get port => throw _privateConstructorUsedError; - bool? get tunnel => throw _privateConstructorUsedError; - bool? get disabled => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function(String? match, String? host, int? port, bool? tunnel, - bool? disabled) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String? match, String? host, int? port, bool? tunnel, - bool? disabled)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String? match, String? host, int? port, bool? tunnel, - bool? disabled)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionProxyConfig value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionProxyConfig value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionProxyConfig value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionProxyConfig to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionProxyConfig - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionProxyConfigCopyWith - get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionProxyConfigCopyWith<$Res> { - factory $PostmanCollectionProxyConfigCopyWith( - PostmanCollectionProxyConfig value, - $Res Function(PostmanCollectionProxyConfig) then) = - _$PostmanCollectionProxyConfigCopyWithImpl<$Res, - PostmanCollectionProxyConfig>; - @useResult - $Res call( - {String? match, String? host, int? port, bool? tunnel, bool? disabled}); -} - -/// @nodoc -class _$PostmanCollectionProxyConfigCopyWithImpl<$Res, - $Val extends PostmanCollectionProxyConfig> - implements $PostmanCollectionProxyConfigCopyWith<$Res> { - _$PostmanCollectionProxyConfigCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionProxyConfig - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? match = freezed, - Object? host = freezed, - Object? port = freezed, - Object? tunnel = freezed, - Object? disabled = freezed, - }) { - return _then(_value.copyWith( - match: freezed == match - ? _value.match - : match // ignore: cast_nullable_to_non_nullable - as String?, - host: freezed == host - ? _value.host - : host // ignore: cast_nullable_to_non_nullable - as String?, - port: freezed == port - ? _value.port - : port // ignore: cast_nullable_to_non_nullable - as int?, - tunnel: freezed == tunnel - ? _value.tunnel - : tunnel // ignore: cast_nullable_to_non_nullable - as bool?, - disabled: freezed == disabled - ? _value.disabled - : disabled // ignore: cast_nullable_to_non_nullable - as bool?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionProxyConfigImplCopyWith<$Res> - implements $PostmanCollectionProxyConfigCopyWith<$Res> { - factory _$$PostmanCollectionProxyConfigImplCopyWith( - _$PostmanCollectionProxyConfigImpl value, - $Res Function(_$PostmanCollectionProxyConfigImpl) then) = - __$$PostmanCollectionProxyConfigImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? match, String? host, int? port, bool? tunnel, bool? disabled}); -} - -/// @nodoc -class __$$PostmanCollectionProxyConfigImplCopyWithImpl<$Res> - extends _$PostmanCollectionProxyConfigCopyWithImpl<$Res, - _$PostmanCollectionProxyConfigImpl> - implements _$$PostmanCollectionProxyConfigImplCopyWith<$Res> { - __$$PostmanCollectionProxyConfigImplCopyWithImpl( - _$PostmanCollectionProxyConfigImpl _value, - $Res Function(_$PostmanCollectionProxyConfigImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionProxyConfig - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? match = freezed, - Object? host = freezed, - Object? port = freezed, - Object? tunnel = freezed, - Object? disabled = freezed, - }) { - return _then(_$PostmanCollectionProxyConfigImpl( - match: freezed == match - ? _value.match - : match // ignore: cast_nullable_to_non_nullable - as String?, - host: freezed == host - ? _value.host - : host // ignore: cast_nullable_to_non_nullable - as String?, - port: freezed == port - ? _value.port - : port // ignore: cast_nullable_to_non_nullable - as int?, - tunnel: freezed == tunnel - ? _value.tunnel - : tunnel // ignore: cast_nullable_to_non_nullable - as bool?, - disabled: freezed == disabled - ? _value.disabled - : disabled // ignore: cast_nullable_to_non_nullable - as bool?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionProxyConfigImpl extends _PostmanCollectionProxyConfig { - const _$PostmanCollectionProxyConfigImpl( - {this.match, this.host, this.port, this.tunnel, this.disabled}) - : super._(); - - factory _$PostmanCollectionProxyConfigImpl.fromJson( - Map json) => - _$$PostmanCollectionProxyConfigImplFromJson(json); - - @override - final String? match; - @override - final String? host; - @override - final int? port; - @override - final bool? tunnel; - @override - final bool? disabled; - - @override - String toString() { - return 'PostmanCollectionProxyConfig(match: $match, host: $host, port: $port, tunnel: $tunnel, disabled: $disabled)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionProxyConfigImpl && - (identical(other.match, match) || other.match == match) && - (identical(other.host, host) || other.host == host) && - (identical(other.port, port) || other.port == port) && - (identical(other.tunnel, tunnel) || other.tunnel == tunnel) && - (identical(other.disabled, disabled) || - other.disabled == disabled)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, match, host, port, tunnel, disabled); - - /// Create a copy of PostmanCollectionProxyConfig - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionProxyConfigImplCopyWith< - _$PostmanCollectionProxyConfigImpl> - get copyWith => __$$PostmanCollectionProxyConfigImplCopyWithImpl< - _$PostmanCollectionProxyConfigImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function(String? match, String? host, int? port, bool? tunnel, - bool? disabled) - $default, - ) { - return $default(match, host, port, tunnel, disabled); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String? match, String? host, int? port, bool? tunnel, - bool? disabled)? - $default, - ) { - return $default?.call(match, host, port, tunnel, disabled); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String? match, String? host, int? port, bool? tunnel, - bool? disabled)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(match, host, port, tunnel, disabled); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionProxyConfig value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionProxyConfig value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionProxyConfig value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionProxyConfigImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionProxyConfig - extends PostmanCollectionProxyConfig { - const factory _PostmanCollectionProxyConfig( - {final String? match, - final String? host, - final int? port, - final bool? tunnel, - final bool? disabled}) = _$PostmanCollectionProxyConfigImpl; - const _PostmanCollectionProxyConfig._() : super._(); - - factory _PostmanCollectionProxyConfig.fromJson(Map json) = - _$PostmanCollectionProxyConfigImpl.fromJson; - - @override - String? get match; - @override - String? get host; - @override - int? get port; - @override - bool? get tunnel; - @override - bool? get disabled; - - /// Create a copy of PostmanCollectionProxyConfig - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionProxyConfigImplCopyWith< - _$PostmanCollectionProxyConfigImpl> - get copyWith => throw _privateConstructorUsedError; -} - -PostmanCollectionHeader _$PostmanCollectionHeaderFromJson( - Map json) { - return _PostmanCollectionHeader.fromJson(json); -} - -/// @nodoc -mixin _$PostmanCollectionHeader { - String get key => throw _privateConstructorUsedError; - String get value => throw _privateConstructorUsedError; - String? get type => throw _privateConstructorUsedError; - bool? get disabled => throw _privateConstructorUsedError; - String? get description => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when( - TResult Function(String key, String value, String? type, bool? disabled, - String? description) - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String key, String value, String? type, bool? disabled, - String? description)? - $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String key, String value, String? type, bool? disabled, - String? description)? - $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionHeader value) $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionHeader value)? $default, - ) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionHeader value)? $default, { - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this PostmanCollectionHeader to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of PostmanCollectionHeader - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $PostmanCollectionHeaderCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PostmanCollectionHeaderCopyWith<$Res> { - factory $PostmanCollectionHeaderCopyWith(PostmanCollectionHeader value, - $Res Function(PostmanCollectionHeader) then) = - _$PostmanCollectionHeaderCopyWithImpl<$Res, PostmanCollectionHeader>; - @useResult - $Res call( - {String key, - String value, - String? type, - bool? disabled, - String? description}); -} - -/// @nodoc -class _$PostmanCollectionHeaderCopyWithImpl<$Res, - $Val extends PostmanCollectionHeader> - implements $PostmanCollectionHeaderCopyWith<$Res> { - _$PostmanCollectionHeaderCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PostmanCollectionHeader - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? key = null, - Object? value = null, - Object? type = freezed, - Object? disabled = freezed, - Object? description = freezed, - }) { - return _then(_value.copyWith( - key: null == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String, - value: null == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - disabled: freezed == disabled - ? _value.disabled - : disabled // ignore: cast_nullable_to_non_nullable - as bool?, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$PostmanCollectionHeaderImplCopyWith<$Res> - implements $PostmanCollectionHeaderCopyWith<$Res> { - factory _$$PostmanCollectionHeaderImplCopyWith( - _$PostmanCollectionHeaderImpl value, - $Res Function(_$PostmanCollectionHeaderImpl) then) = - __$$PostmanCollectionHeaderImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String key, - String value, - String? type, - bool? disabled, - String? description}); -} - -/// @nodoc -class __$$PostmanCollectionHeaderImplCopyWithImpl<$Res> - extends _$PostmanCollectionHeaderCopyWithImpl<$Res, - _$PostmanCollectionHeaderImpl> - implements _$$PostmanCollectionHeaderImplCopyWith<$Res> { - __$$PostmanCollectionHeaderImplCopyWithImpl( - _$PostmanCollectionHeaderImpl _value, - $Res Function(_$PostmanCollectionHeaderImpl) _then) - : super(_value, _then); - - /// Create a copy of PostmanCollectionHeader - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? key = null, - Object? value = null, - Object? type = freezed, - Object? disabled = freezed, - Object? description = freezed, - }) { - return _then(_$PostmanCollectionHeaderImpl( - key: null == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String, - value: null == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - disabled: freezed == disabled - ? _value.disabled - : disabled // ignore: cast_nullable_to_non_nullable - as bool?, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$PostmanCollectionHeaderImpl extends _PostmanCollectionHeader { - const _$PostmanCollectionHeaderImpl( - {required this.key, - required this.value, - this.type, - this.disabled, - this.description}) - : super._(); - - factory _$PostmanCollectionHeaderImpl.fromJson(Map json) => - _$$PostmanCollectionHeaderImplFromJson(json); - - @override - final String key; - @override - final String value; - @override - final String? type; - @override - final bool? disabled; - @override - final String? description; - - @override - String toString() { - return 'PostmanCollectionHeader(key: $key, value: $value, type: $type, disabled: $disabled, description: $description)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PostmanCollectionHeaderImpl && - (identical(other.key, key) || other.key == key) && - (identical(other.value, value) || other.value == value) && - (identical(other.type, type) || other.type == type) && - (identical(other.disabled, disabled) || - other.disabled == disabled) && - (identical(other.description, description) || - other.description == description)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, key, value, type, disabled, description); - - /// Create a copy of PostmanCollectionHeader - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PostmanCollectionHeaderImplCopyWith<_$PostmanCollectionHeaderImpl> - get copyWith => __$$PostmanCollectionHeaderImplCopyWithImpl< - _$PostmanCollectionHeaderImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function(String key, String value, String? type, bool? disabled, - String? description) - $default, - ) { - return $default(key, value, type, disabled, description); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String key, String value, String? type, bool? disabled, - String? description)? - $default, - ) { - return $default?.call(key, value, type, disabled, description); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String key, String value, String? type, bool? disabled, - String? description)? - $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(key, value, type, disabled, description); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_PostmanCollectionHeader value) $default, - ) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PostmanCollectionHeader value)? $default, - ) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PostmanCollectionHeader value)? $default, { - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$PostmanCollectionHeaderImplToJson( - this, - ); - } -} - -abstract class _PostmanCollectionHeader extends PostmanCollectionHeader { - const factory _PostmanCollectionHeader( - {required final String key, - required final String value, - final String? type, - final bool? disabled, - final String? description}) = _$PostmanCollectionHeaderImpl; - const _PostmanCollectionHeader._() : super._(); - - factory _PostmanCollectionHeader.fromJson(Map json) = - _$PostmanCollectionHeaderImpl.fromJson; - - @override - String get key; - @override - String get value; - @override - String? get type; - @override - bool? get disabled; - @override - String? get description; - - /// Create a copy of PostmanCollectionHeader - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PostmanCollectionHeaderImplCopyWith<_$PostmanCollectionHeaderImpl> - get copyWith => throw _privateConstructorUsedError; -} diff --git a/packages/postman_collection/lib/src/postman_collection_base.g.dart b/packages/postman_collection/lib/src/postman_collection_base.g.dart deleted file mode 100644 index ae03ba2c..00000000 --- a/packages/postman_collection/lib/src/postman_collection_base.g.dart +++ /dev/null @@ -1,778 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'postman_collection_base.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_$PostmanCollectionImpl _$$PostmanCollectionImplFromJson( - Map json) => - _$PostmanCollectionImpl( - info: - PostmanCollectionInfo.fromJson(json['info'] as Map), - item: (json['item'] as List) - .map((e) => PostmanCollectionItem.fromJson(e as Map)) - .toList(), - auth: json['auth'] == null - ? null - : PostmanCollectionAuth.fromJson( - json['auth'] as Map), - event: (json['event'] as List?) - ?.map( - (e) => PostmanCollectionEvent.fromJson(e as Map)) - .toList(), - protocolProfileBehavior: - json['protocolProfileBehavior'] as Map?, - variable: (json['variable'] as List?) - ?.map((e) => - PostmanCollectionVariable.fromJson(e as Map)) - .toList(), - ); - -Map _$$PostmanCollectionImplToJson( - _$PostmanCollectionImpl instance) { - final val = { - 'info': instance.info.toJson(), - 'item': instance.item.map((e) => e.toJson()).toList(), - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('auth', instance.auth?.toJson()); - writeNotNull('event', instance.event?.map((e) => e.toJson()).toList()); - writeNotNull('protocolProfileBehavior', instance.protocolProfileBehavior); - writeNotNull('variable', instance.variable?.map((e) => e.toJson()).toList()); - return val; -} - -_$PostmanCollectionInfoImpl _$$PostmanCollectionInfoImplFromJson( - Map json) => - _$PostmanCollectionInfoImpl( - postmanId: json['_postman_id'] as String?, - name: json['name'] as String, - schema: json['schema'] as String, - description: json['description'] as String?, - version: json['version'] == null - ? null - : PostmanCollectionVersion.fromJson( - json['version'] as Map), - exporterId: json['_exporter_id'] as String?, - collectionLink: json['_collection_link'] as String?, - ); - -Map _$$PostmanCollectionInfoImplToJson( - _$PostmanCollectionInfoImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('_postman_id', instance.postmanId); - val['name'] = instance.name; - val['schema'] = instance.schema; - writeNotNull('description', instance.description); - writeNotNull('version', instance.version?.toJson()); - writeNotNull('_exporter_id', instance.exporterId); - writeNotNull('_collection_link', instance.collectionLink); - return val; -} - -_$PostmanCollectionVersionImpl _$$PostmanCollectionVersionImplFromJson( - Map json) => - _$PostmanCollectionVersionImpl( - major: (json['major'] as num).toInt(), - minor: (json['minor'] as num).toInt(), - patch: (json['patch'] as num).toInt(), - identifier: json['identifier'] as String?, - meta: json['meta'], - ); - -Map _$$PostmanCollectionVersionImplToJson( - _$PostmanCollectionVersionImpl instance) { - final val = { - 'major': instance.major, - 'minor': instance.minor, - 'patch': instance.patch, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('identifier', instance.identifier); - writeNotNull('meta', instance.meta); - return val; -} - -_$PostmanCollectionItemImpl _$$PostmanCollectionItemImplFromJson( - Map json) => - _$PostmanCollectionItemImpl( - id: json['id'] as String?, - name: json['name'] as String, - description: json['description'] as String?, - variable: (json['variable'] as List?) - ?.map((e) => - PostmanCollectionVariable.fromJson(e as Map)) - .toList(), - event: (json['event'] as List?) - ?.map( - (e) => PostmanCollectionEvent.fromJson(e as Map)) - .toList(), - protocolProfileBehavior: - json['protocolProfileBehavior'] as Map?, - request: json['request'] == null - ? null - : PostmanCollectionRequest.fromJson( - json['request'] as Map), - response: (json['response'] as List?) - ?.map((e) => - PostmanCollectionResponse.fromJson(e as Map)) - .toList(), - item: (json['item'] as List?) - ?.map( - (e) => PostmanCollectionItem.fromJson(e as Map)) - .toList(), - ); - -Map _$$PostmanCollectionItemImplToJson( - _$PostmanCollectionItemImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('id', instance.id); - val['name'] = instance.name; - writeNotNull('description', instance.description); - writeNotNull('variable', instance.variable?.map((e) => e.toJson()).toList()); - writeNotNull('event', instance.event?.map((e) => e.toJson()).toList()); - writeNotNull('protocolProfileBehavior', instance.protocolProfileBehavior); - writeNotNull('request', instance.request?.toJson()); - writeNotNull('response', instance.response?.map((e) => e.toJson()).toList()); - writeNotNull('item', instance.item?.map((e) => e.toJson()).toList()); - return val; -} - -_$PostmanCollectionAuthImpl _$$PostmanCollectionAuthImplFromJson( - Map json) => - _$PostmanCollectionAuthImpl( - type: $enumDecode(_$PostmanCollectionAuthTypeEnumMap, json['type']), - noauth: (json['noauth'] as List?) - ?.map((e) => PostmanCollectionAuthAttribute.fromJson( - e as Map)) - .toList(), - apikey: (json['apikey'] as List?) - ?.map((e) => PostmanCollectionAuthAttribute.fromJson( - e as Map)) - .toList(), - awsv4: (json['awsv4'] as List?) - ?.map((e) => PostmanCollectionAuthAttribute.fromJson( - e as Map)) - .toList(), - basic: (json['basic'] as List?) - ?.map((e) => PostmanCollectionAuthAttribute.fromJson( - e as Map)) - .toList(), - bearer: (json['bearer'] as List?) - ?.map((e) => PostmanCollectionAuthAttribute.fromJson( - e as Map)) - .toList(), - digest: (json['digest'] as List?) - ?.map((e) => PostmanCollectionAuthAttribute.fromJson( - e as Map)) - .toList(), - edgegrid: (json['edgegrid'] as List?) - ?.map((e) => PostmanCollectionAuthAttribute.fromJson( - e as Map)) - .toList(), - hawk: (json['hawk'] as List?) - ?.map((e) => PostmanCollectionAuthAttribute.fromJson( - e as Map)) - .toList(), - ntlm: (json['ntlm'] as List?) - ?.map((e) => PostmanCollectionAuthAttribute.fromJson( - e as Map)) - .toList(), - oauth1: (json['oauth1'] as List?) - ?.map((e) => PostmanCollectionAuthAttribute.fromJson( - e as Map)) - .toList(), - oauth2: (json['oauth2'] as List?) - ?.map((e) => PostmanCollectionAuthAttribute.fromJson( - e as Map)) - .toList(), - ); - -Map _$$PostmanCollectionAuthImplToJson( - _$PostmanCollectionAuthImpl instance) { - final val = { - 'type': _$PostmanCollectionAuthTypeEnumMap[instance.type]!, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('noauth', instance.noauth?.map((e) => e.toJson()).toList()); - writeNotNull('apikey', instance.apikey?.map((e) => e.toJson()).toList()); - writeNotNull('awsv4', instance.awsv4?.map((e) => e.toJson()).toList()); - writeNotNull('basic', instance.basic?.map((e) => e.toJson()).toList()); - writeNotNull('bearer', instance.bearer?.map((e) => e.toJson()).toList()); - writeNotNull('digest', instance.digest?.map((e) => e.toJson()).toList()); - writeNotNull('edgegrid', instance.edgegrid?.map((e) => e.toJson()).toList()); - writeNotNull('hawk', instance.hawk?.map((e) => e.toJson()).toList()); - writeNotNull('ntlm', instance.ntlm?.map((e) => e.toJson()).toList()); - writeNotNull('oauth1', instance.oauth1?.map((e) => e.toJson()).toList()); - writeNotNull('oauth2', instance.oauth2?.map((e) => e.toJson()).toList()); - return val; -} - -const _$PostmanCollectionAuthTypeEnumMap = { - PostmanCollectionAuthType.apikey: 'apikey', - PostmanCollectionAuthType.awsv4: 'awsv4', - PostmanCollectionAuthType.basic: 'basic', - PostmanCollectionAuthType.bearer: 'bearer', - PostmanCollectionAuthType.digest: 'digest', - PostmanCollectionAuthType.edgegrid: 'edgegrid', - PostmanCollectionAuthType.hawk: 'hawk', - PostmanCollectionAuthType.noauth: 'noauth', - PostmanCollectionAuthType.oauth1: 'oauth1', - PostmanCollectionAuthType.oauth2: 'oauth2', - PostmanCollectionAuthType.ntlm: 'ntlm', -}; - -_$PostmanCollectionAuthAttributeImpl - _$$PostmanCollectionAuthAttributeImplFromJson(Map json) => - _$PostmanCollectionAuthAttributeImpl( - key: json['key'] as String, - value: json['value'], - type: json['type'] as String?, - ); - -Map _$$PostmanCollectionAuthAttributeImplToJson( - _$PostmanCollectionAuthAttributeImpl instance) { - final val = { - 'key': instance.key, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('value', instance.value); - writeNotNull('type', instance.type); - return val; -} - -_$PostmanCollectionRequestImpl _$$PostmanCollectionRequestImplFromJson( - Map json) => - _$PostmanCollectionRequestImpl( - auth: json['auth'] == null - ? null - : PostmanCollectionAuth.fromJson( - json['auth'] as Map), - method: json['method'] as String, - proxy: json['proxy'] == null - ? null - : PostmanCollectionProxyConfig.fromJson( - json['proxy'] as Map), - certificate: json['certificate'] == null - ? null - : PostmanCollectionCertificate.fromJson( - json['certificate'] as Map), - header: (json['header'] as List?) - ?.map((e) => - PostmanCollectionHeader.fromJson(e as Map)) - .toList(), - body: json['body'] == null - ? null - : PostmanCollectionRequestMode.fromJson( - json['body'] as Map), - url: json['url'] == null - ? null - : PostmanCollectionUrl.fromJson(json['url'] as Map), - description: json['description'] as String?, - ); - -Map _$$PostmanCollectionRequestImplToJson( - _$PostmanCollectionRequestImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('auth', instance.auth?.toJson()); - val['method'] = instance.method; - writeNotNull('proxy', instance.proxy?.toJson()); - writeNotNull('certificate', instance.certificate?.toJson()); - writeNotNull('header', instance.header?.map((e) => e.toJson()).toList()); - writeNotNull('body', instance.body?.toJson()); - writeNotNull('url', instance.url?.toJson()); - writeNotNull('description', instance.description); - return val; -} - -_$PostmanCollectionRequestModeImpl _$$PostmanCollectionRequestModeImplFromJson( - Map json) => - _$PostmanCollectionRequestModeImpl( - raw: json['raw'] as String?, - options: json['options'] as Map?, - $type: json['mode'] as String?, - ); - -Map _$$PostmanCollectionRequestModeImplToJson( - _$PostmanCollectionRequestModeImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('raw', instance.raw); - writeNotNull('options', instance.options); - val['mode'] = instance.$type; - return val; -} - -_$PostmanCollectionRequestModeFormdataImpl - _$$PostmanCollectionRequestModeFormdataImplFromJson( - Map json) => - _$PostmanCollectionRequestModeFormdataImpl( - formdata: (json['formdata'] as List?) - ?.map((e) => - PostmanFormDataEntry.fromJson(e as Map)) - .toList(), - $type: json['mode'] as String?, - ); - -Map _$$PostmanCollectionRequestModeFormdataImplToJson( - _$PostmanCollectionRequestModeFormdataImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('formdata', instance.formdata?.map((e) => e.toJson()).toList()); - val['mode'] = instance.$type; - return val; -} - -_$PostmanFormDataEntryImpl _$$PostmanFormDataEntryImplFromJson( - Map json) => - _$PostmanFormDataEntryImpl( - key: json['key'] as String, - src: json['src'] as String?, - value: json['value'] as String?, - type: json['type'] as String?, - ); - -Map _$$PostmanFormDataEntryImplToJson( - _$PostmanFormDataEntryImpl instance) { - final val = { - 'key': instance.key, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('src', instance.src); - writeNotNull('value', instance.value); - writeNotNull('type', instance.type); - return val; -} - -_$PostmanCollectionUrlImpl _$$PostmanCollectionUrlImplFromJson( - Map json) => - _$PostmanCollectionUrlImpl( - raw: json['raw'] as String?, - protocol: json['protocol'] as String?, - host: json['host'], - path: json['path'], - port: json['port'] as String?, - query: (json['query'] as List?) - ?.map((e) => - PostmanCollectionQueryParam.fromJson(e as Map)) - .toList(), - hash: json['hash'] as String?, - variable: (json['variable'] as List?) - ?.map((e) => - PostmanCollectionVariable.fromJson(e as Map)) - .toList(), - ); - -Map _$$PostmanCollectionUrlImplToJson( - _$PostmanCollectionUrlImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('raw', instance.raw); - writeNotNull('protocol', instance.protocol); - writeNotNull('host', instance.host); - writeNotNull('path', instance.path); - writeNotNull('port', instance.port); - writeNotNull('query', instance.query?.map((e) => e.toJson()).toList()); - writeNotNull('hash', instance.hash); - writeNotNull('variable', instance.variable?.map((e) => e.toJson()).toList()); - return val; -} - -_$PostmanCollectionQueryParamImpl _$$PostmanCollectionQueryParamImplFromJson( - Map json) => - _$PostmanCollectionQueryParamImpl( - key: json['key'] as String?, - value: json['value'] as String?, - disabled: json['disabled'] as bool?, - description: json['description'] as String?, - ); - -Map _$$PostmanCollectionQueryParamImplToJson( - _$PostmanCollectionQueryParamImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('key', instance.key); - writeNotNull('value', instance.value); - writeNotNull('disabled', instance.disabled); - writeNotNull('description', instance.description); - return val; -} - -_$PostmanCollectionVariableImpl _$$PostmanCollectionVariableImplFromJson( - Map json) => - _$PostmanCollectionVariableImpl( - id: json['id'] as String?, - key: json['key'] as String?, - value: json['value'], - type: $enumDecodeNullable( - _$PostmanCollectionVariableTypeEnumMap, json['type']), - name: json['name'] as String?, - description: json['description'] as String?, - system: json['system'] as bool?, - disabled: json['disabled'] as bool?, - ); - -Map _$$PostmanCollectionVariableImplToJson( - _$PostmanCollectionVariableImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('id', instance.id); - writeNotNull('key', instance.key); - writeNotNull('value', instance.value); - writeNotNull('type', _$PostmanCollectionVariableTypeEnumMap[instance.type]); - writeNotNull('name', instance.name); - writeNotNull('description', instance.description); - writeNotNull('system', instance.system); - writeNotNull('disabled', instance.disabled); - return val; -} - -const _$PostmanCollectionVariableTypeEnumMap = { - PostmanCollectionVariableType.string: 'string', - PostmanCollectionVariableType.boolean: 'boolean', - PostmanCollectionVariableType.any: 'any', - PostmanCollectionVariableType.number: 'number', -}; - -_$PostmanCollectionEventImpl _$$PostmanCollectionEventImplFromJson( - Map json) => - _$PostmanCollectionEventImpl( - id: json['id'] as String?, - listen: json['listen'] as String, - script: json['script'] == null - ? null - : PostmanCollectionScript.fromJson( - json['script'] as Map), - disabled: json['disabled'] as bool?, - ); - -Map _$$PostmanCollectionEventImplToJson( - _$PostmanCollectionEventImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('id', instance.id); - val['listen'] = instance.listen; - writeNotNull('script', instance.script?.toJson()); - writeNotNull('disabled', instance.disabled); - return val; -} - -_$PostmanCollectionScriptImpl _$$PostmanCollectionScriptImplFromJson( - Map json) => - _$PostmanCollectionScriptImpl( - id: json['id'] as String?, - packages: json['packages'] as Map?, - type: json['type'] as String?, - exec: json['exec'], - src: json['src'] == null - ? null - : PostmanCollectionUrl.fromJson(json['src'] as Map), - name: json['name'] as String?, - ); - -Map _$$PostmanCollectionScriptImplToJson( - _$PostmanCollectionScriptImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('id', instance.id); - writeNotNull('packages', instance.packages); - writeNotNull('type', instance.type); - writeNotNull('exec', instance.exec); - writeNotNull('src', instance.src?.toJson()); - writeNotNull('name', instance.name); - return val; -} - -_$PostmanCollectionResponseImpl _$$PostmanCollectionResponseImplFromJson( - Map json) => - _$PostmanCollectionResponseImpl( - name: json['name'] as String?, - id: json['id'] as String?, - originalRequest: json['originalRequest'] == null - ? null - : PostmanCollectionRequest.fromJson( - json['originalRequest'] as Map), - postmanPreviewLanguage: json['_postman_previewlanguage'] as String?, - responseTime: json['responseTime'], - timings: json['timings'], - header: json['header'], - cookie: (json['cookie'] as List?) - ?.map((e) => - PostmanCollectionCookie.fromJson(e as Map)) - .toList(), - body: json['body'] as String?, - status: json['status'] as String?, - code: (json['code'] as num?)?.toInt(), - ); - -Map _$$PostmanCollectionResponseImplToJson( - _$PostmanCollectionResponseImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('name', instance.name); - writeNotNull('id', instance.id); - writeNotNull('originalRequest', instance.originalRequest?.toJson()); - writeNotNull('_postman_previewlanguage', instance.postmanPreviewLanguage); - writeNotNull('responseTime', instance.responseTime); - writeNotNull('timings', instance.timings); - writeNotNull('header', instance.header); - writeNotNull('cookie', instance.cookie?.map((e) => e.toJson()).toList()); - writeNotNull('body', instance.body); - writeNotNull('status', instance.status); - writeNotNull('code', instance.code); - return val; -} - -_$PostmanCollectionCookieImpl _$$PostmanCollectionCookieImplFromJson( - Map json) => - _$PostmanCollectionCookieImpl( - domain: json['domain'] as String, - expires: json['expires'], - maxAge: json['maxAge'] as String?, - hostOnly: json['hostOnly'] as bool?, - httpOnly: json['httpOnly'] as bool?, - name: json['name'] as String?, - path: json['path'] as String?, - secure: json['secure'] as bool?, - session: json['session'] as bool?, - value: json['value'] as String?, - extensions: json['extensions'], - ); - -Map _$$PostmanCollectionCookieImplToJson( - _$PostmanCollectionCookieImpl instance) { - final val = { - 'domain': instance.domain, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('expires', instance.expires); - writeNotNull('maxAge', instance.maxAge); - writeNotNull('hostOnly', instance.hostOnly); - writeNotNull('httpOnly', instance.httpOnly); - writeNotNull('name', instance.name); - writeNotNull('path', instance.path); - writeNotNull('secure', instance.secure); - writeNotNull('session', instance.session); - writeNotNull('value', instance.value); - writeNotNull('extensions', instance.extensions); - return val; -} - -_$PostmanCollectionCertificateImpl _$$PostmanCollectionCertificateImplFromJson( - Map json) => - _$PostmanCollectionCertificateImpl( - name: json['name'] as String?, - matches: - (json['matches'] as List?)?.map((e) => e as String).toList(), - key: json['key'] == null - ? null - : PostmanCollectionCertificateSrc.fromJson( - json['key'] as Map), - cert: json['cert'] == null - ? null - : PostmanCollectionCertificateSrc.fromJson( - json['cert'] as Map), - passphrase: json['passphrase'] as String?, - ); - -Map _$$PostmanCollectionCertificateImplToJson( - _$PostmanCollectionCertificateImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('name', instance.name); - writeNotNull('matches', instance.matches); - writeNotNull('key', instance.key?.toJson()); - writeNotNull('cert', instance.cert?.toJson()); - writeNotNull('passphrase', instance.passphrase); - return val; -} - -_$PostmanCollectionCertificateSrcImpl - _$$PostmanCollectionCertificateSrcImplFromJson(Map json) => - _$PostmanCollectionCertificateSrcImpl( - src: json['src'] as String?, - ); - -Map _$$PostmanCollectionCertificateSrcImplToJson( - _$PostmanCollectionCertificateSrcImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('src', instance.src); - return val; -} - -_$PostmanCollectionProxyConfigImpl _$$PostmanCollectionProxyConfigImplFromJson( - Map json) => - _$PostmanCollectionProxyConfigImpl( - match: json['match'] as String?, - host: json['host'] as String?, - port: (json['port'] as num?)?.toInt(), - tunnel: json['tunnel'] as bool?, - disabled: json['disabled'] as bool?, - ); - -Map _$$PostmanCollectionProxyConfigImplToJson( - _$PostmanCollectionProxyConfigImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('match', instance.match); - writeNotNull('host', instance.host); - writeNotNull('port', instance.port); - writeNotNull('tunnel', instance.tunnel); - writeNotNull('disabled', instance.disabled); - return val; -} - -_$PostmanCollectionHeaderImpl _$$PostmanCollectionHeaderImplFromJson( - Map json) => - _$PostmanCollectionHeaderImpl( - key: json['key'] as String, - value: json['value'] as String, - type: json['type'] as String?, - disabled: json['disabled'] as bool?, - description: json['description'] as String?, - ); - -Map _$$PostmanCollectionHeaderImplToJson( - _$PostmanCollectionHeaderImpl instance) { - final val = { - 'key': instance.key, - 'value': instance.value, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('type', instance.type); - writeNotNull('disabled', instance.disabled); - writeNotNull('description', instance.description); - return val; -} diff --git a/packages/postman_collection/pubspec.yaml b/packages/postman_collection/pubspec.yaml deleted file mode 100644 index e5a9338b..00000000 --- a/packages/postman_collection/pubspec.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: postman_collection -description: postman collection schema with freezed and json_serializable -version: 0.0.9 -homepage: https://pub.dev/packages/postman_collection -repository: https://github.com/masreplay/postman_collection -topics: [postman, dio, doc, documentation, dart] - -environment: - sdk: ">=3.5.0 <4.0.0" - -dependencies: - dio: ^5.5.0+1 - freezed_annotation: ^2.4.3 - json_annotation: ^4.9.0 - retrofit: ^4.1.0 - -dev_dependencies: - test: ^1.24.0 - lints: ^3.0.0 - - build_runner: ^2.4.11 - freezed: ^2.5.6 - retrofit_generator: ^8.1.2 - json_serializable: ^6.8.0 - -scripts: - w: dart run build_runner watch --delete-conflicting-outputs - g: dart run build_runner build --delete-conflicting-outputs - - publish: flutter pub publish --force diff --git a/packages/postman_collection/screenshots/postman.png b/packages/postman_collection/screenshots/postman.png deleted file mode 100644 index 3e1719a0..00000000 Binary files a/packages/postman_collection/screenshots/postman.png and /dev/null differ diff --git a/packages/postman_collection/test/assets/test1.postman_collection.json b/packages/postman_collection/test/assets/test1.postman_collection.json deleted file mode 100644 index ddd3348c..00000000 --- a/packages/postman_collection/test/assets/test1.postman_collection.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "info": { - "_postman_id": "94c8d88c-73b2-4ea5-9bc1-2d072ccf640b", - "name": "API V1.0.0", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "36446860", - "_collection_link": "https://jawahar-developers.postman.co/workspace/Jawahar-Developers-Workspace~ef5b77c1-f301-41a2-b887-5bda0c8cbb97/collection/36424119-94c8d88c-73b2-4ea5-9bc1-2d072ccf640b?action=share&source=collection_link&creator=36446860" - }, - "item": [ - { - "name": "Auth Using OTP", - "item": [ - { - "name": "Send", - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Accept-Language", - "value": "{{language}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"phone\": \"+9647713000846\",\n \t\"channel\": \"twilio\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{endpoint}}/auth/otp/send", - "host": [ - "{{endpoint}}" - ], - "path": [ - "auth", - "otp", - "send" - ] - }, - "description": "available channels: twilio, whatsapp" - }, - "response": [] - }, - { - "name": "Verify", - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Accept-Language", - "value": "{{language}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"phone\": \"+9647713000846\",\n \t\"code\": \"236337\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{endpoint}}/auth/otp/verify", - "host": [ - "{{endpoint}}" - ], - "path": [ - "auth", - "otp", - "verify" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Auth Using Social", - "item": [ - { - "name": "Provider Redirect", - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/atom+xml", - "type": "text" - }, - { - "key": "Accept-Language", - "value": "{{language}}", - "type": "text" - } - ], - "url": { - "raw": "{{endpoint}}/auth/social/redirect?provider=google", - "host": [ - "{{endpoint}}" - ], - "path": [ - "auth", - "social", - "redirect" - ], - "query": [ - { - "key": "provider", - "value": "google" - } - ] - } - }, - "response": [] - }, - { - "name": "Provider Callback", - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Accept-Language", - "value": "{{language}}", - "type": "text" - } - ], - "url": { - "raw": "{{endpoint}}/auth/social/callback?provider={{provider}}", - "host": [ - "{{endpoint}}" - ], - "path": [ - "auth", - "social", - "callback" - ], - "query": [ - { - "key": "provider", - "value": "{{provider}}" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Cart", - "item": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] -} \ No newline at end of file diff --git a/packages/postman_collection/test/assets/test1.temp.postman_collection.json b/packages/postman_collection/test/assets/test1.temp.postman_collection.json deleted file mode 100644 index ddd3348c..00000000 --- a/packages/postman_collection/test/assets/test1.temp.postman_collection.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "info": { - "_postman_id": "94c8d88c-73b2-4ea5-9bc1-2d072ccf640b", - "name": "API V1.0.0", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "36446860", - "_collection_link": "https://jawahar-developers.postman.co/workspace/Jawahar-Developers-Workspace~ef5b77c1-f301-41a2-b887-5bda0c8cbb97/collection/36424119-94c8d88c-73b2-4ea5-9bc1-2d072ccf640b?action=share&source=collection_link&creator=36446860" - }, - "item": [ - { - "name": "Auth Using OTP", - "item": [ - { - "name": "Send", - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Accept-Language", - "value": "{{language}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"phone\": \"+9647713000846\",\n \t\"channel\": \"twilio\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{endpoint}}/auth/otp/send", - "host": [ - "{{endpoint}}" - ], - "path": [ - "auth", - "otp", - "send" - ] - }, - "description": "available channels: twilio, whatsapp" - }, - "response": [] - }, - { - "name": "Verify", - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Accept-Language", - "value": "{{language}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"phone\": \"+9647713000846\",\n \t\"code\": \"236337\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{endpoint}}/auth/otp/verify", - "host": [ - "{{endpoint}}" - ], - "path": [ - "auth", - "otp", - "verify" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Auth Using Social", - "item": [ - { - "name": "Provider Redirect", - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/atom+xml", - "type": "text" - }, - { - "key": "Accept-Language", - "value": "{{language}}", - "type": "text" - } - ], - "url": { - "raw": "{{endpoint}}/auth/social/redirect?provider=google", - "host": [ - "{{endpoint}}" - ], - "path": [ - "auth", - "social", - "redirect" - ], - "query": [ - { - "key": "provider", - "value": "google" - } - ] - } - }, - "response": [] - }, - { - "name": "Provider Callback", - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Accept-Language", - "value": "{{language}}", - "type": "text" - } - ], - "url": { - "raw": "{{endpoint}}/auth/social/callback?provider={{provider}}", - "host": [ - "{{endpoint}}" - ], - "path": [ - "auth", - "social", - "callback" - ], - "query": [ - { - "key": "provider", - "value": "{{provider}}" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Cart", - "item": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "packages": {}, - "exec": [ - "" - ] - } - } - ] -} \ No newline at end of file diff --git a/packages/postman_collection/test/assets/test2.postman_collection.json b/packages/postman_collection/test/assets/test2.postman_collection.json deleted file mode 100644 index 29fbec57..00000000 --- a/packages/postman_collection/test/assets/test2.postman_collection.json +++ /dev/null @@ -1,3202 +0,0 @@ -{ - "info": { - "_postman_id": "fc087688-8125-4c99-9f67-e1f49bc17601", - "name": "Discounts", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "28682686" - }, - "item": [ - { - "name": "Mobile Platform Requests", - "item": [ - { - "name": "Login", - "item": [ - { - "name": "Mobile User Login by phone", - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"phone\": \"151452222225\",//\"11166626211\", //\"11166626211\",//\"151452252225\",//\"07221112262\",\r\n \"password\": \"11111\"//\"11111\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/login/mobile_user/phone", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "login", - "mobile_user", - "phone" - ] - }, - "description": "Login using username and password" - }, - "response": [] - }, - { - "name": "Mobile User Login by email", - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"email\":\"mustafa17falah@gmail.com\",\r\n\t\"password\":\"111111\",\r\n \"device_token\":\"alfmalgmakmgkamgakmgakgnakgn\"\r\n\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/login/mobile_user/email", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "login", - "mobile_user", - "email" - ] - }, - "description": "Login using username and password" - }, - "response": [] - } - ] - }, - { - "name": "Create", - "item": [ - { - "name": "0-Create Temp Mobile user", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\r\n \"phone\": \"9647709251462\",\r\n \"user_type\": \"end_user\",\r\n \"full_name\": \"Raafat Salih\"//,\r\n //\"business_name\": \"Techs comp\"\r\n}\r\n\r\n", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user" - ] - }, - "description": "Create a new user" - }, - "response": [ - { - "name": "Seller by email", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"email\": \"raafat.muhammad@coeng.uobaghdad.edu.iq\",\r\n \"user_type\": \"seller\",\r\n \"business_name\": \"Techs comp\",\r\n \"lang\": \"en\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "Seller phone", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"phone\": \"07222222262\",\r\n \"user_type\": \"seller\",\r\n \"business_name\": \"Techs comp\",\r\n \"lang\": \"en\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "End user email", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"email\": \"fafafffa@khasom.com\",\r\n \"user_type\": \"end_user\",\r\n \"full_name\": \"Raafat Salih\",\r\n \"lang\": \"en\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "End user phone", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"phone\": \"07221112262\",\r\n \"user_type\": \"end_user\",\r\n \"full_name\": \"Raafat Salih\",\r\n \"lang\": \"en\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "1-Validate Mobile user", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"temp_id\": 128,\r\n \"code\": \"111111\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user_validate", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user_validate" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "2A-Create Seller", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":128,\r\n \"full_name\":\"Raafat S mi=uhammad\",\r\n \"business_name\":\"Hankoush\",\r\n \"password\":\"111111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"phone\":\"9647709251462\",\r\n \"email\":\"2222@aaffaa.ccc\",\r\n \"device_token\":\"TestTokenHere\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller" - ] - }, - "description": "Create a new user" - }, - "response": [ - { - "name": "Complete seller by email", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":88,\r\n \"full_name\":\"Raafat S mi=uhammad\",\r\n \"password\":\"111111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"phone\":\"9647709251462\",\r\n \"device_token\":\"TestTokenHere\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "Complete seller by phone", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":125,\r\n \"full_name\":\"Raafat S mi=uhammad\",\r\n \"password\":\"111111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"firebase_jwt\": \"eyJhbGciOiJSUzI1NiIsImtpZCI6IjU0NWUyNDZjNTEwNmExMGQ2MzFiMTA0M2E3MWJiNTllNWJhMGM5NGQiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20va2hhc2FvbS1kZXYiLCJhdWQiOiJraGFzYW9tLWRldiIsImF1dGhfdGltZSI6MTY4NjE3MjIxOSwidXNlcl9pZCI6Imh1bFB5SFVrZ1dXMEQ5bVVabDZmRGtEQWxHSzIiLCJzdWIiOiJodWxQeUhVa2dXVzBEOW1VWmw2ZkRrREFsR0syIiwiaWF0IjoxNjg2MTcyMjE5LCJleHAiOjE2ODYxNzU4MTksInBob25lX251bWJlciI6Iis5NjQ3NzA0Njg3MTI2IiwiZmlyZWJhc2UiOnsiaWRlbnRpdGllcyI6eyJwaG9uZSI6WyIrOTY0NzcwNDY4NzEyNiJdfSwic2lnbl9pbl9wcm92aWRlciI6InBob25lIn19.GAxSvEF-rIbkcq1IGhiEc32ABpfW7TduDw_71vcfB38iBB3p-OtrtH740JhKNcE_z9VWHisiuJ0Q_tNZEfOFVY5Fjbq-OLQ56AfNoELmhXsNLww6ButWCNV6__z-eier3y0vcPpFKMn0p9OgqBOUpazwrAYXU81I4fBRpy0Jxg26aT26ZGnFVFh3yAC3cO0er6cGsm002-FrKHdDjCgSiagcQkkGe_MGGimSD3Gi_6JdDi2XbCIjCn2GuIBTgsXbe8Ytg1NIQl1rXSDT9LL-LjvLRl8ywNRRgntJ0ghGctMc4U7yAfIXYKMQ0-F5qjHcGpF_rWJLwPHJLZ_cEHLKJQ\",\r\n \"firebase_uid\": 1,\r\n \"device_token\":\"TestTokenHere\",\r\n \"email\":\"4444@aaffaa.ccc\",\r\n \"lang\": \"en\"\r\n \r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "2B-Create End User", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":47,\r\n \"full_name\":\"Raafat S mi=uhammad\",\r\n \"business_name\":\"Hankoush\",\r\n \"password\":\"11111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"phone\":\"07709251411\",\r\n \"email\":\"aadddashhss@aaffaa.ccc\",\r\n \"device_token\":\"TestTokenHere\",\r\n \"lang\": \"en\"\r\n \r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/end_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "end_user" - ] - }, - "description": "Create a new user" - }, - "response": [ - { - "name": "Complete end user by email", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":67,\r\n \"password\":\"11111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"phone\":\"51515155151\",\r\n \"device_token\":\"TestTokenHere\",\r\n \"lang\": \"en\"\r\n \r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/end_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "end_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "Complete end user by phone", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":63,\r\n \"password\":\"111111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"firebase_jwt\": \"eyJhbGciOiJSUzI1NiIsImtpZCI6IjU0NWUyNDZjNTEwNmExMGQ2MzFiMTA0M2E3MWJiNTllNWJhMGM5NGQiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20va2hhc2FvbS1kZXYiLCJhdWQiOiJraGFzYW9tLWRldiIsImF1dGhfdGltZSI6MTY4NjE3MjIxOSwidXNlcl9pZCI6Imh1bFB5SFVrZ1dXMEQ5bVVabDZmRGtEQWxHSzIiLCJzdWIiOiJodWxQeUhVa2dXVzBEOW1VWmw2ZkRrREFsR0syIiwiaWF0IjoxNjg2MTcyMjE5LCJleHAiOjE2ODYxNzU4MTksInBob25lX251bWJlciI6Iis5NjQ3NzA0Njg3MTI2IiwiZmlyZWJhc2UiOnsiaWRlbnRpdGllcyI6eyJwaG9uZSI6WyIrOTY0NzcwNDY4NzEyNiJdfSwic2lnbl9pbl9wcm92aWRlciI6InBob25lIn19.GAxSvEF-rIbkcq1IGhiEc32ABpfW7TduDw_71vcfB38iBB3p-OtrtH740JhKNcE_z9VWHisiuJ0Q_tNZEfOFVY5Fjbq-OLQ56AfNoELmhXsNLww6ButWCNV6__z-eier3y0vcPpFKMn0p9OgqBOUpazwrAYXU81I4fBRpy0Jxg26aT26ZGnFVFh3yAC3cO0er6cGsm002-FrKHdDjCgSiagcQkkGe_MGGimSD3Gi_6JdDi2XbCIjCn2GuIBTgsXbe8Ytg1NIQl1rXSDT9LL-LjvLRl8ywNRRgntJ0ghGctMc4U7yAfIXYKMQ0-F5qjHcGpF_rWJLwPHJLZ_cEHLKJQ\",\r\n \"firebase_uid\": 1,\r\n \"device_token\":\"TestTokenHere\",\r\n \"email\":\"1234@1234.ccc\",\r\n \"lang\": \"en\"\r\n \r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/end_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "end_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - } - ] - } - ] - }, - { - "name": "End Users", - "item": [ - { - "name": "Get All end users", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/end_user?page=1&limit=4&lite=0", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "end_user" - ], - "query": [ - { - "key": "page", - "value": "1" - }, - { - "key": "limit", - "value": "4" - }, - { - "key": "lite", - "value": "0" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get End User By ID", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/end_user/32", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "end_user", - "32" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Change Mobile User Password", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"old_password\":\"admin222\", //*\r\n\t\"new_password\":\"adminadmin\" //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/change_password/14", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "change_password", - "14" - ] - }, - "description": "Change password, if admin, no need for old password" - }, - "response": [] - }, - { - "name": "Update seller (no mandatory field)", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"full_name\":\"Raafat S mi=uhamfttmad\",\r\n \"business_name\":\"Hankoush\", \r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"enable\":true, // only if admin, not applicable from same user\r\n \"approve\":true // only if admin, not applicable from same user\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller/31", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller", - "31" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Admin Panel Requests", - "item": [ - { - "name": "Sellers", - "item": [ - { - "name": "Get all sellers", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller?page=1&limit=4&lite=0", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller" - ], - "query": [ - { - "key": "page", - "value": "1" - }, - { - "key": "limit", - "value": "4" - }, - { - "key": "lite", - "value": "0" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get seller By ID", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller/2", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller", - "2" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Create Seller", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"full_name\":\"Raafat S mi=uhammad\",\r\n \"business_name\":\"Hankoush\",\r\n \"password\":\"111111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"phone\":\"9646663651462\",\r\n \"email\":\"2123af632@aaffaaaaaa.ccc\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Update seller (no mandatory field)", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"full_name\":\"Raafat S mi=uhamfttmad\",\r\n \"business_name\":\"Hankoush\", \r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"enable\":true, // only if admin, not applicable from same user\r\n \"approve\":true // only if admin, not applicable from same user\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller/31", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller", - "31" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Update seller", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"full_name\":\"Raafat S mi=uhamfttmad\",\r\n \"business_name\":\"Hankoush\", \r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"enable\":true,\r\n \"approve\":true\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller/8", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller", - "8" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Accounts", - "item": [ - { - "name": "Create Account", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - }, - { - "key": "enctype", - "value": "multipart/form-data", - "type": "text", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"account_name\": \"New Account\", // *\r\n \"phone\": \"07713451918\", // *\r\n \"email\": \"fadiramzi.99@gmail.com\", //*\r\n \"push_limits\":0, \r\n \"sms_limits\": 3,\r\n \"expire_at\":\"2023-07-22\", // *\r\n \"cities\":[2,5,1] // *\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/accounts/", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "accounts", - "" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Update account image (all fields are mandatory)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - }, - { - "key": "enctype", - "value": "multipart/form-data", - "type": "text", - "disabled": true - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "image", - "type": "file", - "src": "/C:/Users/buffo/OneDrive/Desktop/images.jpeg" - }, - { - "key": "account_id", - "value": "1", - "type": "text" - } - ] - }, - "url": { - "raw": "{{server_name}}/api/v1/accounts/image", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "accounts", - "image" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get Account By ID", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/accounts/1", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "accounts", - "1" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get All Accounts", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/accounts?page=1&limit=1&lite=0", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "accounts" - ], - "query": [ - { - "key": "page", - "value": "1" - }, - { - "key": "limit", - "value": "1" - }, - { - "key": "lite", - "value": "0" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Update Account (no mandatory fields)", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"account_name\": \"New 111\",\r\n \"phone\": \"07713451918\",\r\n \"email\": \"fadiramzi.99@gmail.com\",\r\n \"push_limits\":10,\r\n \"sms_limits\": 4,\r\n \"expire_at\":\"2023-07-22\",\r\n \"cities\":[2,5,1],\r\n \"enable\":1\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/accounts/2", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "accounts", - "2" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Admin Users", - "item": [ - { - "name": "Update Admin", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"email\": \"tes2ddddt@test.com\", //*\r\n \"enabled\":true, //*\r\n \"roles\": [2,4] //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins/3", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins", - "3" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Create Admin", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"username\": \"ffafffafffafaf\", //*\r\n \"password\": \"admin222\", //*\r\n \"email\": \"tes't@test.co;m\",\r\n \"account_id\":6,\r\n \"roles\": [3] //*\r\n }", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get All Admins", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins?page=1&limit=4&lite=1", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins" - ], - "query": [ - { - "key": "page", - "value": "1" - }, - { - "key": "limit", - "value": "4" - }, - { - "key": "lite", - "value": "1" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get Admin User By ID", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins/1", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins", - "1" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Delete Admin By ID", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins/1", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins", - "1" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Change Admin Password", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"old_password\":\"\", //* if admin or superadmin, send it empty or anything, it will not chekced\r\n\t\"new_password\":\"adminadmin\" //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins/change_password/3", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins", - "change_password", - "3" - ] - }, - "description": "Change password, if admin, no need for old password" - }, - "response": [] - } - ] - }, - { - "name": "Change Mobile User Password", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"old_password\":\"admin222\", //*\r\n\t\"new_password\":\"adminadmin\" //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/change_password/14", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "change_password", - "14" - ] - }, - "description": "Change password, if admin, no need for old password" - }, - "response": [] - }, - { - "name": "Admin Login", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.environment.set('token', pm.response.json().data.token);\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"username\":\"administrator\",\r\n\t\"password\":\"admin\" //adminadmin\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/login/admin", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "login", - "admin" - ] - }, - "description": "Login using username and password" - }, - "response": [ - { - "name": "Super Admin", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"username\":\"administrator\",\r\n\t\"password\":\"admin\",\r\n \"lang\":\"en\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/login/admin", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "login", - "admin" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "Accout Admin", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"username\":\"admin1\",\r\n\t\"password\":\"admin\",\r\n \"lang\":\"en\"\r\n\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/login/admin", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "login", - "admin" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - } - ] - } - ] - }, - { - "name": "Service Locations", - "item": [ - { - "name": "Assign sevice locations", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"service_locations\":[1] //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/sellers_locations", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "sellers_locations" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get Service Location By user id", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/sellers_locations/29", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "sellers_locations", - "29" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "NOT YET Get All Service locations", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"lang\":\"ar\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/sellers_locations", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "sellers_locations" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Categories", - "item": [ - { - "name": "Update category image", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - }, - { - "key": "enctype", - "value": "multipart/form-data", - "type": "text", - "disabled": true - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "image", - "type": "file", - "src": "/C:/Users/buffo/OneDrive/Desktop/MySql upgrade.png" - }, - { - "key": "category_id", - "value": "9", - "type": "text" - } - ] - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/image", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "image" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get all categories", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Create Category", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"en_name\": \"General555\", //*\r\n \"ar_name\": \"1عام\",//*\r\n \"kur_name\": \"عام\"//*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Update Category", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"en_name\": \"General33\", //*\r\n \"ar_name\": \"1عام 222\", //*\r\n \"kur_name\": \"413عام\" //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/2", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "2" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Subscriptions", - "item": [ - { - "name": "Subscribe", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"subscription_id\": \"1\",\r\n \"lang\":\"en\"\r\n }", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/subscriptions/14", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "subscriptions", - "14" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get User Subscription", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"subscription_id\": \"1\",\r\n \"lang\":\"en\"\r\n }", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/subscriptions/14", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "subscriptions", - "14" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "ADS", - "item": [ - { - "name": "Create AD", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "title", - "value": " \"Ad Title\"", - "type": "text" - }, - { - "key": "description", - "value": " \"Ad Description\"", - "type": "text" - }, - { - "key": "category_id", - "value": " 1", - "type": "text" - }, - { - "key": "type", - "value": " \"general\"", - "type": "text" - }, - { - "key": "discount_percent", - "value": " 10", - "type": "text" - }, - { - "key": "new_price", - "value": " 50", - "type": "text" - }, - { - "key": "currency", - "value": " \"IQD\"", - "type": "text" - }, - { - "key": "start_date", - "value": " \"2023-05-21\"", - "type": "text" - }, - { - "key": "activation_period", - "value": " 30", - "type": "text" - }, - { - "key": "start_time", - "value": " \"09:00:00\"", - "type": "text" - }, - { - "key": "end_time", - "value": " \"18:00:00\"", - "type": "text" - }, - { - "key": "images", - "type": "file", - "src": "/C:/Users/buffo/OneDrive/Desktop/زيودي.jpg" - }, - { - "key": "images", - "type": "file", - "src": "/C:/Users/buffo/OneDrive/Desktop/Screenshot_3.png" - } - ] - }, - "url": { - "raw": "{{server_name}}/api/v1/ads", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "ads" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get all ADs", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/ads", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "ads" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Seller Categories", - "item": [ - { - "name": "Get seller categories", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "seller" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Assign category to seller", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "jwt", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7InVzZXJfaWQiOjE3LCJwaG9uZSI6IjExMTY2NjI2MjExIiwiZW1haWwiOiJhZDN4c2FhM25Aa2hhc29tLmNvbSIsInVzZXJfdHlwZSI6Im1vYmlsZV91c2VyIiwicm9sZXMiOltdLCJhY2NvdW50X2lkIjoxLCJzZXJ2aWNlX2xvY2F0aW9ucyI6W3siaWQiOjEsIm5hbWUiOiLYp9mE2KPZhtio2KfYsSJ9LHsiaWQiOjE0LCJuYW1lIjoi2KfZhNmF2KvZhtmJIn1dLCJsYW5nIjoiZW4ifSwiaWF0IjoxNjg0MDg5NDU0LCJleHAiOjE2ODQxMzI2NTR9.zZ-2Tl1fwdqpuqp4j8lsKTxp9j9KY2imsrOMTgkIU8A", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"categories\":[1,2] //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "seller" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "User Categories", - "item": [ - { - "name": "Get end user categories", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/end_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "end_user" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Assign category to end_user", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "jwt", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7InVzZXJfaWQiOjE3LCJwaG9uZSI6IjExMTY2NjI2MjExIiwiZW1haWwiOiJhZDN4c2FhM25Aa2hhc29tLmNvbSIsInVzZXJfdHlwZSI6Im1vYmlsZV91c2VyIiwicm9sZXMiOltdLCJhY2NvdW50X2lkIjoxLCJzZXJ2aWNlX2xvY2F0aW9ucyI6W3siaWQiOjEsIm5hbWUiOiLYp9mE2KPZhtio2KfYsSJ9LHsiaWQiOjE0LCJuYW1lIjoi2KfZhNmF2KvZhtmJIn1dLCJsYW5nIjoiZW4ifSwiaWF0IjoxNjg0MDg5NDU0LCJleHAiOjE2ODQxMzI2NTR9.zZ-2Tl1fwdqpuqp4j8lsKTxp9j9KY2imsrOMTgkIU8A", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"categories\":[1,2]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/end_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "end_user" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Get accounts media", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/media/accounts?file=abcd.jpg", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "media", - "accounts" - ], - "query": [ - { - "key": "file", - "value": "abcd.jpg" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get sellers media", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/media/seller?file=abcd.jpg", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "media", - "seller" - ], - "query": [ - { - "key": "file", - "value": "abcd.jpg" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ], - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "variable": [ - { - "key": "server_name", - "value": "http://85.159.214.45", - "type": "string" - }, - { - "key": "token", - "value": "", - "type": "string" - }, - { - "key": "server_name", - "value": "", - "type": "string", - "disabled": true - }, - { - "key": "token", - "value": "", - "type": "string", - "disabled": true - }, - { - "key": "HOST", - "value": "http://85.159.214.45:3000", - "disabled": true - } - ] -} \ No newline at end of file diff --git a/packages/postman_collection/test/assets/test2.temp.postman_collection.json b/packages/postman_collection/test/assets/test2.temp.postman_collection.json deleted file mode 100644 index 29fbec57..00000000 --- a/packages/postman_collection/test/assets/test2.temp.postman_collection.json +++ /dev/null @@ -1,3202 +0,0 @@ -{ - "info": { - "_postman_id": "fc087688-8125-4c99-9f67-e1f49bc17601", - "name": "Discounts", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "28682686" - }, - "item": [ - { - "name": "Mobile Platform Requests", - "item": [ - { - "name": "Login", - "item": [ - { - "name": "Mobile User Login by phone", - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"phone\": \"151452222225\",//\"11166626211\", //\"11166626211\",//\"151452252225\",//\"07221112262\",\r\n \"password\": \"11111\"//\"11111\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/login/mobile_user/phone", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "login", - "mobile_user", - "phone" - ] - }, - "description": "Login using username and password" - }, - "response": [] - }, - { - "name": "Mobile User Login by email", - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"email\":\"mustafa17falah@gmail.com\",\r\n\t\"password\":\"111111\",\r\n \"device_token\":\"alfmalgmakmgkamgakmgakgnakgn\"\r\n\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/login/mobile_user/email", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "login", - "mobile_user", - "email" - ] - }, - "description": "Login using username and password" - }, - "response": [] - } - ] - }, - { - "name": "Create", - "item": [ - { - "name": "0-Create Temp Mobile user", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\r\n \"phone\": \"9647709251462\",\r\n \"user_type\": \"end_user\",\r\n \"full_name\": \"Raafat Salih\"//,\r\n //\"business_name\": \"Techs comp\"\r\n}\r\n\r\n", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user" - ] - }, - "description": "Create a new user" - }, - "response": [ - { - "name": "Seller by email", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"email\": \"raafat.muhammad@coeng.uobaghdad.edu.iq\",\r\n \"user_type\": \"seller\",\r\n \"business_name\": \"Techs comp\",\r\n \"lang\": \"en\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "Seller phone", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"phone\": \"07222222262\",\r\n \"user_type\": \"seller\",\r\n \"business_name\": \"Techs comp\",\r\n \"lang\": \"en\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "End user email", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"email\": \"fafafffa@khasom.com\",\r\n \"user_type\": \"end_user\",\r\n \"full_name\": \"Raafat Salih\",\r\n \"lang\": \"en\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "End user phone", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"phone\": \"07221112262\",\r\n \"user_type\": \"end_user\",\r\n \"full_name\": \"Raafat Salih\",\r\n \"lang\": \"en\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "1-Validate Mobile user", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"temp_id\": 128,\r\n \"code\": \"111111\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user_validate", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user_validate" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "2A-Create Seller", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":128,\r\n \"full_name\":\"Raafat S mi=uhammad\",\r\n \"business_name\":\"Hankoush\",\r\n \"password\":\"111111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"phone\":\"9647709251462\",\r\n \"email\":\"2222@aaffaa.ccc\",\r\n \"device_token\":\"TestTokenHere\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller" - ] - }, - "description": "Create a new user" - }, - "response": [ - { - "name": "Complete seller by email", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":88,\r\n \"full_name\":\"Raafat S mi=uhammad\",\r\n \"password\":\"111111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"phone\":\"9647709251462\",\r\n \"device_token\":\"TestTokenHere\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "Complete seller by phone", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":125,\r\n \"full_name\":\"Raafat S mi=uhammad\",\r\n \"password\":\"111111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"firebase_jwt\": \"eyJhbGciOiJSUzI1NiIsImtpZCI6IjU0NWUyNDZjNTEwNmExMGQ2MzFiMTA0M2E3MWJiNTllNWJhMGM5NGQiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20va2hhc2FvbS1kZXYiLCJhdWQiOiJraGFzYW9tLWRldiIsImF1dGhfdGltZSI6MTY4NjE3MjIxOSwidXNlcl9pZCI6Imh1bFB5SFVrZ1dXMEQ5bVVabDZmRGtEQWxHSzIiLCJzdWIiOiJodWxQeUhVa2dXVzBEOW1VWmw2ZkRrREFsR0syIiwiaWF0IjoxNjg2MTcyMjE5LCJleHAiOjE2ODYxNzU4MTksInBob25lX251bWJlciI6Iis5NjQ3NzA0Njg3MTI2IiwiZmlyZWJhc2UiOnsiaWRlbnRpdGllcyI6eyJwaG9uZSI6WyIrOTY0NzcwNDY4NzEyNiJdfSwic2lnbl9pbl9wcm92aWRlciI6InBob25lIn19.GAxSvEF-rIbkcq1IGhiEc32ABpfW7TduDw_71vcfB38iBB3p-OtrtH740JhKNcE_z9VWHisiuJ0Q_tNZEfOFVY5Fjbq-OLQ56AfNoELmhXsNLww6ButWCNV6__z-eier3y0vcPpFKMn0p9OgqBOUpazwrAYXU81I4fBRpy0Jxg26aT26ZGnFVFh3yAC3cO0er6cGsm002-FrKHdDjCgSiagcQkkGe_MGGimSD3Gi_6JdDi2XbCIjCn2GuIBTgsXbe8Ytg1NIQl1rXSDT9LL-LjvLRl8ywNRRgntJ0ghGctMc4U7yAfIXYKMQ0-F5qjHcGpF_rWJLwPHJLZ_cEHLKJQ\",\r\n \"firebase_uid\": 1,\r\n \"device_token\":\"TestTokenHere\",\r\n \"email\":\"4444@aaffaa.ccc\",\r\n \"lang\": \"en\"\r\n \r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "2B-Create End User", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":47,\r\n \"full_name\":\"Raafat S mi=uhammad\",\r\n \"business_name\":\"Hankoush\",\r\n \"password\":\"11111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"phone\":\"07709251411\",\r\n \"email\":\"aadddashhss@aaffaa.ccc\",\r\n \"device_token\":\"TestTokenHere\",\r\n \"lang\": \"en\"\r\n \r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/end_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "end_user" - ] - }, - "description": "Create a new user" - }, - "response": [ - { - "name": "Complete end user by email", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":67,\r\n \"password\":\"11111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"phone\":\"51515155151\",\r\n \"device_token\":\"TestTokenHere\",\r\n \"lang\": \"en\"\r\n \r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/end_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "end_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "Complete end user by phone", - "originalRequest": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"id\":63,\r\n \"password\":\"111111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"firebase_jwt\": \"eyJhbGciOiJSUzI1NiIsImtpZCI6IjU0NWUyNDZjNTEwNmExMGQ2MzFiMTA0M2E3MWJiNTllNWJhMGM5NGQiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20va2hhc2FvbS1kZXYiLCJhdWQiOiJraGFzYW9tLWRldiIsImF1dGhfdGltZSI6MTY4NjE3MjIxOSwidXNlcl9pZCI6Imh1bFB5SFVrZ1dXMEQ5bVVabDZmRGtEQWxHSzIiLCJzdWIiOiJodWxQeUhVa2dXVzBEOW1VWmw2ZkRrREFsR0syIiwiaWF0IjoxNjg2MTcyMjE5LCJleHAiOjE2ODYxNzU4MTksInBob25lX251bWJlciI6Iis5NjQ3NzA0Njg3MTI2IiwiZmlyZWJhc2UiOnsiaWRlbnRpdGllcyI6eyJwaG9uZSI6WyIrOTY0NzcwNDY4NzEyNiJdfSwic2lnbl9pbl9wcm92aWRlciI6InBob25lIn19.GAxSvEF-rIbkcq1IGhiEc32ABpfW7TduDw_71vcfB38iBB3p-OtrtH740JhKNcE_z9VWHisiuJ0Q_tNZEfOFVY5Fjbq-OLQ56AfNoELmhXsNLww6ButWCNV6__z-eier3y0vcPpFKMn0p9OgqBOUpazwrAYXU81I4fBRpy0Jxg26aT26ZGnFVFh3yAC3cO0er6cGsm002-FrKHdDjCgSiagcQkkGe_MGGimSD3Gi_6JdDi2XbCIjCn2GuIBTgsXbe8Ytg1NIQl1rXSDT9LL-LjvLRl8ywNRRgntJ0ghGctMc4U7yAfIXYKMQ0-F5qjHcGpF_rWJLwPHJLZ_cEHLKJQ\",\r\n \"firebase_uid\": 1,\r\n \"device_token\":\"TestTokenHere\",\r\n \"email\":\"1234@1234.ccc\",\r\n \"lang\": \"en\"\r\n \r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/end_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "end_user" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - } - ] - } - ] - }, - { - "name": "End Users", - "item": [ - { - "name": "Get All end users", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/end_user?page=1&limit=4&lite=0", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "end_user" - ], - "query": [ - { - "key": "page", - "value": "1" - }, - { - "key": "limit", - "value": "4" - }, - { - "key": "lite", - "value": "0" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get End User By ID", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/end_user/32", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "end_user", - "32" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Change Mobile User Password", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"old_password\":\"admin222\", //*\r\n\t\"new_password\":\"adminadmin\" //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/change_password/14", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "change_password", - "14" - ] - }, - "description": "Change password, if admin, no need for old password" - }, - "response": [] - }, - { - "name": "Update seller (no mandatory field)", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"full_name\":\"Raafat S mi=uhamfttmad\",\r\n \"business_name\":\"Hankoush\", \r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"enable\":true, // only if admin, not applicable from same user\r\n \"approve\":true // only if admin, not applicable from same user\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller/31", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller", - "31" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Admin Panel Requests", - "item": [ - { - "name": "Sellers", - "item": [ - { - "name": "Get all sellers", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller?page=1&limit=4&lite=0", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller" - ], - "query": [ - { - "key": "page", - "value": "1" - }, - { - "key": "limit", - "value": "4" - }, - { - "key": "lite", - "value": "0" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get seller By ID", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller/2", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller", - "2" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Create Seller", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"full_name\":\"Raafat S mi=uhammad\",\r\n \"business_name\":\"Hankoush\",\r\n \"password\":\"111111\", \r\n \"city_id\":1,\r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"phone\":\"9646663651462\",\r\n \"email\":\"2123af632@aaffaaaaaa.ccc\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Update seller (no mandatory field)", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"full_name\":\"Raafat S mi=uhamfttmad\",\r\n \"business_name\":\"Hankoush\", \r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"enable\":true, // only if admin, not applicable from same user\r\n \"approve\":true // only if admin, not applicable from same user\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller/31", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller", - "31" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Update seller", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"full_name\":\"Raafat S mi=uhamfttmad\",\r\n \"business_name\":\"Hankoush\", \r\n \"address\":\"Aaaa asda\",\r\n \"nearest_point\":\"ad ad adfa\",\r\n \"enable\":true,\r\n \"approve\":true\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/seller/8", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "seller", - "8" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Accounts", - "item": [ - { - "name": "Create Account", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - }, - { - "key": "enctype", - "value": "multipart/form-data", - "type": "text", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"account_name\": \"New Account\", // *\r\n \"phone\": \"07713451918\", // *\r\n \"email\": \"fadiramzi.99@gmail.com\", //*\r\n \"push_limits\":0, \r\n \"sms_limits\": 3,\r\n \"expire_at\":\"2023-07-22\", // *\r\n \"cities\":[2,5,1] // *\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/accounts/", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "accounts", - "" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Update account image (all fields are mandatory)", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - }, - { - "key": "enctype", - "value": "multipart/form-data", - "type": "text", - "disabled": true - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "image", - "type": "file", - "src": "/C:/Users/buffo/OneDrive/Desktop/images.jpeg" - }, - { - "key": "account_id", - "value": "1", - "type": "text" - } - ] - }, - "url": { - "raw": "{{server_name}}/api/v1/accounts/image", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "accounts", - "image" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get Account By ID", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/accounts/1", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "accounts", - "1" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get All Accounts", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/accounts?page=1&limit=1&lite=0", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "accounts" - ], - "query": [ - { - "key": "page", - "value": "1" - }, - { - "key": "limit", - "value": "1" - }, - { - "key": "lite", - "value": "0" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Update Account (no mandatory fields)", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"account_name\": \"New 111\",\r\n \"phone\": \"07713451918\",\r\n \"email\": \"fadiramzi.99@gmail.com\",\r\n \"push_limits\":10,\r\n \"sms_limits\": 4,\r\n \"expire_at\":\"2023-07-22\",\r\n \"cities\":[2,5,1],\r\n \"enable\":1\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/accounts/2", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "accounts", - "2" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Admin Users", - "item": [ - { - "name": "Update Admin", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"email\": \"tes2ddddt@test.com\", //*\r\n \"enabled\":true, //*\r\n \"roles\": [2,4] //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins/3", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins", - "3" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Create Admin", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"username\": \"ffafffafffafaf\", //*\r\n \"password\": \"admin222\", //*\r\n \"email\": \"tes't@test.co;m\",\r\n \"account_id\":6,\r\n \"roles\": [3] //*\r\n }", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get All Admins", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins?page=1&limit=4&lite=1", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins" - ], - "query": [ - { - "key": "page", - "value": "1" - }, - { - "key": "limit", - "value": "4" - }, - { - "key": "lite", - "value": "1" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get Admin User By ID", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins/1", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins", - "1" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Delete Admin By ID", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins/1", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins", - "1" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Change Admin Password", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"old_password\":\"\", //* if admin or superadmin, send it empty or anything, it will not chekced\r\n\t\"new_password\":\"adminadmin\" //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/admins/change_password/3", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "admins", - "change_password", - "3" - ] - }, - "description": "Change password, if admin, no need for old password" - }, - "response": [] - } - ] - }, - { - "name": "Change Mobile User Password", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"old_password\":\"admin222\", //*\r\n\t\"new_password\":\"adminadmin\" //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/users/mobile_user/change_password/14", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "users", - "mobile_user", - "change_password", - "14" - ] - }, - "description": "Change password, if admin, no need for old password" - }, - "response": [] - }, - { - "name": "Admin Login", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "test", - "script": { - "exec": [ - "pm.environment.set('token', pm.response.json().data.token);\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"username\":\"administrator\",\r\n\t\"password\":\"admin\" //adminadmin\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/login/admin", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "login", - "admin" - ] - }, - "description": "Login using username and password" - }, - "response": [ - { - "name": "Super Admin", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"username\":\"administrator\",\r\n\t\"password\":\"admin\",\r\n \"lang\":\"en\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/login/admin", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "login", - "admin" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - }, - { - "name": "Accout Admin", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"username\":\"admin1\",\r\n\t\"password\":\"admin\",\r\n \"lang\":\"en\"\r\n\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/login/admin", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "login", - "admin" - ] - } - }, - "_postman_previewlanguage": "Text", - "header": [], - "cookie": [], - "body": "" - } - ] - } - ] - }, - { - "name": "Service Locations", - "item": [ - { - "name": "Assign sevice locations", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"service_locations\":[1] //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/sellers_locations", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "sellers_locations" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get Service Location By user id", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/sellers_locations/29", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "sellers_locations", - "29" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "NOT YET Get All Service locations", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"lang\":\"ar\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/sellers_locations", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "sellers_locations" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Categories", - "item": [ - { - "name": "Update category image", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - }, - { - "key": "enctype", - "value": "multipart/form-data", - "type": "text", - "disabled": true - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "image", - "type": "file", - "src": "/C:/Users/buffo/OneDrive/Desktop/MySql upgrade.png" - }, - { - "key": "category_id", - "value": "9", - "type": "text" - } - ] - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/image", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "image" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get all categories", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Create Category", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"en_name\": \"General555\", //*\r\n \"ar_name\": \"1عام\",//*\r\n \"kur_name\": \"عام\"//*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Update Category", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"en_name\": \"General33\", //*\r\n \"ar_name\": \"1عام 222\", //*\r\n \"kur_name\": \"413عام\" //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/2", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "2" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Subscriptions", - "item": [ - { - "name": "Subscribe", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"subscription_id\": \"1\",\r\n \"lang\":\"en\"\r\n }", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/subscriptions/14", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "subscriptions", - "14" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get User Subscription", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"subscription_id\": \"1\",\r\n \"lang\":\"en\"\r\n }", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/subscriptions/14", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "subscriptions", - "14" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "ADS", - "item": [ - { - "name": "Create AD", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "title", - "value": " \"Ad Title\"", - "type": "text" - }, - { - "key": "description", - "value": " \"Ad Description\"", - "type": "text" - }, - { - "key": "category_id", - "value": " 1", - "type": "text" - }, - { - "key": "type", - "value": " \"general\"", - "type": "text" - }, - { - "key": "discount_percent", - "value": " 10", - "type": "text" - }, - { - "key": "new_price", - "value": " 50", - "type": "text" - }, - { - "key": "currency", - "value": " \"IQD\"", - "type": "text" - }, - { - "key": "start_date", - "value": " \"2023-05-21\"", - "type": "text" - }, - { - "key": "activation_period", - "value": " 30", - "type": "text" - }, - { - "key": "start_time", - "value": " \"09:00:00\"", - "type": "text" - }, - { - "key": "end_time", - "value": " \"18:00:00\"", - "type": "text" - }, - { - "key": "images", - "type": "file", - "src": "/C:/Users/buffo/OneDrive/Desktop/زيودي.jpg" - }, - { - "key": "images", - "type": "file", - "src": "/C:/Users/buffo/OneDrive/Desktop/Screenshot_3.png" - } - ] - }, - "url": { - "raw": "{{server_name}}/api/v1/ads", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "ads" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get all ADs", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/ads", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "ads" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Seller Categories", - "item": [ - { - "name": "Get seller categories", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "seller" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Assign category to seller", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "jwt", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7InVzZXJfaWQiOjE3LCJwaG9uZSI6IjExMTY2NjI2MjExIiwiZW1haWwiOiJhZDN4c2FhM25Aa2hhc29tLmNvbSIsInVzZXJfdHlwZSI6Im1vYmlsZV91c2VyIiwicm9sZXMiOltdLCJhY2NvdW50X2lkIjoxLCJzZXJ2aWNlX2xvY2F0aW9ucyI6W3siaWQiOjEsIm5hbWUiOiLYp9mE2KPZhtio2KfYsSJ9LHsiaWQiOjE0LCJuYW1lIjoi2KfZhNmF2KvZhtmJIn1dLCJsYW5nIjoiZW4ifSwiaWF0IjoxNjg0MDg5NDU0LCJleHAiOjE2ODQxMzI2NTR9.zZ-2Tl1fwdqpuqp4j8lsKTxp9j9KY2imsrOMTgkIU8A", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"categories\":[1,2] //*\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/seller", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "seller" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "User Categories", - "item": [ - { - "name": "Get end user categories", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/end_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "end_user" - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Assign category to end_user", - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "PUT", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "jwt", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7InVzZXJfaWQiOjE3LCJwaG9uZSI6IjExMTY2NjI2MjExIiwiZW1haWwiOiJhZDN4c2FhM25Aa2hhc29tLmNvbSIsInVzZXJfdHlwZSI6Im1vYmlsZV91c2VyIiwicm9sZXMiOltdLCJhY2NvdW50X2lkIjoxLCJzZXJ2aWNlX2xvY2F0aW9ucyI6W3siaWQiOjEsIm5hbWUiOiLYp9mE2KPZhtio2KfYsSJ9LHsiaWQiOjE0LCJuYW1lIjoi2KfZhNmF2KvZhtmJIn1dLCJsYW5nIjoiZW4ifSwiaWF0IjoxNjg0MDg5NDU0LCJleHAiOjE2ODQxMzI2NTR9.zZ-2Tl1fwdqpuqp4j8lsKTxp9j9KY2imsrOMTgkIU8A", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"categories\":[1,2]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/categories/end_user", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "categories", - "end_user" - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ] - }, - { - "name": "Get accounts media", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/media/accounts?file=abcd.jpg", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "media", - "accounts" - ], - "query": [ - { - "key": "file", - "value": "abcd.jpg" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - }, - { - "name": "Get sellers media", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.request.headers.add({key: 'Authorization', value: 'Bearer ' + pm.environment.get('token')});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [ - { - "key": "jwt", - "value": "{{token}}", - "type": "text", - "disabled": true - }, - { - "key": "Accept-Language", - "value": "ar", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{server_name}}/api/v1/media/seller?file=abcd.jpg", - "host": [ - "{{server_name}}" - ], - "path": [ - "api", - "v1", - "media", - "seller" - ], - "query": [ - { - "key": "file", - "value": "abcd.jpg" - } - ] - }, - "description": "Create a new user" - }, - "response": [] - } - ], - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{token}}", - "type": "string" - } - ] - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "variable": [ - { - "key": "server_name", - "value": "http://85.159.214.45", - "type": "string" - }, - { - "key": "token", - "value": "", - "type": "string" - }, - { - "key": "server_name", - "value": "", - "type": "string", - "disabled": true - }, - { - "key": "token", - "value": "", - "type": "string", - "disabled": true - }, - { - "key": "HOST", - "value": "http://85.159.214.45:3000", - "disabled": true - } - ] -} \ No newline at end of file diff --git a/packages/postman_collection/test/postman_test.dart b/packages/postman_collection/test/postman_test.dart deleted file mode 100644 index dbb6a538..00000000 --- a/packages/postman_collection/test/postman_test.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:postman_collection/postman_collection.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - test('First Test', () async { - final file = - File('./test/assets/test2.postman_collection_collection.json'); - final content = file.readAsStringSync(); - final actual = jsonDecode(content); - - final actualText = JsonEncoder.withIndent(' ').convert(actual); - print(actualText); - - final matcher = PostmanCollection.fromJson(actual); - final matcherText = - JsonEncoder.withIndent(' ').convert(matcher.toJson()); - // File('./test/assets/test2.temp.postman_collection_collection.json').writeAsStringSync(matcherText); - print(matcherText); - - // deep match [actual] and [matcher] - expect(actual, matcher.toJson()); - }); - }); -} diff --git a/packages/swagger_to_dart/LOCAL_CHANGES.md b/packages/swagger_to_dart/LOCAL_CHANGES.md new file mode 100644 index 00000000..0200365b --- /dev/null +++ b/packages/swagger_to_dart/LOCAL_CHANGES.md @@ -0,0 +1,36 @@ +# Local changes (fork notes) + +This is a fork of the original `swagger_to_dart` package. The changes below were applied locally and are not upstream. + +--- + +## Fix: extension wrapper methods omit query parameters in forwarding call + +**File:** `lib/src/generator/api_client/api_client_generator.dart` +**Around line:** ~288 + +### Problem + +When an endpoint uses `multipart/form-data`, the generator emits two things: + +1. A real `@RestApi` method named `methodName_` (with trailing underscore) that carries the `@Part`, `@Query`, etc. annotations. +2. A convenience wrapper method named `methodName` (no underscore) inside an extension, which accepts the typed request body and forwards the call to `methodName_`. + +The wrapper's forwarding call was hardcoded to only pass `requestBody`, `extras`, optionally `queries`, and the progress/cancel callbacks. **All other query parameters (e.g. `providerId`, `dryRun`, `skipped`) were silently dropped**, so they were never sent to the server. + +### Fix + +Changed the `Code(...)` body of the generated extension method to iterate over all `parameters` that are not the special `queries` parameter and emit `paramName: paramName,` for each one, so every query param declared in the OpenAPI spec is forwarded correctly. + +```dart +// Before +'''return ${methodName}_(..., extras: extras, + ${hasQueries ? 'queries: queries,' : ''} + cancelToken: cancelToken, ...);''' + +// After +'''return ${methodName}_(..., extras: extras, + ${parameters.where((e) => e.name != _queriesParameterName).map((e) => '${e.name}: ${e.name},').join('\n')} + ${hasQueries ? 'queries: queries,' : ''} + cancelToken: cancelToken, ...);''' +``` diff --git a/packages/swagger_to_dart/example/lib/src/freezed/my_response.dart b/packages/swagger_to_dart/example/lib/src/freezed/my_response.dart new file mode 100644 index 00000000..3496b92c --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/freezed/my_response.dart @@ -0,0 +1,16 @@ +import 'package:example/src/gen/models/exports.dart'; + +part 'my_response.freezed.dart'; +part 'my_response.g.dart'; + +@Freezed(unionKey: 'type', when: FreezedWhenOptions.none, map: FreezedMapOptions.none) +sealed class MyResponse with _$MyResponse { + @FreezedUnionValue('create') + const factory MyResponse(CreateOrderLine create) = MyResponseData; + @FreezedUnionValue('update') + const factory MyResponse.special(UpdateOrderLine update) = MyResponseSpecial; + @FreezedUnionValue('delete') + const factory MyResponse.error(DeleteOrderLine delete) = MyResponseError; + + factory MyResponse.fromJson(Map json) => _$MyResponseFromJson(json); +} diff --git a/packages/swagger_to_dart/example/lib/src/freezed/my_response.freezed.dart b/packages/swagger_to_dart/example/lib/src/freezed/my_response.freezed.dart new file mode 100644 index 00000000..58d27aa3 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/freezed/my_response.freezed.dart @@ -0,0 +1,322 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'my_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; +MyResponse _$MyResponseFromJson(Map json) { + switch (json['type']) { + case 'create': + return MyResponseData.fromJson(json); + case 'update': + return MyResponseSpecial.fromJson(json); + case 'delete': + return MyResponseError.fromJson(json); + + default: + throw CheckedFromJsonException( + json, 'type', 'MyResponse', 'Invalid union type "${json['type']}"!'); + } +} + +/// @nodoc +mixin _$MyResponse { + /// Serializes this MyResponse to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is MyResponse); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; + + @override + String toString() { + return 'MyResponse()'; + } +} + +/// @nodoc +class $MyResponseCopyWith<$Res> { + $MyResponseCopyWith(MyResponse _, $Res Function(MyResponse) __); +} + +/// @nodoc +@JsonSerializable() +class MyResponseData implements MyResponse { + const MyResponseData(this.create, {final String? $type}) + : $type = $type ?? 'create'; + factory MyResponseData.fromJson(Map json) => + _$MyResponseDataFromJson(json); + + final CreateOrderLine create; + + @JsonKey(name: 'type') + final String $type; + + /// Create a copy of MyResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MyResponseDataCopyWith get copyWith => + _$MyResponseDataCopyWithImpl(this, _$identity); + + @override + Map toJson() { + return _$MyResponseDataToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MyResponseData && + (identical(other.create, create) || other.create == create)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, create); + + @override + String toString() { + return 'MyResponse(create: $create)'; + } +} + +/// @nodoc +abstract mixin class $MyResponseDataCopyWith<$Res> + implements $MyResponseCopyWith<$Res> { + factory $MyResponseDataCopyWith( + MyResponseData value, $Res Function(MyResponseData) _then) = + _$MyResponseDataCopyWithImpl; + @useResult + $Res call({CreateOrderLine create}); + + $CreateOrderLineCopyWith<$Res> get create; +} + +/// @nodoc +class _$MyResponseDataCopyWithImpl<$Res> + implements $MyResponseDataCopyWith<$Res> { + _$MyResponseDataCopyWithImpl(this._self, this._then); + + final MyResponseData _self; + final $Res Function(MyResponseData) _then; + + /// Create a copy of MyResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({ + Object? create = null, + }) { + return _then(MyResponseData( + null == create + ? _self.create + : create // ignore: cast_nullable_to_non_nullable + as CreateOrderLine, + )); + } + + /// Create a copy of MyResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $CreateOrderLineCopyWith<$Res> get create { + return $CreateOrderLineCopyWith<$Res>(_self.create, (value) { + return _then(_self.copyWith(create: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class MyResponseSpecial implements MyResponse { + const MyResponseSpecial(this.update, {final String? $type}) + : $type = $type ?? 'update'; + factory MyResponseSpecial.fromJson(Map json) => + _$MyResponseSpecialFromJson(json); + + final UpdateOrderLine update; + + @JsonKey(name: 'type') + final String $type; + + /// Create a copy of MyResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MyResponseSpecialCopyWith get copyWith => + _$MyResponseSpecialCopyWithImpl(this, _$identity); + + @override + Map toJson() { + return _$MyResponseSpecialToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MyResponseSpecial && + (identical(other.update, update) || other.update == update)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, update); + + @override + String toString() { + return 'MyResponse.special(update: $update)'; + } +} + +/// @nodoc +abstract mixin class $MyResponseSpecialCopyWith<$Res> + implements $MyResponseCopyWith<$Res> { + factory $MyResponseSpecialCopyWith( + MyResponseSpecial value, $Res Function(MyResponseSpecial) _then) = + _$MyResponseSpecialCopyWithImpl; + @useResult + $Res call({UpdateOrderLine update}); + + $UpdateOrderLineCopyWith<$Res> get update; +} + +/// @nodoc +class _$MyResponseSpecialCopyWithImpl<$Res> + implements $MyResponseSpecialCopyWith<$Res> { + _$MyResponseSpecialCopyWithImpl(this._self, this._then); + + final MyResponseSpecial _self; + final $Res Function(MyResponseSpecial) _then; + + /// Create a copy of MyResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({ + Object? update = null, + }) { + return _then(MyResponseSpecial( + null == update + ? _self.update + : update // ignore: cast_nullable_to_non_nullable + as UpdateOrderLine, + )); + } + + /// Create a copy of MyResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UpdateOrderLineCopyWith<$Res> get update { + return $UpdateOrderLineCopyWith<$Res>(_self.update, (value) { + return _then(_self.copyWith(update: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class MyResponseError implements MyResponse { + const MyResponseError(this.delete, {final String? $type}) + : $type = $type ?? 'delete'; + factory MyResponseError.fromJson(Map json) => + _$MyResponseErrorFromJson(json); + + final DeleteOrderLine delete; + + @JsonKey(name: 'type') + final String $type; + + /// Create a copy of MyResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MyResponseErrorCopyWith get copyWith => + _$MyResponseErrorCopyWithImpl(this, _$identity); + + @override + Map toJson() { + return _$MyResponseErrorToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MyResponseError && + (identical(other.delete, delete) || other.delete == delete)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, delete); + + @override + String toString() { + return 'MyResponse.error(delete: $delete)'; + } +} + +/// @nodoc +abstract mixin class $MyResponseErrorCopyWith<$Res> + implements $MyResponseCopyWith<$Res> { + factory $MyResponseErrorCopyWith( + MyResponseError value, $Res Function(MyResponseError) _then) = + _$MyResponseErrorCopyWithImpl; + @useResult + $Res call({DeleteOrderLine delete}); + + $DeleteOrderLineCopyWith<$Res> get delete; +} + +/// @nodoc +class _$MyResponseErrorCopyWithImpl<$Res> + implements $MyResponseErrorCopyWith<$Res> { + _$MyResponseErrorCopyWithImpl(this._self, this._then); + + final MyResponseError _self; + final $Res Function(MyResponseError) _then; + + /// Create a copy of MyResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({ + Object? delete = null, + }) { + return _then(MyResponseError( + null == delete + ? _self.delete + : delete // ignore: cast_nullable_to_non_nullable + as DeleteOrderLine, + )); + } + + /// Create a copy of MyResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $DeleteOrderLineCopyWith<$Res> get delete { + return $DeleteOrderLineCopyWith<$Res>(_self.delete, (value) { + return _then(_self.copyWith(delete: value)); + }); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/freezed/my_response.g.dart b/packages/swagger_to_dart/example/lib/src/freezed/my_response.g.dart new file mode 100644 index 00000000..12f6308e --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/freezed/my_response.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'my_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MyResponseData _$MyResponseDataFromJson(Map json) => + MyResponseData( + CreateOrderLine.fromJson(json['create'] as Map), + $type: json['type'] as String?, + ); + +Map _$MyResponseDataToJson(MyResponseData instance) => + { + 'create': instance.create.toJson(), + 'type': instance.$type, + }; + +MyResponseSpecial _$MyResponseSpecialFromJson(Map json) => + MyResponseSpecial( + UpdateOrderLine.fromJson(json['update'] as Map), + $type: json['type'] as String?, + ); + +Map _$MyResponseSpecialToJson(MyResponseSpecial instance) => + { + 'update': instance.update.toJson(), + 'type': instance.$type, + }; + +MyResponseError _$MyResponseErrorFromJson(Map json) => + MyResponseError( + DeleteOrderLine.fromJson(json['delete'] as Map), + $type: json['type'] as String?, + ); + +Map _$MyResponseErrorToJson(MyResponseError instance) => + { + 'delete': instance.delete.toJson(), + 'type': instance.$type, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/auth_client.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/auth_client.dart new file mode 100644 index 00000000..5d2603ca --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/auth_client.dart @@ -0,0 +1,143 @@ +library auth_client; + +import 'package:dio/dio.dart' hide Headers; +import 'package:retrofit/retrofit.dart'; +import '../models/models.dart'; +part 'auth_client.g.dart'; + +@RestApi() +abstract class AuthClient { + factory AuthClient( + Dio dio, { + ParseErrorLogger? errorLogger, + String? baseUrl, + }) = _AuthClient; + + @POST("/api/auth/login") + Future> authApiAuthLoginPost({ + @Body() required LoginRequestDto requestBody, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Auth'], + r'summary': r'Logs a user in', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/LoginRequestDto'}, + }, + }, + }, + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/LoginResultDto'}, + }, + }, + }, + }, + }, + }); + @POST("/api/auth/logout") + Future authApiAuthLogoutPost({ + @Queries() required AuthApiAuthLogoutPostQueryParameters queries, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Auth'], + r'summary': r'Logs the current user out', + r'parameters': [ + { + r'name': r'sessionId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + ], + r'responses': { + r'200': {r'description': r'OK'}, + }, + }, + }); + @POST("/api/auth/refresh-token") + Future> authApiAuthRefreshTokenPost({ + @Queries() required AuthApiAuthRefreshTokenPostQueryParameters queries, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Auth'], + r'summary': r'Refreshes the current access token', + r'parameters': [ + { + r'name': r'refreshToken', + r'in': r'query', + r'schema': {r'type': r'string'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CredentialsDto'}, + }, + }, + }, + }, + }, + }); + @PATCH("/api/auth/change-password") + Future authApiAuthChangePasswordPatch({ + @Body() required ChangePasswordDto requestBody, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Auth'], + r'summary': r'Changes the current user password', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ChangePasswordDto'}, + }, + }, + }, + r'responses': { + r'200': {r'description': r'OK'}, + }, + }, + }); + @GET("/api/auth/me") + Future> authApiAuthMeGet({ + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Auth'], + r'summary': r'Returns current user data', + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UserDto'}, + }, + }, + }, + }, + }, + }); +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/auth_client.g.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/auth_client.g.dart new file mode 100644 index 00000000..cdc6897a --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/auth_client.g.dart @@ -0,0 +1,315 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'auth_client.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter + +class _AuthClient implements AuthClient { + _AuthClient(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + @override + Future> authApiAuthLoginPost({ + required LoginRequestDto requestBody, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Auth'], + r'summary': r'Logs a user in', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/LoginRequestDto'}, + }, + }, + }, + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/LoginResultDto'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/auth/login', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late LoginResultDto _value; + try { + _value = LoginResultDto.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> authApiAuthLogoutPost({ + required AuthApiAuthLogoutPostQueryParameters queries, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Auth'], + r'summary': r'Logs the current user out', + r'parameters': [ + { + r'name': r'sessionId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + ], + r'responses': { + r'200': {r'description': r'OK'}, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.addAll(queries.toJson()); + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/auth/logout', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> authApiAuthRefreshTokenPost({ + required AuthApiAuthRefreshTokenPostQueryParameters queries, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Auth'], + r'summary': r'Refreshes the current access token', + r'parameters': [ + { + r'name': r'refreshToken', + r'in': r'query', + r'schema': {r'type': r'string'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CredentialsDto'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.addAll(queries.toJson()); + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/auth/refresh-token', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late CredentialsDto _value; + try { + _value = CredentialsDto.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> authApiAuthChangePasswordPatch({ + required ChangePasswordDto requestBody, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Auth'], + r'summary': r'Changes the current user password', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ChangePasswordDto'}, + }, + }, + }, + r'responses': { + r'200': {r'description': r'OK'}, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/auth/change-password', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> authApiAuthMeGet({ + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Auth'], + r'summary': r'Returns current user data', + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UserDto'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/auth/me', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UserDto _value; + try { + _value = UserDto.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/categories_client.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/categories_client.dart new file mode 100644 index 00000000..57ee7ac7 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/categories_client.dart @@ -0,0 +1,192 @@ +library categories_client; + +import 'package:dio/dio.dart' hide Headers; +import 'package:retrofit/retrofit.dart'; +import '../models/models.dart'; +part 'categories_client.g.dart'; + +@RestApi() +abstract class CategoriesClient { + factory CategoriesClient( + Dio dio, { + ParseErrorLogger? errorLogger, + String? baseUrl, + }) = _CategoriesClient; + + @GET("/api/categories") + Future>> categoriesApiCategoriesGet({ + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Return categories as a forest (nested children).', + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/CategoryDto'}, + }, + }, + }, + }, + }, + }, + }); + @POST("/api/categories") + Future> categoriesApiCategoriesPost({ + @Body() required CreateCategoryDto requestBody, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Create a category.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateCategoryDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + }, + }, + }); + @GET("/api/categories/{id}") + Future> categoriesApiCategoriesIdGet({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Get a single category by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CategoryDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @PATCH("/api/categories/{id}") + Future categoriesApiCategoriesIdPatch({ + @Body() required UpdateCategoryDto requestBody, + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Update category (may move parent).', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateCategoryDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }); + @PUT("/api/categories/{id}") + Future categoriesApiCategoriesIdPut({ + @Body() required CategoryDto requestBody, + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Put category (may move parent).', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CategoryDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }); + @DELETE("/api/categories/{id}") + Future categoriesApiCategoriesIdDelete({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Delete category (only if no children).', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }); +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/categories_client.g.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/categories_client.g.dart new file mode 100644 index 00000000..ef59c960 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/categories_client.g.dart @@ -0,0 +1,389 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'categories_client.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter + +class _CategoriesClient implements CategoriesClient { + _CategoriesClient(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + @override + Future>> categoriesApiCategoriesGet({ + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Return categories as a forest (nested children).', + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/CategoryDto'}, + }, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/categories', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late List _value; + try { + _value = _result.data! + .map((dynamic i) => CategoryDto.fromJson(i as Map)) + .toList(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> categoriesApiCategoriesPost({ + required CreateCategoryDto requestBody, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Create a category.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateCategoryDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/categories', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + late String _value; + try { + _value = _result.data!; + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> categoriesApiCategoriesIdGet({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Get a single category by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CategoryDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/categories/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late CategoryDto _value; + try { + _value = CategoryDto.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> categoriesApiCategoriesIdPatch({ + required UpdateCategoryDto requestBody, + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Update category (may move parent).', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateCategoryDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/categories/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> categoriesApiCategoriesIdPut({ + required CategoryDto requestBody, + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Put category (may move parent).', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CategoryDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'PUT', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/categories/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> categoriesApiCategoriesIdDelete({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Categories'], + r'summary': r'Delete category (only if no children).', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/categories/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/customers_client.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/customers_client.dart new file mode 100644 index 00000000..8d32bc81 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/customers_client.dart @@ -0,0 +1,322 @@ +library customers_client; + +import 'package:dio/dio.dart' hide Headers; +import 'package:retrofit/retrofit.dart'; +import '../models/models.dart'; +part 'customers_client.g.dart'; + +@RestApi() +abstract class CustomersClient { + factory CustomersClient( + Dio dio, { + ParseErrorLogger? errorLogger, + String? baseUrl, + }) = _CustomersClient; + + @GET("/api/customers") + Future>> customersApiCustomersGet({ + @Queries() required CustomersApiCustomersGetQueryParameters queries, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'List customers with optional filters.', + r'parameters': [ + { + r'name': r'search', + r'in': r'query', + r'schema': {r'type': r'string', r'nullable': true}, + }, + { + r'name': r'requireFullPaymentOnClose', + r'in': r'query', + r'schema': {r'type': r'boolean', r'nullable': true}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/CustomerDto'}, + }, + }, + }, + }, + }, + }, + }); + @POST("/api/customers") + Future> customersApiCustomersPost({ + @Body() required CreateCustomerDto requestBody, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'Create a new customer.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateCustomerDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'409': { + r'description': r'Conflict', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @GET("/api/customers/{id}") + Future> customersApiCustomersIdGet({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'Get a customer by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CustomerDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @PATCH("/api/customers/{id}") + Future customersApiCustomersIdPatch({ + @Body() required UpdateCustomerDto requestBody, + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'Update an existing customer.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateCustomerDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'409': { + r'description': r'Conflict', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @DELETE("/api/customers/{id}") + Future customersApiCustomersIdDelete({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'Delete (soft delete) a customer by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @GET("/api/customers/{id}/account-entries") + Future>> + customersApiCustomersIdAccountEntriesGet({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'List account entries for a customer.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': { + r'$ref': r'#/components/schemas/CustomerAccountEntryDto', + }, + }, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @POST("/api/customers/{id}/account-entries") + Future> customersApiCustomersIdAccountEntriesPost({ + @Body() required CreateCustomerAccountEntryDto requestBody, + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'Create a manual account entry for a customer.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': { + r'$ref': r'#/components/schemas/CreateCustomerAccountEntryDto', + }, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/customers_client.g.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/customers_client.g.dart new file mode 100644 index 00000000..d10fcb91 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/customers_client.g.dart @@ -0,0 +1,564 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'customers_client.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter + +class _CustomersClient implements CustomersClient { + _CustomersClient(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + @override + Future>> customersApiCustomersGet({ + required CustomersApiCustomersGetQueryParameters queries, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'List customers with optional filters.', + r'parameters': [ + { + r'name': r'search', + r'in': r'query', + r'schema': {r'type': r'string', r'nullable': true}, + }, + { + r'name': r'requireFullPaymentOnClose', + r'in': r'query', + r'schema': {r'type': r'boolean', r'nullable': true}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/CustomerDto'}, + }, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.addAll(queries.toJson()); + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/customers', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late List _value; + try { + _value = _result.data! + .map((dynamic i) => CustomerDto.fromJson(i as Map)) + .toList(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> customersApiCustomersPost({ + required CreateCustomerDto requestBody, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'Create a new customer.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateCustomerDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'409': { + r'description': r'Conflict', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/customers', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + late String _value; + try { + _value = _result.data!; + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> customersApiCustomersIdGet({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'Get a customer by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CustomerDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/customers/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late CustomerDto _value; + try { + _value = CustomerDto.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> customersApiCustomersIdPatch({ + required UpdateCustomerDto requestBody, + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'Update an existing customer.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateCustomerDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'409': { + r'description': r'Conflict', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/customers/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> customersApiCustomersIdDelete({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'Delete (soft delete) a customer by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/customers/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future>> + customersApiCustomersIdAccountEntriesGet({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'List account entries for a customer.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': { + r'$ref': r'#/components/schemas/CustomerAccountEntryDto', + }, + }, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = + _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/customers/${id}/account-entries', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith( + baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl), + ), + ); + final _result = await _dio.fetch>(_options); + late List _value; + try { + _value = _result.data! + .map( + (dynamic i) => + CustomerAccountEntryDto.fromJson(i as Map), + ) + .toList(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> customersApiCustomersIdAccountEntriesPost({ + required CreateCustomerAccountEntryDto requestBody, + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Customers'], + r'summary': r'Create a manual account entry for a customer.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': { + r'$ref': r'#/components/schemas/CreateCustomerAccountEntryDto', + }, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/customers/${id}/account-entries', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + late String _value; + try { + _value = _result.data!; + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/orders_client.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/orders_client.dart new file mode 100644 index 00000000..05911900 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/orders_client.dart @@ -0,0 +1,352 @@ +library orders_client; + +import 'package:dio/dio.dart' hide Headers; +import 'package:retrofit/retrofit.dart'; +import '../models/models.dart'; +part 'orders_client.g.dart'; + +@RestApi() +abstract class OrdersClient { + factory OrdersClient( + Dio dio, { + ParseErrorLogger? errorLogger, + String? baseUrl, + }) = _OrdersClient; + + @GET("/api/orders") + Future> ordersApiOrdersGet({ + @Queries() required OrdersApiOrdersGetQueryParameters queries, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'List orders with optional filters.', + r'parameters': [ + { + r'name': r'pageToken', + r'in': r'query', + r'schema': {r'type': r'string', r'nullable': true}, + }, + { + r'name': r'pageSize', + r'in': r'query', + r'schema': { + r'type': r'integer', + r'format': r'int32', + r'default': 100, + }, + }, + { + r'name': r'salePointId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + { + r'name': r'status', + r'in': r'query', + r'schema': { + r'oneOf': [ + {r'$ref': r'#/components/schemas/OrderStatus'}, + {r'type': r'null'}, + ], + r'nullable': true, + }, + }, + { + r'name': r'customerId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + { + r'name': r'dateRange', + r'in': r'query', + r'schema': { + r'oneOf': [ + {r'$ref': r'#/components/schemas/DateRange'}, + {r'type': r'null'}, + ], + r'nullable': true, + }, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/OrderDtoPagedResult'}, + }, + }, + }, + }, + }, + }); + @POST("/api/orders") + Future> ordersApiOrdersPost({ + @Body() required CreateOrderCommand requestBody, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Create a new B2B order.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateOrderCommand'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @GET("/api/orders/{id}") + Future> ordersApiOrdersIdGet({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Get an order by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/OrderDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @PATCH("/api/orders/{id}") + Future ordersApiOrdersIdPatch({ + @Body() required UpdateOrderCommand requestBody, + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Update an existing B2B order.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateOrderCommand'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @DELETE("/api/orders/{id}") + Future ordersApiOrdersIdDelete({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Delete (soft delete) an order by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @POST("/api/orders/invoices") + Future ordersApiOrdersInvoicesPost({ + @Body() required GenerateInvoicesRequest requestBody, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Orders'], + r'summary': + r'Generate a PDF document containing invoices for multiple orders.', + r'requestBody': { + r'description': r'The order IDs.', + r'content': { + r'application/json': { + r'schema': { + r'$ref': r'#/components/schemas/GenerateInvoicesRequest', + }, + }, + }, + }, + r'responses': { + r'200': {r'description': r'OK'}, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @GET("/api/orders/{id}/invoice") + Future ordersApiOrdersIdInvoiceGet({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Generate a PDF invoice for a single order.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'description': r'The order ID.', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': {r'description': r'OK'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @POST("/api/orders/{id}/close") + Future ordersApiOrdersIdClosePost({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Close a B2B order.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/orders_client.g.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/orders_client.g.dart new file mode 100644 index 00000000..34d6d582 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/orders_client.g.dart @@ -0,0 +1,596 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'orders_client.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter + +class _OrdersClient implements OrdersClient { + _OrdersClient(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + @override + Future> ordersApiOrdersGet({ + required OrdersApiOrdersGetQueryParameters queries, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'List orders with optional filters.', + r'parameters': [ + { + r'name': r'pageToken', + r'in': r'query', + r'schema': {r'type': r'string', r'nullable': true}, + }, + { + r'name': r'pageSize', + r'in': r'query', + r'schema': { + r'type': r'integer', + r'format': r'int32', + r'default': 100, + }, + }, + { + r'name': r'salePointId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + { + r'name': r'status', + r'in': r'query', + r'schema': { + r'oneOf': [ + {r'$ref': r'#/components/schemas/OrderStatus'}, + {r'type': r'null'}, + ], + r'nullable': true, + }, + }, + { + r'name': r'customerId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + { + r'name': r'dateRange', + r'in': r'query', + r'schema': { + r'oneOf': [ + {r'$ref': r'#/components/schemas/DateRange'}, + {r'type': r'null'}, + ], + r'nullable': true, + }, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/OrderDtoPagedResult'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.addAll(queries.toJson()); + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/orders', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late OrderDtoPagedResult _value; + try { + _value = OrderDtoPagedResult.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> ordersApiOrdersPost({ + required CreateOrderCommand requestBody, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Create a new B2B order.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateOrderCommand'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/orders', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + late String _value; + try { + _value = _result.data!; + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> ordersApiOrdersIdGet({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Get an order by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/OrderDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/orders/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late OrderDto _value; + try { + _value = OrderDto.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> ordersApiOrdersIdPatch({ + required UpdateOrderCommand requestBody, + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Update an existing B2B order.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateOrderCommand'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/orders/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> ordersApiOrdersIdDelete({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Delete (soft delete) an order by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/orders/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> ordersApiOrdersInvoicesPost({ + required GenerateInvoicesRequest requestBody, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Orders'], + r'summary': + r'Generate a PDF document containing invoices for multiple orders.', + r'requestBody': { + r'description': r'The order IDs.', + r'content': { + r'application/json': { + r'schema': { + r'$ref': r'#/components/schemas/GenerateInvoicesRequest', + }, + }, + }, + }, + r'responses': { + r'200': {r'description': r'OK'}, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/orders/invoices', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> ordersApiOrdersIdInvoiceGet({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Generate a PDF invoice for a single order.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'description': r'The order ID.', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': {r'description': r'OK'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/orders/${id}/invoice', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> ordersApiOrdersIdClosePost({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Orders'], + r'summary': r'Close a B2B order.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/orders/${id}/close', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/price_lists_client.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/price_lists_client.dart new file mode 100644 index 00000000..c8935b49 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/price_lists_client.dart @@ -0,0 +1,180 @@ +library price_lists_client; + +import 'package:dio/dio.dart' hide Headers; +import 'package:retrofit/retrofit.dart'; +import '../models/models.dart'; +part 'price_lists_client.g.dart'; + +@RestApi() +abstract class PriceListsClient { + factory PriceListsClient( + Dio dio, { + ParseErrorLogger? errorLogger, + String? baseUrl, + }) = _PriceListsClient; + + @GET("/api/price-lists") + Future>> priceListsApiPriceListsGet({ + @Queries() required PriceListsApiPriceListsGetQueryParameters queries, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'PriceLists'], + r'summary': r'List price lists with optional filters.', + r'parameters': [ + { + r'name': r'enabled', + r'in': r'query', + r'schema': {r'type': r'boolean', r'nullable': true}, + }, + { + r'name': r'salePointId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': { + r'$ref': r'#/components/schemas/PriceListSummaryDto', + }, + }, + }, + }, + }, + }, + }, + }); + @POST("/api/price-lists") + Future> priceListsApiPriceListsPost({ + @Body() required CreatePriceListDto requestBody, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'PriceLists'], + r'summary': r'Create a new price list.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreatePriceListDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + }, + }, + }); + @GET("/api/price-lists/{id}") + Future> priceListsApiPriceListsIdGet({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'PriceLists'], + r'summary': r'Get a price list by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/PriceListDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @PATCH("/api/price-lists/{id}") + Future priceListsApiPriceListsIdPatch({ + @Body() required UpdatePriceListDto requestBody, + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'PriceLists'], + r'summary': r'Update an existing price list.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdatePriceListDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }); + @DELETE("/api/price-lists/{id}") + Future priceListsApiPriceListsIdDelete({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'PriceLists'], + r'summary': r'Delete a price list.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }); +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/price_lists_client.g.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/price_lists_client.g.dart new file mode 100644 index 00000000..8c18b2da --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/price_lists_client.g.dart @@ -0,0 +1,356 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'price_lists_client.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter + +class _PriceListsClient implements PriceListsClient { + _PriceListsClient(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + @override + Future>> priceListsApiPriceListsGet({ + required PriceListsApiPriceListsGetQueryParameters queries, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'PriceLists'], + r'summary': r'List price lists with optional filters.', + r'parameters': [ + { + r'name': r'enabled', + r'in': r'query', + r'schema': {r'type': r'boolean', r'nullable': true}, + }, + { + r'name': r'salePointId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': { + r'$ref': r'#/components/schemas/PriceListSummaryDto', + }, + }, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.addAll(queries.toJson()); + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/price-lists', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late List _value; + try { + _value = _result.data! + .map( + (dynamic i) => + PriceListSummaryDto.fromJson(i as Map), + ) + .toList(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> priceListsApiPriceListsPost({ + required CreatePriceListDto requestBody, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'PriceLists'], + r'summary': r'Create a new price list.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreatePriceListDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/price-lists', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + late String _value; + try { + _value = _result.data!; + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> priceListsApiPriceListsIdGet({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'PriceLists'], + r'summary': r'Get a price list by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/PriceListDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/price-lists/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late PriceListDto _value; + try { + _value = PriceListDto.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> priceListsApiPriceListsIdPatch({ + required UpdatePriceListDto requestBody, + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'PriceLists'], + r'summary': r'Update an existing price list.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdatePriceListDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/price-lists/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> priceListsApiPriceListsIdDelete({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'PriceLists'], + r'summary': r'Delete a price list.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/price-lists/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/products_client.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/products_client.dart new file mode 100644 index 00000000..c1fd59dc --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/products_client.dart @@ -0,0 +1,212 @@ +library products_client; + +import 'package:dio/dio.dart' hide Headers; +import 'package:retrofit/retrofit.dart'; +import '../models/models.dart'; +part 'products_client.g.dart'; + +@RestApi() +abstract class ProductsClient { + factory ProductsClient( + Dio dio, { + ParseErrorLogger? errorLogger, + String? baseUrl, + }) = _ProductsClient; + + @GET("/api/products") + Future> productsApiProductsGet({ + @Queries() required ProductsApiProductsGetQueryParameters queries, + @Header("X-SalePoint-Id") required String xMinusSalePointMinusId, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Products'], + r'summary': r'List products with optional filters.', + r'parameters': [ + { + r'name': r'X-SalePoint-Id', + r'in': r'header', + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + { + r'name': r'pageToken', + r'in': r'query', + r'schema': {r'type': r'string', r'nullable': true}, + }, + { + r'name': r'pageSize', + r'in': r'query', + r'schema': { + r'type': r'integer', + r'format': r'int32', + r'default': 100, + }, + }, + { + r'name': r'categoryId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + { + r'name': r'search', + r'in': r'query', + r'schema': {r'type': r'string', r'nullable': true}, + }, + { + r'name': r'priceListId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + { + r'name': r'replacePrices', + r'in': r'query', + r'schema': {r'type': r'boolean', r'default': false}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'$ref': r'#/components/schemas/ProductDtoPagedResult', + }, + }, + }, + }, + }, + }, + }); + @POST("/api/products") + Future> productsApiProductsPost({ + @Body() required CreateProductDto requestBody, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Products'], + r'summary': r'Create a new product (with variants/presentations).', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateProductDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + }, + }, + }); + @GET("/api/products/{id}") + Future> productsApiProductsIdGet({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Products'], + r'summary': r'Get a product by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProductDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @PATCH("/api/products/{id}") + Future productsApiProductsIdPatch({ + @Body() required UpdateProductDto requestBody, + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Products'], + r'summary': + r'Update an existing product (replace variants/presentations).', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateProductDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }); + @DELETE("/api/products/{id}") + Future productsApiProductsIdDelete({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Products'], + r'summary': r'Delete a product.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }); +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/products_client.g.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/products_client.g.dart new file mode 100644 index 00000000..b80429f2 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/products_client.g.dart @@ -0,0 +1,386 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'products_client.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter + +class _ProductsClient implements ProductsClient { + _ProductsClient(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + @override + Future> productsApiProductsGet({ + required ProductsApiProductsGetQueryParameters queries, + required String xMinusSalePointMinusId, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Products'], + r'summary': r'List products with optional filters.', + r'parameters': [ + { + r'name': r'X-SalePoint-Id', + r'in': r'header', + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + { + r'name': r'pageToken', + r'in': r'query', + r'schema': {r'type': r'string', r'nullable': true}, + }, + { + r'name': r'pageSize', + r'in': r'query', + r'schema': { + r'type': r'integer', + r'format': r'int32', + r'default': 100, + }, + }, + { + r'name': r'categoryId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + { + r'name': r'search', + r'in': r'query', + r'schema': {r'type': r'string', r'nullable': true}, + }, + { + r'name': r'priceListId', + r'in': r'query', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + { + r'name': r'replacePrices', + r'in': r'query', + r'schema': {r'type': r'boolean', r'default': false}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'$ref': r'#/components/schemas/ProductDtoPagedResult', + }, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.addAll(queries.toJson()); + queryParameters.removeWhere((k, v) => v == null); + final _headers = { + r'X-SalePoint-Id': xMinusSalePointMinusId, + }; + _headers.removeWhere((k, v) => v == null); + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/products', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ProductDtoPagedResult _value; + try { + _value = ProductDtoPagedResult.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> productsApiProductsPost({ + required CreateProductDto requestBody, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Products'], + r'summary': r'Create a new product (with variants/presentations).', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateProductDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/products', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + late String _value; + try { + _value = _result.data!; + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> productsApiProductsIdGet({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Products'], + r'summary': r'Get a product by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProductDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/products/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late ProductDto _value; + try { + _value = ProductDto.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> productsApiProductsIdPatch({ + required UpdateProductDto requestBody, + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Products'], + r'summary': + r'Update an existing product (replace variants/presentations).', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateProductDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/products/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> productsApiProductsIdDelete({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Products'], + r'summary': r'Delete a product.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/products/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/sale_points_client.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/sale_points_client.dart new file mode 100644 index 00000000..d6d8351f --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/sale_points_client.dart @@ -0,0 +1,193 @@ +library sale_points_client; + +import 'package:dio/dio.dart' hide Headers; +import 'package:retrofit/retrofit.dart'; +import '../models/models.dart'; +part 'sale_points_client.g.dart'; + +@RestApi() +abstract class SalePointsClient { + factory SalePointsClient( + Dio dio, { + ParseErrorLogger? errorLogger, + String? baseUrl, + }) = _SalePointsClient; + + @GET("/api/sale-points") + Future>> salePointsApiSalePointsGet({ + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'SalePoints'], + r'summary': r'List salepoints with optional filters.', + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/SalePointDto'}, + }, + }, + }, + }, + }, + }, + }); + @POST("/api/sale-points") + Future> salePointsApiSalePointsPost({ + @Body() required CreateSalePointDto requestBody, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'SalePoints'], + r'summary': r'Create a new user.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateSalePointDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @GET("/api/sale-points/{id}") + Future> salePointsApiSalePointsIdGet({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'SalePoints'], + r'summary': r'Get a salepoint by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/SalePointDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @PATCH("/api/sale-points/{id}") + Future salePointsApiSalePointsIdPatch({ + @Body() required UpdateSalePointDto requestBody, + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'SalePoints'], + r'summary': r'Update an existing salepoint.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateSalePointDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @DELETE("/api/sale-points/{id}") + Future salePointsApiSalePointsIdDelete({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'SalePoints'], + r'summary': r'Delete a salepoint by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/sale_points_client.g.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/sale_points_client.g.dart new file mode 100644 index 00000000..86ac0fd4 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/sale_points_client.g.dart @@ -0,0 +1,365 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'sale_points_client.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter + +class _SalePointsClient implements SalePointsClient { + _SalePointsClient(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + @override + Future>> salePointsApiSalePointsGet({ + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'SalePoints'], + r'summary': r'List salepoints with optional filters.', + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/SalePointDto'}, + }, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/sale-points', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late List _value; + try { + _value = _result.data! + .map((dynamic i) => SalePointDto.fromJson(i as Map)) + .toList(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> salePointsApiSalePointsPost({ + required CreateSalePointDto requestBody, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'SalePoints'], + r'summary': r'Create a new user.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateSalePointDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/sale-points', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + late String _value; + try { + _value = _result.data!; + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> salePointsApiSalePointsIdGet({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'SalePoints'], + r'summary': r'Get a salepoint by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/SalePointDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/sale-points/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late SalePointDto _value; + try { + _value = SalePointDto.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> salePointsApiSalePointsIdPatch({ + required UpdateSalePointDto requestBody, + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'SalePoints'], + r'summary': r'Update an existing salepoint.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateSalePointDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/sale-points/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> salePointsApiSalePointsIdDelete({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'SalePoints'], + r'summary': r'Delete a salepoint by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/sale-points/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/stock_client.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/stock_client.dart new file mode 100644 index 00000000..75d1ada8 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/stock_client.dart @@ -0,0 +1,47 @@ +library stock_client; + +import 'package:dio/dio.dart' hide Headers; +import 'package:retrofit/retrofit.dart'; +import '../models/models.dart'; +part 'stock_client.g.dart'; + +@RestApi() +abstract class StockClient { + factory StockClient( + Dio dio, { + ParseErrorLogger? errorLogger, + String? baseUrl, + }) = _StockClient; + + @PATCH("/api/products/{productId}/stock") + Future stockApiProductsProductIdStockPatch({ + @Body() required AdjustStockDto requestBody, + @Path("productId") required String productId, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Stock'], + r'summary': r'Manually modifies the stock of a product', + r'parameters': [ + { + r'name': r'productId', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/AdjustStockDto'}, + }, + }, + }, + r'responses': { + r'200': {r'description': r'OK'}, + }, + }, + }); +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/stock_client.g.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/stock_client.g.dart new file mode 100644 index 00000000..414fd0cd --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/stock_client.g.dart @@ -0,0 +1,102 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stock_client.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter + +class _StockClient implements StockClient { + _StockClient(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + @override + Future> stockApiProductsProductIdStockPatch({ + required AdjustStockDto requestBody, + required String productId, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Stock'], + r'summary': r'Manually modifies the stock of a product', + r'parameters': [ + { + r'name': r'productId', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/AdjustStockDto'}, + }, + }, + }, + r'responses': { + r'200': {r'description': r'OK'}, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/products/${productId}/stock', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/sync_client.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/sync_client.dart new file mode 100644 index 00000000..3ca929d5 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/sync_client.dart @@ -0,0 +1,98 @@ +library sync_client; + +import 'package:dio/dio.dart' hide Headers; +import 'package:retrofit/retrofit.dart'; +import '../models/models.dart'; +part 'sync_client.g.dart'; + +@RestApi() +abstract class SyncClient { + factory SyncClient( + Dio dio, { + ParseErrorLogger? errorLogger, + String? baseUrl, + }) = _SyncClient; + + @GET("/api/sync/pull") + Future>> syncApiSyncPullGet({ + @Queries() required SyncApiSyncPullGetQueryParameters queries, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Sync'], + r'summary': r'Pulls all changes since the last pull.', + r'parameters': [ + { + r'name': r'lastId', + r'in': r'query', + r'description': r'The last change id to sync from.', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + { + r'name': r'pageSize', + r'in': r'query', + r'description': + r'Maximum number of changes to return (default 1000, max 5000)', + r'schema': { + r'type': r'integer', + r'format': r'int32', + r'default': 1000, + }, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/Change'}, + }, + }, + }, + }, + }, + }, + }); + @POST("/api/sync/push") + Future syncApiSyncPushPost({ + @Body() required List requestBody, + @Header("X-Server-Source-Id") + required String xMinusServerMinusSourceMinusId, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Sync'], + r'summary': r'Pushes changes.', + r'parameters': [ + { + r'name': r'X-Server-Source-Id', + r'in': r'header', + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/Change'}, + }, + }, + }, + }, + r'responses': { + r'200': {r'description': r'OK'}, + }, + }, + }); +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/sync_client.g.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/sync_client.g.dart new file mode 100644 index 00000000..a41c3f76 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/sync_client.g.dart @@ -0,0 +1,187 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'sync_client.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter + +class _SyncClient implements SyncClient { + _SyncClient(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + @override + Future>> syncApiSyncPullGet({ + required SyncApiSyncPullGetQueryParameters queries, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Sync'], + r'summary': r'Pulls all changes since the last pull.', + r'parameters': [ + { + r'name': r'lastId', + r'in': r'query', + r'description': r'The last change id to sync from.', + r'schema': { + r'type': r'string', + r'format': r'uuid', + r'nullable': true, + }, + }, + { + r'name': r'pageSize', + r'in': r'query', + r'description': + r'Maximum number of changes to return (default 1000, max 5000)', + r'schema': { + r'type': r'integer', + r'format': r'int32', + r'default': 1000, + }, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/Change'}, + }, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.addAll(queries.toJson()); + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/sync/pull', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late List _value; + try { + _value = _result.data! + .map((dynamic i) => Change.fromJson(i as Map)) + .toList(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> syncApiSyncPushPost({ + required List requestBody, + required String xMinusServerMinusSourceMinusId, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Sync'], + r'summary': r'Pushes changes.', + r'parameters': [ + { + r'name': r'X-Server-Source-Id', + r'in': r'header', + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/Change'}, + }, + }, + }, + }, + r'responses': { + r'200': {r'description': r'OK'}, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = { + r'X-Server-Source-Id': xMinusServerMinusSourceMinusId, + }; + _headers.removeWhere((k, v) => v == null); + final _data = requestBody.map((e) => e.toJson()).toList(); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/sync/push', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/users_client.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/users_client.dart new file mode 100644 index 00000000..32e72559 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/users_client.dart @@ -0,0 +1,208 @@ +library users_client; + +import 'package:dio/dio.dart' hide Headers; +import 'package:retrofit/retrofit.dart'; +import '../models/models.dart'; +part 'users_client.g.dart'; + +@RestApi() +abstract class UsersClient { + factory UsersClient( + Dio dio, { + ParseErrorLogger? errorLogger, + String? baseUrl, + }) = _UsersClient; + + @GET("/api/users") + Future>> usersApiUsersGet({ + @Queries() required UsersApiUsersGetQueryParameters queries, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Users'], + r'summary': r'List users with optional filters.', + r'description': + r'Returns paged users with role info. Use query params for paging and filtering.', + r'parameters': [ + { + r'name': r'active', + r'in': r'query', + r'schema': {r'type': r'boolean', r'nullable': true}, + }, + { + r'name': r'search', + r'in': r'query', + r'schema': {r'type': r'string', r'nullable': true}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/UserDto'}, + }, + }, + }, + }, + }, + }, + }); + @POST("/api/users") + Future> usersApiUsersPost({ + @Body() required CreateUserDto requestBody, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Users'], + r'summary': r'Create a new user.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateUserDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @GET("/api/users/{id}") + Future> usersApiUsersIdGet({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Users'], + r'summary': r'Get a user by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UserDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @PATCH("/api/users/{id}") + Future usersApiUsersIdPatch({ + @Body() required UpdateUserDto requestBody, + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Users'], + r'summary': r'Update an existing user.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateUserDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); + @DELETE("/api/users/{id}") + Future usersApiUsersIdDelete({ + @Path("id") required String id, + @CancelRequest() CancelToken? cancelToken, + @SendProgress() ProgressCallback? onSendProgress, + @ReceiveProgress() ProgressCallback? onReceiveProgress, + @Extras() + Map? extras = const { + r'tags': [r'Users'], + r'summary': r'Delete (soft delete) a user by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }); +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/api_client/users_client.g.dart b/packages/swagger_to_dart/example/lib/src/gen/api_client/users_client.g.dart new file mode 100644 index 00000000..470dcb79 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/api_client/users_client.g.dart @@ -0,0 +1,381 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'users_client.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations,unused_element_parameter + +class _UsersClient implements UsersClient { + _UsersClient(this._dio, {this.baseUrl, this.errorLogger}); + + final Dio _dio; + + String? baseUrl; + + final ParseErrorLogger? errorLogger; + + @override + Future>> usersApiUsersGet({ + required UsersApiUsersGetQueryParameters queries, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Users'], + r'summary': r'List users with optional filters.', + r'description': + r'Returns paged users with role info. Use query params for paging and filtering.', + r'parameters': [ + { + r'name': r'active', + r'in': r'query', + r'schema': {r'type': r'boolean', r'nullable': true}, + }, + { + r'name': r'search', + r'in': r'query', + r'schema': {r'type': r'string', r'nullable': true}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': { + r'type': r'array', + r'items': {r'$ref': r'#/components/schemas/UserDto'}, + }, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.addAll(queries.toJson()); + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/users', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late List _value; + try { + _value = _result.data! + .map((dynamic i) => UserDto.fromJson(i as Map)) + .toList(); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> usersApiUsersPost({ + required CreateUserDto requestBody, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Users'], + r'summary': r'Create a new user.', + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/CreateUserDto'}, + }, + }, + }, + r'responses': { + r'201': { + r'description': r'Created', + r'content': { + r'application/json': { + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + }, + }, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/users', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + late String _value; + try { + _value = _result.data!; + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> usersApiUsersIdGet({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Users'], + r'summary': r'Get a user by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'200': { + r'description': r'OK', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UserDto'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/users/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late UserDto _value; + try { + _value = UserDto.fromJson(_result.data!); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> usersApiUsersIdPatch({ + required UpdateUserDto requestBody, + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Users'], + r'summary': r'Update an existing user.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'requestBody': { + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/UpdateUserDto'}, + }, + }, + }, + r'responses': { + r'204': {r'description': r'No Content'}, + r'400': { + r'description': r'Bad Request', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + final _data = {}; + _data.addAll(requestBody.toJson()); + final _options = _setStreamType>( + Options(method: 'PATCH', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/users/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future> usersApiUsersIdDelete({ + required String id, + CancelToken? cancelToken, + void Function(int, int)? onSendProgress, + void Function(int, int)? onReceiveProgress, + Map? extras = const { + r'tags': [r'Users'], + r'summary': r'Delete (soft delete) a user by id.', + r'parameters': [ + { + r'name': r'id', + r'in': r'path', + r'required': true, + r'schema': {r'type': r'string', r'format': r'uuid'}, + }, + ], + r'responses': { + r'204': {r'description': r'No Content'}, + r'404': { + r'description': r'Not Found', + r'content': { + r'application/json': { + r'schema': {r'$ref': r'#/components/schemas/ProblemDetails'}, + }, + }, + }, + }, + }, + }) async { + final _extra = {}; + _extra.addAll(extras ?? {}); + final queryParameters = {}; + queryParameters.removeWhere((k, v) => v == null); + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>( + Options(method: 'DELETE', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/api/users/${id}', + queryParameters: queryParameters, + data: _data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch(_options); + final _value = _result.data; + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls(String dioBaseUrl, String? baseUrl) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/adjust_stock_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/adjust_stock_dto.dart new file mode 100644 index 00000000..70312aa1 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/adjust_stock_dto.dart @@ -0,0 +1,85 @@ +/// AdjustStockDto +/// { +/// "properties": { +/// "sale_point_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "variant_id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "presentation_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "expiration_date": { +/// "type": "string", +/// "format": "date-time", +/// "nullable": true +/// }, +/// "quantity": { +/// "type": "integer", +/// "format": "int32" +/// }, +/// "reason": { +/// "type": "string", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "presentation_id", +/// "quantity", +/// "sale_point_id" +/// ], +/// "additionalProperties": false +/// } +library adjust_stock_dto; + +import 'exports.dart'; +part 'adjust_stock_dto.freezed.dart'; +part 'adjust_stock_dto.g.dart'; // AdjustStockDto + +@freezed +abstract class AdjustStockDto with _$AdjustStockDto { + const AdjustStockDto._(); + + @jsonSerializable + const factory AdjustStockDto({ + /// salePointId + @JsonKey(name: AdjustStockDto.salePointIdKey_) required String salePointId, + + /// variantId + @JsonKey(name: AdjustStockDto.variantIdKey_) String? variantId, + + /// presentationId + @JsonKey(name: AdjustStockDto.presentationIdKey_) + required String presentationId, + + /// expirationDate + @JsonKey(name: AdjustStockDto.expirationDateKey_) DateTime? expirationDate, + + /// quantity + @JsonKey(name: AdjustStockDto.quantityKey_) required int quantity, + + /// reason + @JsonKey(name: AdjustStockDto.reasonKey_) String? reason, + }) = _AdjustStockDto; + + factory AdjustStockDto.fromJson(Map json) => + _$AdjustStockDtoFromJson(json); + + static const String salePointIdKey_ = r'sale_point_id'; + + static const String variantIdKey_ = r'variant_id'; + + static const String presentationIdKey_ = r'presentation_id'; + + static const String expirationDateKey_ = r'expiration_date'; + + static const String quantityKey_ = r'quantity'; + + static const String reasonKey_ = r'reason'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/adjust_stock_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/adjust_stock_dto.freezed.dart new file mode 100644 index 00000000..167ea57e --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/adjust_stock_dto.freezed.dart @@ -0,0 +1,502 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'adjust_stock_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AdjustStockDto { + /// salePointId + @JsonKey(name: AdjustStockDto.salePointIdKey_) + String get salePointId; + + /// variantId + @JsonKey(name: AdjustStockDto.variantIdKey_) + String? get variantId; + + /// presentationId + @JsonKey(name: AdjustStockDto.presentationIdKey_) + String get presentationId; + + /// expirationDate + @JsonKey(name: AdjustStockDto.expirationDateKey_) + DateTime? get expirationDate; + + /// quantity + @JsonKey(name: AdjustStockDto.quantityKey_) + int get quantity; + + /// reason + @JsonKey(name: AdjustStockDto.reasonKey_) + String? get reason; + + /// Create a copy of AdjustStockDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AdjustStockDtoCopyWith get copyWith => + _$AdjustStockDtoCopyWithImpl( + this as AdjustStockDto, _$identity); + + /// Serializes this AdjustStockDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AdjustStockDto && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId) && + (identical(other.variantId, variantId) || + other.variantId == variantId) && + (identical(other.presentationId, presentationId) || + other.presentationId == presentationId) && + (identical(other.expirationDate, expirationDate) || + other.expirationDate == expirationDate) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, salePointId, variantId, + presentationId, expirationDate, quantity, reason); + + @override + String toString() { + return 'AdjustStockDto(salePointId: $salePointId, variantId: $variantId, presentationId: $presentationId, expirationDate: $expirationDate, quantity: $quantity, reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class $AdjustStockDtoCopyWith<$Res> { + factory $AdjustStockDtoCopyWith( + AdjustStockDto value, $Res Function(AdjustStockDto) _then) = + _$AdjustStockDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: AdjustStockDto.salePointIdKey_) String salePointId, + @JsonKey(name: AdjustStockDto.variantIdKey_) String? variantId, + @JsonKey(name: AdjustStockDto.presentationIdKey_) String presentationId, + @JsonKey(name: AdjustStockDto.expirationDateKey_) + DateTime? expirationDate, + @JsonKey(name: AdjustStockDto.quantityKey_) int quantity, + @JsonKey(name: AdjustStockDto.reasonKey_) String? reason}); +} + +/// @nodoc +class _$AdjustStockDtoCopyWithImpl<$Res> + implements $AdjustStockDtoCopyWith<$Res> { + _$AdjustStockDtoCopyWithImpl(this._self, this._then); + + final AdjustStockDto _self; + final $Res Function(AdjustStockDto) _then; + + /// Create a copy of AdjustStockDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? salePointId = null, + Object? variantId = freezed, + Object? presentationId = null, + Object? expirationDate = freezed, + Object? quantity = null, + Object? reason = freezed, + }) { + return _then(_self.copyWith( + salePointId: null == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String, + variantId: freezed == variantId + ? _self.variantId + : variantId // ignore: cast_nullable_to_non_nullable + as String?, + presentationId: null == presentationId + ? _self.presentationId + : presentationId // ignore: cast_nullable_to_non_nullable + as String, + expirationDate: freezed == expirationDate + ? _self.expirationDate + : expirationDate // ignore: cast_nullable_to_non_nullable + as DateTime?, + quantity: null == quantity + ? _self.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// Adds pattern-matching-related methods to [AdjustStockDto]. +extension AdjustStockDtoPatterns on AdjustStockDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_AdjustStockDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _AdjustStockDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_AdjustStockDto value) $default, + ) { + final _that = this; + switch (_that) { + case _AdjustStockDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_AdjustStockDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _AdjustStockDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: AdjustStockDto.salePointIdKey_) String salePointId, + @JsonKey(name: AdjustStockDto.variantIdKey_) String? variantId, + @JsonKey(name: AdjustStockDto.presentationIdKey_) + String presentationId, + @JsonKey(name: AdjustStockDto.expirationDateKey_) + DateTime? expirationDate, + @JsonKey(name: AdjustStockDto.quantityKey_) int quantity, + @JsonKey(name: AdjustStockDto.reasonKey_) String? reason)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _AdjustStockDto() when $default != null: + return $default( + _that.salePointId, + _that.variantId, + _that.presentationId, + _that.expirationDate, + _that.quantity, + _that.reason); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: AdjustStockDto.salePointIdKey_) String salePointId, + @JsonKey(name: AdjustStockDto.variantIdKey_) String? variantId, + @JsonKey(name: AdjustStockDto.presentationIdKey_) + String presentationId, + @JsonKey(name: AdjustStockDto.expirationDateKey_) + DateTime? expirationDate, + @JsonKey(name: AdjustStockDto.quantityKey_) int quantity, + @JsonKey(name: AdjustStockDto.reasonKey_) String? reason) + $default, + ) { + final _that = this; + switch (_that) { + case _AdjustStockDto(): + return $default( + _that.salePointId, + _that.variantId, + _that.presentationId, + _that.expirationDate, + _that.quantity, + _that.reason); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: AdjustStockDto.salePointIdKey_) String salePointId, + @JsonKey(name: AdjustStockDto.variantIdKey_) String? variantId, + @JsonKey(name: AdjustStockDto.presentationIdKey_) + String presentationId, + @JsonKey(name: AdjustStockDto.expirationDateKey_) + DateTime? expirationDate, + @JsonKey(name: AdjustStockDto.quantityKey_) int quantity, + @JsonKey(name: AdjustStockDto.reasonKey_) String? reason)? + $default, + ) { + final _that = this; + switch (_that) { + case _AdjustStockDto() when $default != null: + return $default( + _that.salePointId, + _that.variantId, + _that.presentationId, + _that.expirationDate, + _that.quantity, + _that.reason); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _AdjustStockDto extends AdjustStockDto { + const _AdjustStockDto( + {@JsonKey(name: AdjustStockDto.salePointIdKey_) required this.salePointId, + @JsonKey(name: AdjustStockDto.variantIdKey_) this.variantId, + @JsonKey(name: AdjustStockDto.presentationIdKey_) + required this.presentationId, + @JsonKey(name: AdjustStockDto.expirationDateKey_) this.expirationDate, + @JsonKey(name: AdjustStockDto.quantityKey_) required this.quantity, + @JsonKey(name: AdjustStockDto.reasonKey_) this.reason}) + : super._(); + factory _AdjustStockDto.fromJson(Map json) => + _$AdjustStockDtoFromJson(json); + + /// salePointId + @override + @JsonKey(name: AdjustStockDto.salePointIdKey_) + final String salePointId; + + /// variantId + @override + @JsonKey(name: AdjustStockDto.variantIdKey_) + final String? variantId; + + /// presentationId + @override + @JsonKey(name: AdjustStockDto.presentationIdKey_) + final String presentationId; + + /// expirationDate + @override + @JsonKey(name: AdjustStockDto.expirationDateKey_) + final DateTime? expirationDate; + + /// quantity + @override + @JsonKey(name: AdjustStockDto.quantityKey_) + final int quantity; + + /// reason + @override + @JsonKey(name: AdjustStockDto.reasonKey_) + final String? reason; + + /// Create a copy of AdjustStockDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$AdjustStockDtoCopyWith<_AdjustStockDto> get copyWith => + __$AdjustStockDtoCopyWithImpl<_AdjustStockDto>(this, _$identity); + + @override + Map toJson() { + return _$AdjustStockDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _AdjustStockDto && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId) && + (identical(other.variantId, variantId) || + other.variantId == variantId) && + (identical(other.presentationId, presentationId) || + other.presentationId == presentationId) && + (identical(other.expirationDate, expirationDate) || + other.expirationDate == expirationDate) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, salePointId, variantId, + presentationId, expirationDate, quantity, reason); + + @override + String toString() { + return 'AdjustStockDto(salePointId: $salePointId, variantId: $variantId, presentationId: $presentationId, expirationDate: $expirationDate, quantity: $quantity, reason: $reason)'; + } +} + +/// @nodoc +abstract mixin class _$AdjustStockDtoCopyWith<$Res> + implements $AdjustStockDtoCopyWith<$Res> { + factory _$AdjustStockDtoCopyWith( + _AdjustStockDto value, $Res Function(_AdjustStockDto) _then) = + __$AdjustStockDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: AdjustStockDto.salePointIdKey_) String salePointId, + @JsonKey(name: AdjustStockDto.variantIdKey_) String? variantId, + @JsonKey(name: AdjustStockDto.presentationIdKey_) String presentationId, + @JsonKey(name: AdjustStockDto.expirationDateKey_) + DateTime? expirationDate, + @JsonKey(name: AdjustStockDto.quantityKey_) int quantity, + @JsonKey(name: AdjustStockDto.reasonKey_) String? reason}); +} + +/// @nodoc +class __$AdjustStockDtoCopyWithImpl<$Res> + implements _$AdjustStockDtoCopyWith<$Res> { + __$AdjustStockDtoCopyWithImpl(this._self, this._then); + + final _AdjustStockDto _self; + final $Res Function(_AdjustStockDto) _then; + + /// Create a copy of AdjustStockDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? salePointId = null, + Object? variantId = freezed, + Object? presentationId = null, + Object? expirationDate = freezed, + Object? quantity = null, + Object? reason = freezed, + }) { + return _then(_AdjustStockDto( + salePointId: null == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String, + variantId: freezed == variantId + ? _self.variantId + : variantId // ignore: cast_nullable_to_non_nullable + as String?, + presentationId: null == presentationId + ? _self.presentationId + : presentationId // ignore: cast_nullable_to_non_nullable + as String, + expirationDate: freezed == expirationDate + ? _self.expirationDate + : expirationDate // ignore: cast_nullable_to_non_nullable + as DateTime?, + quantity: null == quantity + ? _self.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + reason: freezed == reason + ? _self.reason + : reason // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/adjust_stock_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/adjust_stock_dto.g.dart new file mode 100644 index 00000000..b7970666 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/adjust_stock_dto.g.dart @@ -0,0 +1,30 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'adjust_stock_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_AdjustStockDto _$AdjustStockDtoFromJson(Map json) => + _AdjustStockDto( + salePointId: json['sale_point_id'] as String, + variantId: json['variant_id'] as String?, + presentationId: json['presentation_id'] as String, + expirationDate: json['expiration_date'] == null + ? null + : DateTime.parse(json['expiration_date'] as String), + quantity: (json['quantity'] as num).toInt(), + reason: json['reason'] as String?, + ); + +Map _$AdjustStockDtoToJson(_AdjustStockDto instance) => + { + 'sale_point_id': instance.salePointId, + if (instance.variantId case final value?) 'variant_id': value, + 'presentation_id': instance.presentationId, + if (instance.expirationDate?.toIso8601String() case final value?) + 'expiration_date': value, + 'quantity': instance.quantity, + if (instance.reason case final value?) 'reason': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_logout_post_query_parameters.dart b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_logout_post_query_parameters.dart new file mode 100644 index 00000000..12ce351a --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_logout_post_query_parameters.dart @@ -0,0 +1,36 @@ +/// AuthApiAuthLogoutPostQueryParameters +/// { +/// "properties": { +/// "sessionId": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "required": [] +/// } +library auth_api_auth_logout_post_query_parameters; + +import 'exports.dart'; +part 'auth_api_auth_logout_post_query_parameters.freezed.dart'; +part 'auth_api_auth_logout_post_query_parameters.g.dart'; // AuthApiAuthLogoutPostQueryParameters + +@freezed +abstract class AuthApiAuthLogoutPostQueryParameters + with _$AuthApiAuthLogoutPostQueryParameters { + const AuthApiAuthLogoutPostQueryParameters._(); + + @jsonSerializable + const factory AuthApiAuthLogoutPostQueryParameters({ + /// sessionId + @JsonKey(name: AuthApiAuthLogoutPostQueryParameters.sessionIdKey_) + String? sessionId, + }) = _AuthApiAuthLogoutPostQueryParameters; + + factory AuthApiAuthLogoutPostQueryParameters.fromJson( + Map json, + ) => _$AuthApiAuthLogoutPostQueryParametersFromJson(json); + + static const String sessionIdKey_ = r'sessionId'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_logout_post_query_parameters.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_logout_post_query_parameters.freezed.dart new file mode 100644 index 00000000..b20a7163 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_logout_post_query_parameters.freezed.dart @@ -0,0 +1,345 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'auth_api_auth_logout_post_query_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AuthApiAuthLogoutPostQueryParameters { + /// sessionId + @JsonKey(name: AuthApiAuthLogoutPostQueryParameters.sessionIdKey_) + String? get sessionId; + + /// Create a copy of AuthApiAuthLogoutPostQueryParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AuthApiAuthLogoutPostQueryParametersCopyWith< + AuthApiAuthLogoutPostQueryParameters> + get copyWith => _$AuthApiAuthLogoutPostQueryParametersCopyWithImpl< + AuthApiAuthLogoutPostQueryParameters>( + this as AuthApiAuthLogoutPostQueryParameters, _$identity); + + /// Serializes this AuthApiAuthLogoutPostQueryParameters to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AuthApiAuthLogoutPostQueryParameters && + (identical(other.sessionId, sessionId) || + other.sessionId == sessionId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, sessionId); + + @override + String toString() { + return 'AuthApiAuthLogoutPostQueryParameters(sessionId: $sessionId)'; + } +} + +/// @nodoc +abstract mixin class $AuthApiAuthLogoutPostQueryParametersCopyWith<$Res> { + factory $AuthApiAuthLogoutPostQueryParametersCopyWith( + AuthApiAuthLogoutPostQueryParameters value, + $Res Function(AuthApiAuthLogoutPostQueryParameters) _then) = + _$AuthApiAuthLogoutPostQueryParametersCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: AuthApiAuthLogoutPostQueryParameters.sessionIdKey_) + String? sessionId}); +} + +/// @nodoc +class _$AuthApiAuthLogoutPostQueryParametersCopyWithImpl<$Res> + implements $AuthApiAuthLogoutPostQueryParametersCopyWith<$Res> { + _$AuthApiAuthLogoutPostQueryParametersCopyWithImpl(this._self, this._then); + + final AuthApiAuthLogoutPostQueryParameters _self; + final $Res Function(AuthApiAuthLogoutPostQueryParameters) _then; + + /// Create a copy of AuthApiAuthLogoutPostQueryParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? sessionId = freezed, + }) { + return _then(_self.copyWith( + sessionId: freezed == sessionId + ? _self.sessionId + : sessionId // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// Adds pattern-matching-related methods to [AuthApiAuthLogoutPostQueryParameters]. +extension AuthApiAuthLogoutPostQueryParametersPatterns + on AuthApiAuthLogoutPostQueryParameters { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_AuthApiAuthLogoutPostQueryParameters value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _AuthApiAuthLogoutPostQueryParameters() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_AuthApiAuthLogoutPostQueryParameters value) $default, + ) { + final _that = this; + switch (_that) { + case _AuthApiAuthLogoutPostQueryParameters(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_AuthApiAuthLogoutPostQueryParameters value)? $default, + ) { + final _that = this; + switch (_that) { + case _AuthApiAuthLogoutPostQueryParameters() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: AuthApiAuthLogoutPostQueryParameters.sessionIdKey_) + String? sessionId)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _AuthApiAuthLogoutPostQueryParameters() when $default != null: + return $default(_that.sessionId); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: AuthApiAuthLogoutPostQueryParameters.sessionIdKey_) + String? sessionId) + $default, + ) { + final _that = this; + switch (_that) { + case _AuthApiAuthLogoutPostQueryParameters(): + return $default(_that.sessionId); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: AuthApiAuthLogoutPostQueryParameters.sessionIdKey_) + String? sessionId)? + $default, + ) { + final _that = this; + switch (_that) { + case _AuthApiAuthLogoutPostQueryParameters() when $default != null: + return $default(_that.sessionId); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _AuthApiAuthLogoutPostQueryParameters + extends AuthApiAuthLogoutPostQueryParameters { + const _AuthApiAuthLogoutPostQueryParameters( + {@JsonKey(name: AuthApiAuthLogoutPostQueryParameters.sessionIdKey_) + this.sessionId}) + : super._(); + factory _AuthApiAuthLogoutPostQueryParameters.fromJson( + Map json) => + _$AuthApiAuthLogoutPostQueryParametersFromJson(json); + + /// sessionId + @override + @JsonKey(name: AuthApiAuthLogoutPostQueryParameters.sessionIdKey_) + final String? sessionId; + + /// Create a copy of AuthApiAuthLogoutPostQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$AuthApiAuthLogoutPostQueryParametersCopyWith< + _AuthApiAuthLogoutPostQueryParameters> + get copyWith => __$AuthApiAuthLogoutPostQueryParametersCopyWithImpl< + _AuthApiAuthLogoutPostQueryParameters>(this, _$identity); + + @override + Map toJson() { + return _$AuthApiAuthLogoutPostQueryParametersToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _AuthApiAuthLogoutPostQueryParameters && + (identical(other.sessionId, sessionId) || + other.sessionId == sessionId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, sessionId); + + @override + String toString() { + return 'AuthApiAuthLogoutPostQueryParameters(sessionId: $sessionId)'; + } +} + +/// @nodoc +abstract mixin class _$AuthApiAuthLogoutPostQueryParametersCopyWith<$Res> + implements $AuthApiAuthLogoutPostQueryParametersCopyWith<$Res> { + factory _$AuthApiAuthLogoutPostQueryParametersCopyWith( + _AuthApiAuthLogoutPostQueryParameters value, + $Res Function(_AuthApiAuthLogoutPostQueryParameters) _then) = + __$AuthApiAuthLogoutPostQueryParametersCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: AuthApiAuthLogoutPostQueryParameters.sessionIdKey_) + String? sessionId}); +} + +/// @nodoc +class __$AuthApiAuthLogoutPostQueryParametersCopyWithImpl<$Res> + implements _$AuthApiAuthLogoutPostQueryParametersCopyWith<$Res> { + __$AuthApiAuthLogoutPostQueryParametersCopyWithImpl(this._self, this._then); + + final _AuthApiAuthLogoutPostQueryParameters _self; + final $Res Function(_AuthApiAuthLogoutPostQueryParameters) _then; + + /// Create a copy of AuthApiAuthLogoutPostQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? sessionId = freezed, + }) { + return _then(_AuthApiAuthLogoutPostQueryParameters( + sessionId: freezed == sessionId + ? _self.sessionId + : sessionId // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_logout_post_query_parameters.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_logout_post_query_parameters.g.dart new file mode 100644 index 00000000..37b3d9cd --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_logout_post_query_parameters.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'auth_api_auth_logout_post_query_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_AuthApiAuthLogoutPostQueryParameters + _$AuthApiAuthLogoutPostQueryParametersFromJson(Map json) => + _AuthApiAuthLogoutPostQueryParameters( + sessionId: json['sessionId'] as String?, + ); + +Map _$AuthApiAuthLogoutPostQueryParametersToJson( + _AuthApiAuthLogoutPostQueryParameters instance) => + { + if (instance.sessionId case final value?) 'sessionId': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_refresh_token_post_query_parameters.dart b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_refresh_token_post_query_parameters.dart new file mode 100644 index 00000000..970462e5 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_refresh_token_post_query_parameters.dart @@ -0,0 +1,34 @@ +/// AuthApiAuthRefreshTokenPostQueryParameters +/// { +/// "properties": { +/// "refreshToken": { +/// "type": "string" +/// } +/// }, +/// "type": "object", +/// "required": [] +/// } +library auth_api_auth_refresh_token_post_query_parameters; + +import 'exports.dart'; +part 'auth_api_auth_refresh_token_post_query_parameters.freezed.dart'; +part 'auth_api_auth_refresh_token_post_query_parameters.g.dart'; // AuthApiAuthRefreshTokenPostQueryParameters + +@freezed +abstract class AuthApiAuthRefreshTokenPostQueryParameters + with _$AuthApiAuthRefreshTokenPostQueryParameters { + const AuthApiAuthRefreshTokenPostQueryParameters._(); + + @jsonSerializable + const factory AuthApiAuthRefreshTokenPostQueryParameters({ + /// refreshToken + @JsonKey(name: AuthApiAuthRefreshTokenPostQueryParameters.refreshTokenKey_) + String? refreshToken, + }) = _AuthApiAuthRefreshTokenPostQueryParameters; + + factory AuthApiAuthRefreshTokenPostQueryParameters.fromJson( + Map json, + ) => _$AuthApiAuthRefreshTokenPostQueryParametersFromJson(json); + + static const String refreshTokenKey_ = r'refreshToken'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_refresh_token_post_query_parameters.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_refresh_token_post_query_parameters.freezed.dart new file mode 100644 index 00000000..395b19b2 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_refresh_token_post_query_parameters.freezed.dart @@ -0,0 +1,359 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'auth_api_auth_refresh_token_post_query_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$AuthApiAuthRefreshTokenPostQueryParameters { + /// refreshToken + @JsonKey(name: AuthApiAuthRefreshTokenPostQueryParameters.refreshTokenKey_) + String? get refreshToken; + + /// Create a copy of AuthApiAuthRefreshTokenPostQueryParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AuthApiAuthRefreshTokenPostQueryParametersCopyWith< + AuthApiAuthRefreshTokenPostQueryParameters> + get copyWith => _$AuthApiAuthRefreshTokenPostQueryParametersCopyWithImpl< + AuthApiAuthRefreshTokenPostQueryParameters>( + this as AuthApiAuthRefreshTokenPostQueryParameters, _$identity); + + /// Serializes this AuthApiAuthRefreshTokenPostQueryParameters to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is AuthApiAuthRefreshTokenPostQueryParameters && + (identical(other.refreshToken, refreshToken) || + other.refreshToken == refreshToken)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, refreshToken); + + @override + String toString() { + return 'AuthApiAuthRefreshTokenPostQueryParameters(refreshToken: $refreshToken)'; + } +} + +/// @nodoc +abstract mixin class $AuthApiAuthRefreshTokenPostQueryParametersCopyWith<$Res> { + factory $AuthApiAuthRefreshTokenPostQueryParametersCopyWith( + AuthApiAuthRefreshTokenPostQueryParameters value, + $Res Function(AuthApiAuthRefreshTokenPostQueryParameters) _then) = + _$AuthApiAuthRefreshTokenPostQueryParametersCopyWithImpl; + @useResult + $Res call( + {@JsonKey( + name: AuthApiAuthRefreshTokenPostQueryParameters.refreshTokenKey_) + String? refreshToken}); +} + +/// @nodoc +class _$AuthApiAuthRefreshTokenPostQueryParametersCopyWithImpl<$Res> + implements $AuthApiAuthRefreshTokenPostQueryParametersCopyWith<$Res> { + _$AuthApiAuthRefreshTokenPostQueryParametersCopyWithImpl( + this._self, this._then); + + final AuthApiAuthRefreshTokenPostQueryParameters _self; + final $Res Function(AuthApiAuthRefreshTokenPostQueryParameters) _then; + + /// Create a copy of AuthApiAuthRefreshTokenPostQueryParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? refreshToken = freezed, + }) { + return _then(_self.copyWith( + refreshToken: freezed == refreshToken + ? _self.refreshToken + : refreshToken // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// Adds pattern-matching-related methods to [AuthApiAuthRefreshTokenPostQueryParameters]. +extension AuthApiAuthRefreshTokenPostQueryParametersPatterns + on AuthApiAuthRefreshTokenPostQueryParameters { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_AuthApiAuthRefreshTokenPostQueryParameters value)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _AuthApiAuthRefreshTokenPostQueryParameters() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_AuthApiAuthRefreshTokenPostQueryParameters value) + $default, + ) { + final _that = this; + switch (_that) { + case _AuthApiAuthRefreshTokenPostQueryParameters(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_AuthApiAuthRefreshTokenPostQueryParameters value)? + $default, + ) { + final _that = this; + switch (_that) { + case _AuthApiAuthRefreshTokenPostQueryParameters() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey( + name: + AuthApiAuthRefreshTokenPostQueryParameters.refreshTokenKey_) + String? refreshToken)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _AuthApiAuthRefreshTokenPostQueryParameters() when $default != null: + return $default(_that.refreshToken); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey( + name: + AuthApiAuthRefreshTokenPostQueryParameters.refreshTokenKey_) + String? refreshToken) + $default, + ) { + final _that = this; + switch (_that) { + case _AuthApiAuthRefreshTokenPostQueryParameters(): + return $default(_that.refreshToken); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey( + name: + AuthApiAuthRefreshTokenPostQueryParameters.refreshTokenKey_) + String? refreshToken)? + $default, + ) { + final _that = this; + switch (_that) { + case _AuthApiAuthRefreshTokenPostQueryParameters() when $default != null: + return $default(_that.refreshToken); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _AuthApiAuthRefreshTokenPostQueryParameters + extends AuthApiAuthRefreshTokenPostQueryParameters { + const _AuthApiAuthRefreshTokenPostQueryParameters( + {@JsonKey( + name: AuthApiAuthRefreshTokenPostQueryParameters.refreshTokenKey_) + this.refreshToken}) + : super._(); + factory _AuthApiAuthRefreshTokenPostQueryParameters.fromJson( + Map json) => + _$AuthApiAuthRefreshTokenPostQueryParametersFromJson(json); + + /// refreshToken + @override + @JsonKey(name: AuthApiAuthRefreshTokenPostQueryParameters.refreshTokenKey_) + final String? refreshToken; + + /// Create a copy of AuthApiAuthRefreshTokenPostQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$AuthApiAuthRefreshTokenPostQueryParametersCopyWith< + _AuthApiAuthRefreshTokenPostQueryParameters> + get copyWith => __$AuthApiAuthRefreshTokenPostQueryParametersCopyWithImpl< + _AuthApiAuthRefreshTokenPostQueryParameters>(this, _$identity); + + @override + Map toJson() { + return _$AuthApiAuthRefreshTokenPostQueryParametersToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _AuthApiAuthRefreshTokenPostQueryParameters && + (identical(other.refreshToken, refreshToken) || + other.refreshToken == refreshToken)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, refreshToken); + + @override + String toString() { + return 'AuthApiAuthRefreshTokenPostQueryParameters(refreshToken: $refreshToken)'; + } +} + +/// @nodoc +abstract mixin class _$AuthApiAuthRefreshTokenPostQueryParametersCopyWith<$Res> + implements $AuthApiAuthRefreshTokenPostQueryParametersCopyWith<$Res> { + factory _$AuthApiAuthRefreshTokenPostQueryParametersCopyWith( + _AuthApiAuthRefreshTokenPostQueryParameters value, + $Res Function(_AuthApiAuthRefreshTokenPostQueryParameters) _then) = + __$AuthApiAuthRefreshTokenPostQueryParametersCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey( + name: AuthApiAuthRefreshTokenPostQueryParameters.refreshTokenKey_) + String? refreshToken}); +} + +/// @nodoc +class __$AuthApiAuthRefreshTokenPostQueryParametersCopyWithImpl<$Res> + implements _$AuthApiAuthRefreshTokenPostQueryParametersCopyWith<$Res> { + __$AuthApiAuthRefreshTokenPostQueryParametersCopyWithImpl( + this._self, this._then); + + final _AuthApiAuthRefreshTokenPostQueryParameters _self; + final $Res Function(_AuthApiAuthRefreshTokenPostQueryParameters) _then; + + /// Create a copy of AuthApiAuthRefreshTokenPostQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? refreshToken = freezed, + }) { + return _then(_AuthApiAuthRefreshTokenPostQueryParameters( + refreshToken: freezed == refreshToken + ? _self.refreshToken + : refreshToken // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_refresh_token_post_query_parameters.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_refresh_token_post_query_parameters.g.dart new file mode 100644 index 00000000..3a715e02 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/auth_api_auth_refresh_token_post_query_parameters.g.dart @@ -0,0 +1,20 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'auth_api_auth_refresh_token_post_query_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_AuthApiAuthRefreshTokenPostQueryParameters + _$AuthApiAuthRefreshTokenPostQueryParametersFromJson( + Map json) => + _AuthApiAuthRefreshTokenPostQueryParameters( + refreshToken: json['refreshToken'] as String?, + ); + +Map _$AuthApiAuthRefreshTokenPostQueryParametersToJson( + _AuthApiAuthRefreshTokenPostQueryParameters instance) => + { + if (instance.refreshToken case final value?) 'refreshToken': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/base_uom_kind.dart b/packages/swagger_to_dart/example/lib/src/gen/models/base_uom_kind.dart new file mode 100644 index 00000000..53ae122f --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/base_uom_kind.dart @@ -0,0 +1,28 @@ +// BaseUomKind +// { +// "type": "string", +// "enum": [ +// "unit", +// "gram" +// ] +// } + +library base_uom_kind; + +import 'exports.dart'; +part 'base_uom_kind.g.dart'; + +@JsonEnum(alwaysCreate: true) +enum BaseUomKind { + @JsonValue("unit") + unit, + @JsonValue("gram") + gram; + + factory BaseUomKind.fromJson(String json) => BaseUomKind.values.firstWhere( + (e) => e.toJson() == json, + orElse: () => BaseUomKind.values.first, + ); + + String toJson() => _$BaseUomKindEnumMap[this]!; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/base_uom_kind.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/base_uom_kind.g.dart new file mode 100644 index 00000000..42d2a173 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/base_uom_kind.g.dart @@ -0,0 +1,12 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'base_uom_kind.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +const _$BaseUomKindEnumMap = { + BaseUomKind.unit: 'unit', + BaseUomKind.gram: 'gram', +}; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/category_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/category_dto.dart new file mode 100644 index 00000000..5b54b1d4 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/category_dto.dart @@ -0,0 +1,79 @@ +/// CategoryDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "name": { +/// "type": "string" +/// }, +/// "parent_id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "default_markup_percentage": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "children": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/CategoryDto" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "children", +/// "id", +/// "name" +/// ], +/// "additionalProperties": false +/// } +library category_dto; + +import 'exports.dart'; +part 'category_dto.freezed.dart'; +part 'category_dto.g.dart'; // CategoryDto + +@freezed +abstract class CategoryDto with _$CategoryDto { + const CategoryDto._(); + + @jsonSerializable + const factory CategoryDto({ + /// id + @JsonKey(name: CategoryDto.idKey_) required String id, + + /// name + @JsonKey(name: CategoryDto.nameKey_) required String name, + + /// parentId + @JsonKey(name: CategoryDto.parentIdKey_) String? parentId, + + /// defaultMarkupPercentage + @JsonKey(name: CategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage, + + /// children + @JsonKey(name: CategoryDto.childrenKey_) + required List children, + }) = _CategoryDto; + + factory CategoryDto.fromJson(Map json) => + _$CategoryDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; + + static const String parentIdKey_ = r'parent_id'; + + static const String defaultMarkupPercentageKey_ = + r'default_markup_percentage'; + + static const String childrenKey_ = r'children'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/category_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/category_dto.freezed.dart new file mode 100644 index 00000000..1d8bc0f8 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/category_dto.freezed.dart @@ -0,0 +1,461 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'category_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CategoryDto { + /// id + @JsonKey(name: CategoryDto.idKey_) + String get id; + + /// name + @JsonKey(name: CategoryDto.nameKey_) + String get name; + + /// parentId + @JsonKey(name: CategoryDto.parentIdKey_) + String? get parentId; + + /// defaultMarkupPercentage + @JsonKey(name: CategoryDto.defaultMarkupPercentageKey_) + double? get defaultMarkupPercentage; + + /// children + @JsonKey(name: CategoryDto.childrenKey_) + List get children; + + /// Create a copy of CategoryDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CategoryDtoCopyWith get copyWith => + _$CategoryDtoCopyWithImpl(this as CategoryDto, _$identity); + + /// Serializes this CategoryDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CategoryDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.parentId, parentId) || + other.parentId == parentId) && + (identical( + other.defaultMarkupPercentage, defaultMarkupPercentage) || + other.defaultMarkupPercentage == defaultMarkupPercentage) && + const DeepCollectionEquality().equals(other.children, children)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, parentId, + defaultMarkupPercentage, const DeepCollectionEquality().hash(children)); + + @override + String toString() { + return 'CategoryDto(id: $id, name: $name, parentId: $parentId, defaultMarkupPercentage: $defaultMarkupPercentage, children: $children)'; + } +} + +/// @nodoc +abstract mixin class $CategoryDtoCopyWith<$Res> { + factory $CategoryDtoCopyWith( + CategoryDto value, $Res Function(CategoryDto) _then) = + _$CategoryDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CategoryDto.idKey_) String id, + @JsonKey(name: CategoryDto.nameKey_) String name, + @JsonKey(name: CategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: CategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage, + @JsonKey(name: CategoryDto.childrenKey_) List children}); +} + +/// @nodoc +class _$CategoryDtoCopyWithImpl<$Res> implements $CategoryDtoCopyWith<$Res> { + _$CategoryDtoCopyWithImpl(this._self, this._then); + + final CategoryDto _self; + final $Res Function(CategoryDto) _then; + + /// Create a copy of CategoryDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + Object? parentId = freezed, + Object? defaultMarkupPercentage = freezed, + Object? children = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + defaultMarkupPercentage: freezed == defaultMarkupPercentage + ? _self.defaultMarkupPercentage + : defaultMarkupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + children: null == children + ? _self.children + : children // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [CategoryDto]. +extension CategoryDtoPatterns on CategoryDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CategoryDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CategoryDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CategoryDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CategoryDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CategoryDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CategoryDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CategoryDto.idKey_) String id, + @JsonKey(name: CategoryDto.nameKey_) String name, + @JsonKey(name: CategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: CategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage, + @JsonKey(name: CategoryDto.childrenKey_) + List children)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CategoryDto() when $default != null: + return $default(_that.id, _that.name, _that.parentId, + _that.defaultMarkupPercentage, _that.children); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CategoryDto.idKey_) String id, + @JsonKey(name: CategoryDto.nameKey_) String name, + @JsonKey(name: CategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: CategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage, + @JsonKey(name: CategoryDto.childrenKey_) List children) + $default, + ) { + final _that = this; + switch (_that) { + case _CategoryDto(): + return $default(_that.id, _that.name, _that.parentId, + _that.defaultMarkupPercentage, _that.children); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CategoryDto.idKey_) String id, + @JsonKey(name: CategoryDto.nameKey_) String name, + @JsonKey(name: CategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: CategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage, + @JsonKey(name: CategoryDto.childrenKey_) + List children)? + $default, + ) { + final _that = this; + switch (_that) { + case _CategoryDto() when $default != null: + return $default(_that.id, _that.name, _that.parentId, + _that.defaultMarkupPercentage, _that.children); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CategoryDto extends CategoryDto { + const _CategoryDto( + {@JsonKey(name: CategoryDto.idKey_) required this.id, + @JsonKey(name: CategoryDto.nameKey_) required this.name, + @JsonKey(name: CategoryDto.parentIdKey_) this.parentId, + @JsonKey(name: CategoryDto.defaultMarkupPercentageKey_) + this.defaultMarkupPercentage, + @JsonKey(name: CategoryDto.childrenKey_) + required final List children}) + : _children = children, + super._(); + factory _CategoryDto.fromJson(Map json) => + _$CategoryDtoFromJson(json); + + /// id + @override + @JsonKey(name: CategoryDto.idKey_) + final String id; + + /// name + @override + @JsonKey(name: CategoryDto.nameKey_) + final String name; + + /// parentId + @override + @JsonKey(name: CategoryDto.parentIdKey_) + final String? parentId; + + /// defaultMarkupPercentage + @override + @JsonKey(name: CategoryDto.defaultMarkupPercentageKey_) + final double? defaultMarkupPercentage; + + /// children + final List _children; + + /// children + @override + @JsonKey(name: CategoryDto.childrenKey_) + List get children { + if (_children is EqualUnmodifiableListView) return _children; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_children); + } + + /// Create a copy of CategoryDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CategoryDtoCopyWith<_CategoryDto> get copyWith => + __$CategoryDtoCopyWithImpl<_CategoryDto>(this, _$identity); + + @override + Map toJson() { + return _$CategoryDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CategoryDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.parentId, parentId) || + other.parentId == parentId) && + (identical( + other.defaultMarkupPercentage, defaultMarkupPercentage) || + other.defaultMarkupPercentage == defaultMarkupPercentage) && + const DeepCollectionEquality().equals(other._children, _children)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, parentId, + defaultMarkupPercentage, const DeepCollectionEquality().hash(_children)); + + @override + String toString() { + return 'CategoryDto(id: $id, name: $name, parentId: $parentId, defaultMarkupPercentage: $defaultMarkupPercentage, children: $children)'; + } +} + +/// @nodoc +abstract mixin class _$CategoryDtoCopyWith<$Res> + implements $CategoryDtoCopyWith<$Res> { + factory _$CategoryDtoCopyWith( + _CategoryDto value, $Res Function(_CategoryDto) _then) = + __$CategoryDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CategoryDto.idKey_) String id, + @JsonKey(name: CategoryDto.nameKey_) String name, + @JsonKey(name: CategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: CategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage, + @JsonKey(name: CategoryDto.childrenKey_) List children}); +} + +/// @nodoc +class __$CategoryDtoCopyWithImpl<$Res> implements _$CategoryDtoCopyWith<$Res> { + __$CategoryDtoCopyWithImpl(this._self, this._then); + + final _CategoryDto _self; + final $Res Function(_CategoryDto) _then; + + /// Create a copy of CategoryDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? name = null, + Object? parentId = freezed, + Object? defaultMarkupPercentage = freezed, + Object? children = null, + }) { + return _then(_CategoryDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + defaultMarkupPercentage: freezed == defaultMarkupPercentage + ? _self.defaultMarkupPercentage + : defaultMarkupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + children: null == children + ? _self._children + : children // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/category_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/category_dto.g.dart new file mode 100644 index 00000000..aa5e8a94 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/category_dto.g.dart @@ -0,0 +1,28 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'category_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CategoryDto _$CategoryDtoFromJson(Map json) => _CategoryDto( + id: json['id'] as String, + name: json['name'] as String, + parentId: json['parent_id'] as String?, + defaultMarkupPercentage: + (json['default_markup_percentage'] as num?)?.toDouble(), + children: (json['children'] as List) + .map((e) => CategoryDto.fromJson(e as Map)) + .toList(), + ); + +Map _$CategoryDtoToJson(_CategoryDto instance) => + { + 'id': instance.id, + 'name': instance.name, + if (instance.parentId case final value?) 'parent_id': value, + if (instance.defaultMarkupPercentage case final value?) + 'default_markup_percentage': value, + 'children': instance.children.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/change.dart b/packages/swagger_to_dart/example/lib/src/gen/models/change.dart new file mode 100644 index 00000000..070bf922 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/change.dart @@ -0,0 +1,101 @@ +/// Change +/// { +/// "properties": { +/// "change_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "entity_name": { +/// "type": "string" +/// }, +/// "entity_id": { +/// "type": "array", +/// "items": {} +/// }, +/// "change_type": { +/// "$ref": "#/components/schemas/ChangeType" +/// }, +/// "etag": { +/// "type": "integer", +/// "format": "int32" +/// }, +/// "new_data_json": { +/// "type": "string" +/// }, +/// "source_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "timestamp": { +/// "type": "string", +/// "format": "date-time" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "change_id", +/// "change_type", +/// "entity_id", +/// "entity_name", +/// "etag", +/// "new_data_json", +/// "source_id", +/// "timestamp" +/// ], +/// "additionalProperties": false +/// } +library change; + +import 'exports.dart'; +part 'change.freezed.dart'; +part 'change.g.dart'; // Change + +@freezed +abstract class Change with _$Change { + const Change._(); + + @jsonSerializable + const factory Change({ + /// changeId + @JsonKey(name: Change.changeIdKey_) required String changeId, + + /// entityName + @JsonKey(name: Change.entityNameKey_) required String entityName, + + /// entityId + @JsonKey(name: Change.entityIdKey_) required List entityId, + + /// changeType + @JsonKey(name: Change.changeTypeKey_) required ChangeType changeType, + + /// etag + @JsonKey(name: Change.etagKey_) required int etag, + + /// newDataJson + @JsonKey(name: Change.newDataJsonKey_) required String newDataJson, + + /// sourceId + @JsonKey(name: Change.sourceIdKey_) required String sourceId, + + /// timestamp + @JsonKey(name: Change.timestampKey_) required DateTime timestamp, + }) = _Change; + + factory Change.fromJson(Map json) => _$ChangeFromJson(json); + + static const String changeIdKey_ = r'change_id'; + + static const String entityNameKey_ = r'entity_name'; + + static const String entityIdKey_ = r'entity_id'; + + static const String changeTypeKey_ = r'change_type'; + + static const String etagKey_ = r'etag'; + + static const String newDataJsonKey_ = r'new_data_json'; + + static const String sourceIdKey_ = r'source_id'; + + static const String timestampKey_ = r'timestamp'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/change.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/change.freezed.dart new file mode 100644 index 00000000..c63f7ebc --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/change.freezed.dart @@ -0,0 +1,572 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'change.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$Change { + /// changeId + @JsonKey(name: Change.changeIdKey_) + String get changeId; + + /// entityName + @JsonKey(name: Change.entityNameKey_) + String get entityName; + + /// entityId + @JsonKey(name: Change.entityIdKey_) + List get entityId; + + /// changeType + @JsonKey(name: Change.changeTypeKey_) + ChangeType get changeType; + + /// etag + @JsonKey(name: Change.etagKey_) + int get etag; + + /// newDataJson + @JsonKey(name: Change.newDataJsonKey_) + String get newDataJson; + + /// sourceId + @JsonKey(name: Change.sourceIdKey_) + String get sourceId; + + /// timestamp + @JsonKey(name: Change.timestampKey_) + DateTime get timestamp; + + /// Create a copy of Change + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChangeCopyWith get copyWith => + _$ChangeCopyWithImpl(this as Change, _$identity); + + /// Serializes this Change to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Change && + (identical(other.changeId, changeId) || + other.changeId == changeId) && + (identical(other.entityName, entityName) || + other.entityName == entityName) && + const DeepCollectionEquality().equals(other.entityId, entityId) && + (identical(other.changeType, changeType) || + other.changeType == changeType) && + (identical(other.etag, etag) || other.etag == etag) && + (identical(other.newDataJson, newDataJson) || + other.newDataJson == newDataJson) && + (identical(other.sourceId, sourceId) || + other.sourceId == sourceId) && + (identical(other.timestamp, timestamp) || + other.timestamp == timestamp)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + changeId, + entityName, + const DeepCollectionEquality().hash(entityId), + changeType, + etag, + newDataJson, + sourceId, + timestamp); + + @override + String toString() { + return 'Change(changeId: $changeId, entityName: $entityName, entityId: $entityId, changeType: $changeType, etag: $etag, newDataJson: $newDataJson, sourceId: $sourceId, timestamp: $timestamp)'; + } +} + +/// @nodoc +abstract mixin class $ChangeCopyWith<$Res> { + factory $ChangeCopyWith(Change value, $Res Function(Change) _then) = + _$ChangeCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: Change.changeIdKey_) String changeId, + @JsonKey(name: Change.entityNameKey_) String entityName, + @JsonKey(name: Change.entityIdKey_) List entityId, + @JsonKey(name: Change.changeTypeKey_) ChangeType changeType, + @JsonKey(name: Change.etagKey_) int etag, + @JsonKey(name: Change.newDataJsonKey_) String newDataJson, + @JsonKey(name: Change.sourceIdKey_) String sourceId, + @JsonKey(name: Change.timestampKey_) DateTime timestamp}); +} + +/// @nodoc +class _$ChangeCopyWithImpl<$Res> implements $ChangeCopyWith<$Res> { + _$ChangeCopyWithImpl(this._self, this._then); + + final Change _self; + final $Res Function(Change) _then; + + /// Create a copy of Change + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? changeId = null, + Object? entityName = null, + Object? entityId = null, + Object? changeType = null, + Object? etag = null, + Object? newDataJson = null, + Object? sourceId = null, + Object? timestamp = null, + }) { + return _then(_self.copyWith( + changeId: null == changeId + ? _self.changeId + : changeId // ignore: cast_nullable_to_non_nullable + as String, + entityName: null == entityName + ? _self.entityName + : entityName // ignore: cast_nullable_to_non_nullable + as String, + entityId: null == entityId + ? _self.entityId + : entityId // ignore: cast_nullable_to_non_nullable + as List, + changeType: null == changeType + ? _self.changeType + : changeType // ignore: cast_nullable_to_non_nullable + as ChangeType, + etag: null == etag + ? _self.etag + : etag // ignore: cast_nullable_to_non_nullable + as int, + newDataJson: null == newDataJson + ? _self.newDataJson + : newDataJson // ignore: cast_nullable_to_non_nullable + as String, + sourceId: null == sourceId + ? _self.sourceId + : sourceId // ignore: cast_nullable_to_non_nullable + as String, + timestamp: null == timestamp + ? _self.timestamp + : timestamp // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} + +/// Adds pattern-matching-related methods to [Change]. +extension ChangePatterns on Change { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_Change value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _Change() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_Change value) $default, + ) { + final _that = this; + switch (_that) { + case _Change(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_Change value)? $default, + ) { + final _that = this; + switch (_that) { + case _Change() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: Change.changeIdKey_) String changeId, + @JsonKey(name: Change.entityNameKey_) String entityName, + @JsonKey(name: Change.entityIdKey_) List entityId, + @JsonKey(name: Change.changeTypeKey_) ChangeType changeType, + @JsonKey(name: Change.etagKey_) int etag, + @JsonKey(name: Change.newDataJsonKey_) String newDataJson, + @JsonKey(name: Change.sourceIdKey_) String sourceId, + @JsonKey(name: Change.timestampKey_) DateTime timestamp)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _Change() when $default != null: + return $default( + _that.changeId, + _that.entityName, + _that.entityId, + _that.changeType, + _that.etag, + _that.newDataJson, + _that.sourceId, + _that.timestamp); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: Change.changeIdKey_) String changeId, + @JsonKey(name: Change.entityNameKey_) String entityName, + @JsonKey(name: Change.entityIdKey_) List entityId, + @JsonKey(name: Change.changeTypeKey_) ChangeType changeType, + @JsonKey(name: Change.etagKey_) int etag, + @JsonKey(name: Change.newDataJsonKey_) String newDataJson, + @JsonKey(name: Change.sourceIdKey_) String sourceId, + @JsonKey(name: Change.timestampKey_) DateTime timestamp) + $default, + ) { + final _that = this; + switch (_that) { + case _Change(): + return $default( + _that.changeId, + _that.entityName, + _that.entityId, + _that.changeType, + _that.etag, + _that.newDataJson, + _that.sourceId, + _that.timestamp); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: Change.changeIdKey_) String changeId, + @JsonKey(name: Change.entityNameKey_) String entityName, + @JsonKey(name: Change.entityIdKey_) List entityId, + @JsonKey(name: Change.changeTypeKey_) ChangeType changeType, + @JsonKey(name: Change.etagKey_) int etag, + @JsonKey(name: Change.newDataJsonKey_) String newDataJson, + @JsonKey(name: Change.sourceIdKey_) String sourceId, + @JsonKey(name: Change.timestampKey_) DateTime timestamp)? + $default, + ) { + final _that = this; + switch (_that) { + case _Change() when $default != null: + return $default( + _that.changeId, + _that.entityName, + _that.entityId, + _that.changeType, + _that.etag, + _that.newDataJson, + _that.sourceId, + _that.timestamp); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _Change extends Change { + const _Change( + {@JsonKey(name: Change.changeIdKey_) required this.changeId, + @JsonKey(name: Change.entityNameKey_) required this.entityName, + @JsonKey(name: Change.entityIdKey_) required final List entityId, + @JsonKey(name: Change.changeTypeKey_) required this.changeType, + @JsonKey(name: Change.etagKey_) required this.etag, + @JsonKey(name: Change.newDataJsonKey_) required this.newDataJson, + @JsonKey(name: Change.sourceIdKey_) required this.sourceId, + @JsonKey(name: Change.timestampKey_) required this.timestamp}) + : _entityId = entityId, + super._(); + factory _Change.fromJson(Map json) => _$ChangeFromJson(json); + + /// changeId + @override + @JsonKey(name: Change.changeIdKey_) + final String changeId; + + /// entityName + @override + @JsonKey(name: Change.entityNameKey_) + final String entityName; + + /// entityId + final List _entityId; + + /// entityId + @override + @JsonKey(name: Change.entityIdKey_) + List get entityId { + if (_entityId is EqualUnmodifiableListView) return _entityId; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_entityId); + } + + /// changeType + @override + @JsonKey(name: Change.changeTypeKey_) + final ChangeType changeType; + + /// etag + @override + @JsonKey(name: Change.etagKey_) + final int etag; + + /// newDataJson + @override + @JsonKey(name: Change.newDataJsonKey_) + final String newDataJson; + + /// sourceId + @override + @JsonKey(name: Change.sourceIdKey_) + final String sourceId; + + /// timestamp + @override + @JsonKey(name: Change.timestampKey_) + final DateTime timestamp; + + /// Create a copy of Change + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ChangeCopyWith<_Change> get copyWith => + __$ChangeCopyWithImpl<_Change>(this, _$identity); + + @override + Map toJson() { + return _$ChangeToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _Change && + (identical(other.changeId, changeId) || + other.changeId == changeId) && + (identical(other.entityName, entityName) || + other.entityName == entityName) && + const DeepCollectionEquality().equals(other._entityId, _entityId) && + (identical(other.changeType, changeType) || + other.changeType == changeType) && + (identical(other.etag, etag) || other.etag == etag) && + (identical(other.newDataJson, newDataJson) || + other.newDataJson == newDataJson) && + (identical(other.sourceId, sourceId) || + other.sourceId == sourceId) && + (identical(other.timestamp, timestamp) || + other.timestamp == timestamp)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + changeId, + entityName, + const DeepCollectionEquality().hash(_entityId), + changeType, + etag, + newDataJson, + sourceId, + timestamp); + + @override + String toString() { + return 'Change(changeId: $changeId, entityName: $entityName, entityId: $entityId, changeType: $changeType, etag: $etag, newDataJson: $newDataJson, sourceId: $sourceId, timestamp: $timestamp)'; + } +} + +/// @nodoc +abstract mixin class _$ChangeCopyWith<$Res> implements $ChangeCopyWith<$Res> { + factory _$ChangeCopyWith(_Change value, $Res Function(_Change) _then) = + __$ChangeCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: Change.changeIdKey_) String changeId, + @JsonKey(name: Change.entityNameKey_) String entityName, + @JsonKey(name: Change.entityIdKey_) List entityId, + @JsonKey(name: Change.changeTypeKey_) ChangeType changeType, + @JsonKey(name: Change.etagKey_) int etag, + @JsonKey(name: Change.newDataJsonKey_) String newDataJson, + @JsonKey(name: Change.sourceIdKey_) String sourceId, + @JsonKey(name: Change.timestampKey_) DateTime timestamp}); +} + +/// @nodoc +class __$ChangeCopyWithImpl<$Res> implements _$ChangeCopyWith<$Res> { + __$ChangeCopyWithImpl(this._self, this._then); + + final _Change _self; + final $Res Function(_Change) _then; + + /// Create a copy of Change + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? changeId = null, + Object? entityName = null, + Object? entityId = null, + Object? changeType = null, + Object? etag = null, + Object? newDataJson = null, + Object? sourceId = null, + Object? timestamp = null, + }) { + return _then(_Change( + changeId: null == changeId + ? _self.changeId + : changeId // ignore: cast_nullable_to_non_nullable + as String, + entityName: null == entityName + ? _self.entityName + : entityName // ignore: cast_nullable_to_non_nullable + as String, + entityId: null == entityId + ? _self._entityId + : entityId // ignore: cast_nullable_to_non_nullable + as List, + changeType: null == changeType + ? _self.changeType + : changeType // ignore: cast_nullable_to_non_nullable + as ChangeType, + etag: null == etag + ? _self.etag + : etag // ignore: cast_nullable_to_non_nullable + as int, + newDataJson: null == newDataJson + ? _self.newDataJson + : newDataJson // ignore: cast_nullable_to_non_nullable + as String, + sourceId: null == sourceId + ? _self.sourceId + : sourceId // ignore: cast_nullable_to_non_nullable + as String, + timestamp: null == timestamp + ? _self.timestamp + : timestamp // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/change.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/change.g.dart new file mode 100644 index 00000000..589b7a74 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/change.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'change.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_Change _$ChangeFromJson(Map json) => _Change( + changeId: json['change_id'] as String, + entityName: json['entity_name'] as String, + entityId: json['entity_id'] as List, + changeType: ChangeType.fromJson(json['change_type'] as String), + etag: (json['etag'] as num).toInt(), + newDataJson: json['new_data_json'] as String, + sourceId: json['source_id'] as String, + timestamp: DateTime.parse(json['timestamp'] as String), + ); + +Map _$ChangeToJson(_Change instance) => { + 'change_id': instance.changeId, + 'entity_name': instance.entityName, + 'entity_id': instance.entityId, + 'change_type': instance.changeType.toJson(), + 'etag': instance.etag, + 'new_data_json': instance.newDataJson, + 'source_id': instance.sourceId, + 'timestamp': instance.timestamp.toIso8601String(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/change_password_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/change_password_dto.dart new file mode 100644 index 00000000..febf2725 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/change_password_dto.dart @@ -0,0 +1,45 @@ +/// ChangePasswordDto +/// { +/// "properties": { +/// "old_password": { +/// "type": "string" +/// }, +/// "new_password": { +/// "type": "string" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "new_password", +/// "old_password" +/// ], +/// "additionalProperties": false +/// } +library change_password_dto; + +import 'exports.dart'; +part 'change_password_dto.freezed.dart'; +part 'change_password_dto.g.dart'; // ChangePasswordDto + +@freezed +abstract class ChangePasswordDto with _$ChangePasswordDto { + const ChangePasswordDto._(); + + @jsonSerializable + const factory ChangePasswordDto({ + /// oldPassword + @JsonKey(name: ChangePasswordDto.oldPasswordKey_) + required String oldPassword, + + /// newPassword + @JsonKey(name: ChangePasswordDto.newPasswordKey_) + required String newPassword, + }) = _ChangePasswordDto; + + factory ChangePasswordDto.fromJson(Map json) => + _$ChangePasswordDtoFromJson(json); + + static const String oldPasswordKey_ = r'old_password'; + + static const String newPasswordKey_ = r'new_password'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/change_password_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/change_password_dto.freezed.dart new file mode 100644 index 00000000..4fb6ac2e --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/change_password_dto.freezed.dart @@ -0,0 +1,367 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'change_password_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChangePasswordDto { + /// oldPassword + @JsonKey(name: ChangePasswordDto.oldPasswordKey_) + String get oldPassword; + + /// newPassword + @JsonKey(name: ChangePasswordDto.newPasswordKey_) + String get newPassword; + + /// Create a copy of ChangePasswordDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChangePasswordDtoCopyWith get copyWith => + _$ChangePasswordDtoCopyWithImpl( + this as ChangePasswordDto, _$identity); + + /// Serializes this ChangePasswordDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ChangePasswordDto && + (identical(other.oldPassword, oldPassword) || + other.oldPassword == oldPassword) && + (identical(other.newPassword, newPassword) || + other.newPassword == newPassword)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, oldPassword, newPassword); + + @override + String toString() { + return 'ChangePasswordDto(oldPassword: $oldPassword, newPassword: $newPassword)'; + } +} + +/// @nodoc +abstract mixin class $ChangePasswordDtoCopyWith<$Res> { + factory $ChangePasswordDtoCopyWith( + ChangePasswordDto value, $Res Function(ChangePasswordDto) _then) = + _$ChangePasswordDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: ChangePasswordDto.oldPasswordKey_) String oldPassword, + @JsonKey(name: ChangePasswordDto.newPasswordKey_) String newPassword}); +} + +/// @nodoc +class _$ChangePasswordDtoCopyWithImpl<$Res> + implements $ChangePasswordDtoCopyWith<$Res> { + _$ChangePasswordDtoCopyWithImpl(this._self, this._then); + + final ChangePasswordDto _self; + final $Res Function(ChangePasswordDto) _then; + + /// Create a copy of ChangePasswordDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? oldPassword = null, + Object? newPassword = null, + }) { + return _then(_self.copyWith( + oldPassword: null == oldPassword + ? _self.oldPassword + : oldPassword // ignore: cast_nullable_to_non_nullable + as String, + newPassword: null == newPassword + ? _self.newPassword + : newPassword // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [ChangePasswordDto]. +extension ChangePasswordDtoPatterns on ChangePasswordDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_ChangePasswordDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ChangePasswordDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_ChangePasswordDto value) $default, + ) { + final _that = this; + switch (_that) { + case _ChangePasswordDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_ChangePasswordDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _ChangePasswordDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: ChangePasswordDto.oldPasswordKey_) + String oldPassword, + @JsonKey(name: ChangePasswordDto.newPasswordKey_) + String newPassword)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ChangePasswordDto() when $default != null: + return $default(_that.oldPassword, _that.newPassword); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: ChangePasswordDto.oldPasswordKey_) + String oldPassword, + @JsonKey(name: ChangePasswordDto.newPasswordKey_) + String newPassword) + $default, + ) { + final _that = this; + switch (_that) { + case _ChangePasswordDto(): + return $default(_that.oldPassword, _that.newPassword); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: ChangePasswordDto.oldPasswordKey_) + String oldPassword, + @JsonKey(name: ChangePasswordDto.newPasswordKey_) + String newPassword)? + $default, + ) { + final _that = this; + switch (_that) { + case _ChangePasswordDto() when $default != null: + return $default(_that.oldPassword, _that.newPassword); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _ChangePasswordDto extends ChangePasswordDto { + const _ChangePasswordDto( + {@JsonKey(name: ChangePasswordDto.oldPasswordKey_) + required this.oldPassword, + @JsonKey(name: ChangePasswordDto.newPasswordKey_) + required this.newPassword}) + : super._(); + factory _ChangePasswordDto.fromJson(Map json) => + _$ChangePasswordDtoFromJson(json); + + /// oldPassword + @override + @JsonKey(name: ChangePasswordDto.oldPasswordKey_) + final String oldPassword; + + /// newPassword + @override + @JsonKey(name: ChangePasswordDto.newPasswordKey_) + final String newPassword; + + /// Create a copy of ChangePasswordDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ChangePasswordDtoCopyWith<_ChangePasswordDto> get copyWith => + __$ChangePasswordDtoCopyWithImpl<_ChangePasswordDto>(this, _$identity); + + @override + Map toJson() { + return _$ChangePasswordDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _ChangePasswordDto && + (identical(other.oldPassword, oldPassword) || + other.oldPassword == oldPassword) && + (identical(other.newPassword, newPassword) || + other.newPassword == newPassword)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, oldPassword, newPassword); + + @override + String toString() { + return 'ChangePasswordDto(oldPassword: $oldPassword, newPassword: $newPassword)'; + } +} + +/// @nodoc +abstract mixin class _$ChangePasswordDtoCopyWith<$Res> + implements $ChangePasswordDtoCopyWith<$Res> { + factory _$ChangePasswordDtoCopyWith( + _ChangePasswordDto value, $Res Function(_ChangePasswordDto) _then) = + __$ChangePasswordDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: ChangePasswordDto.oldPasswordKey_) String oldPassword, + @JsonKey(name: ChangePasswordDto.newPasswordKey_) String newPassword}); +} + +/// @nodoc +class __$ChangePasswordDtoCopyWithImpl<$Res> + implements _$ChangePasswordDtoCopyWith<$Res> { + __$ChangePasswordDtoCopyWithImpl(this._self, this._then); + + final _ChangePasswordDto _self; + final $Res Function(_ChangePasswordDto) _then; + + /// Create a copy of ChangePasswordDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? oldPassword = null, + Object? newPassword = null, + }) { + return _then(_ChangePasswordDto( + oldPassword: null == oldPassword + ? _self.oldPassword + : oldPassword // ignore: cast_nullable_to_non_nullable + as String, + newPassword: null == newPassword + ? _self.newPassword + : newPassword // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/change_password_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/change_password_dto.g.dart new file mode 100644 index 00000000..421beffd --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/change_password_dto.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'change_password_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_ChangePasswordDto _$ChangePasswordDtoFromJson(Map json) => + _ChangePasswordDto( + oldPassword: json['old_password'] as String, + newPassword: json['new_password'] as String, + ); + +Map _$ChangePasswordDtoToJson(_ChangePasswordDto instance) => + { + 'old_password': instance.oldPassword, + 'new_password': instance.newPassword, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/change_type.dart b/packages/swagger_to_dart/example/lib/src/gen/models/change_type.dart new file mode 100644 index 00000000..c77f443a --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/change_type.dart @@ -0,0 +1,31 @@ +// ChangeType +// { +// "type": "string", +// "enum": [ +// "create", +// "delete", +// "update" +// ] +// } + +library change_type; + +import 'exports.dart'; +part 'change_type.g.dart'; + +@JsonEnum(alwaysCreate: true) +enum ChangeType { + @JsonValue("create") + create, + @JsonValue("delete") + delete, + @JsonValue("update") + update; + + factory ChangeType.fromJson(String json) => ChangeType.values.firstWhere( + (e) => e.toJson() == json, + orElse: () => ChangeType.values.first, + ); + + String toJson() => _$ChangeTypeEnumMap[this]!; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/change_type.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/change_type.g.dart new file mode 100644 index 00000000..154d7a2a --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/change_type.g.dart @@ -0,0 +1,13 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'change_type.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +const _$ChangeTypeEnumMap = { + ChangeType.create: 'create', + ChangeType.delete: 'delete', + ChangeType.update: 'update', +}; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_category_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_category_dto.dart new file mode 100644 index 00000000..a9e878fb --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_category_dto.dart @@ -0,0 +1,56 @@ +/// CreateCategoryDto +/// { +/// "properties": { +/// "name": { +/// "type": "string" +/// }, +/// "parent_id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "default_markup_percentage": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "name" +/// ], +/// "additionalProperties": false +/// } +library create_category_dto; + +import 'exports.dart'; +part 'create_category_dto.freezed.dart'; +part 'create_category_dto.g.dart'; // CreateCategoryDto + +@freezed +abstract class CreateCategoryDto with _$CreateCategoryDto { + const CreateCategoryDto._(); + + @jsonSerializable + const factory CreateCategoryDto({ + /// name + @JsonKey(name: CreateCategoryDto.nameKey_) required String name, + + /// parentId + @JsonKey(name: CreateCategoryDto.parentIdKey_) String? parentId, + + /// defaultMarkupPercentage + @JsonKey(name: CreateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage, + }) = _CreateCategoryDto; + + factory CreateCategoryDto.fromJson(Map json) => + _$CreateCategoryDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String parentIdKey_ = r'parent_id'; + + static const String defaultMarkupPercentageKey_ = + r'default_markup_percentage'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_category_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_category_dto.freezed.dart new file mode 100644 index 00000000..704d30f3 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_category_dto.freezed.dart @@ -0,0 +1,399 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_category_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateCategoryDto { + /// name + @JsonKey(name: CreateCategoryDto.nameKey_) + String get name; + + /// parentId + @JsonKey(name: CreateCategoryDto.parentIdKey_) + String? get parentId; + + /// defaultMarkupPercentage + @JsonKey(name: CreateCategoryDto.defaultMarkupPercentageKey_) + double? get defaultMarkupPercentage; + + /// Create a copy of CreateCategoryDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateCategoryDtoCopyWith get copyWith => + _$CreateCategoryDtoCopyWithImpl( + this as CreateCategoryDto, _$identity); + + /// Serializes this CreateCategoryDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateCategoryDto && + (identical(other.name, name) || other.name == name) && + (identical(other.parentId, parentId) || + other.parentId == parentId) && + (identical( + other.defaultMarkupPercentage, defaultMarkupPercentage) || + other.defaultMarkupPercentage == defaultMarkupPercentage)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, parentId, defaultMarkupPercentage); + + @override + String toString() { + return 'CreateCategoryDto(name: $name, parentId: $parentId, defaultMarkupPercentage: $defaultMarkupPercentage)'; + } +} + +/// @nodoc +abstract mixin class $CreateCategoryDtoCopyWith<$Res> { + factory $CreateCategoryDtoCopyWith( + CreateCategoryDto value, $Res Function(CreateCategoryDto) _then) = + _$CreateCategoryDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreateCategoryDto.nameKey_) String name, + @JsonKey(name: CreateCategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: CreateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage}); +} + +/// @nodoc +class _$CreateCategoryDtoCopyWithImpl<$Res> + implements $CreateCategoryDtoCopyWith<$Res> { + _$CreateCategoryDtoCopyWithImpl(this._self, this._then); + + final CreateCategoryDto _self; + final $Res Function(CreateCategoryDto) _then; + + /// Create a copy of CreateCategoryDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? parentId = freezed, + Object? defaultMarkupPercentage = freezed, + }) { + return _then(_self.copyWith( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + defaultMarkupPercentage: freezed == defaultMarkupPercentage + ? _self.defaultMarkupPercentage + : defaultMarkupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + )); + } +} + +/// Adds pattern-matching-related methods to [CreateCategoryDto]. +extension CreateCategoryDtoPatterns on CreateCategoryDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreateCategoryDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateCategoryDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreateCategoryDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CreateCategoryDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreateCategoryDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreateCategoryDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreateCategoryDto.nameKey_) String name, + @JsonKey(name: CreateCategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: CreateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateCategoryDto() when $default != null: + return $default( + _that.name, _that.parentId, _that.defaultMarkupPercentage); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreateCategoryDto.nameKey_) String name, + @JsonKey(name: CreateCategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: CreateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage) + $default, + ) { + final _that = this; + switch (_that) { + case _CreateCategoryDto(): + return $default( + _that.name, _that.parentId, _that.defaultMarkupPercentage); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreateCategoryDto.nameKey_) String name, + @JsonKey(name: CreateCategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: CreateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreateCategoryDto() when $default != null: + return $default( + _that.name, _that.parentId, _that.defaultMarkupPercentage); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreateCategoryDto extends CreateCategoryDto { + const _CreateCategoryDto( + {@JsonKey(name: CreateCategoryDto.nameKey_) required this.name, + @JsonKey(name: CreateCategoryDto.parentIdKey_) this.parentId, + @JsonKey(name: CreateCategoryDto.defaultMarkupPercentageKey_) + this.defaultMarkupPercentage}) + : super._(); + factory _CreateCategoryDto.fromJson(Map json) => + _$CreateCategoryDtoFromJson(json); + + /// name + @override + @JsonKey(name: CreateCategoryDto.nameKey_) + final String name; + + /// parentId + @override + @JsonKey(name: CreateCategoryDto.parentIdKey_) + final String? parentId; + + /// defaultMarkupPercentage + @override + @JsonKey(name: CreateCategoryDto.defaultMarkupPercentageKey_) + final double? defaultMarkupPercentage; + + /// Create a copy of CreateCategoryDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreateCategoryDtoCopyWith<_CreateCategoryDto> get copyWith => + __$CreateCategoryDtoCopyWithImpl<_CreateCategoryDto>(this, _$identity); + + @override + Map toJson() { + return _$CreateCategoryDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreateCategoryDto && + (identical(other.name, name) || other.name == name) && + (identical(other.parentId, parentId) || + other.parentId == parentId) && + (identical( + other.defaultMarkupPercentage, defaultMarkupPercentage) || + other.defaultMarkupPercentage == defaultMarkupPercentage)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, parentId, defaultMarkupPercentage); + + @override + String toString() { + return 'CreateCategoryDto(name: $name, parentId: $parentId, defaultMarkupPercentage: $defaultMarkupPercentage)'; + } +} + +/// @nodoc +abstract mixin class _$CreateCategoryDtoCopyWith<$Res> + implements $CreateCategoryDtoCopyWith<$Res> { + factory _$CreateCategoryDtoCopyWith( + _CreateCategoryDto value, $Res Function(_CreateCategoryDto) _then) = + __$CreateCategoryDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreateCategoryDto.nameKey_) String name, + @JsonKey(name: CreateCategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: CreateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage}); +} + +/// @nodoc +class __$CreateCategoryDtoCopyWithImpl<$Res> + implements _$CreateCategoryDtoCopyWith<$Res> { + __$CreateCategoryDtoCopyWithImpl(this._self, this._then); + + final _CreateCategoryDto _self; + final $Res Function(_CreateCategoryDto) _then; + + /// Create a copy of CreateCategoryDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = null, + Object? parentId = freezed, + Object? defaultMarkupPercentage = freezed, + }) { + return _then(_CreateCategoryDto( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + defaultMarkupPercentage: freezed == defaultMarkupPercentage + ? _self.defaultMarkupPercentage + : defaultMarkupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_category_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_category_dto.g.dart new file mode 100644 index 00000000..1b14b494 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_category_dto.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_category_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreateCategoryDto _$CreateCategoryDtoFromJson(Map json) => + _CreateCategoryDto( + name: json['name'] as String, + parentId: json['parent_id'] as String?, + defaultMarkupPercentage: + (json['default_markup_percentage'] as num?)?.toDouble(), + ); + +Map _$CreateCategoryDtoToJson(_CreateCategoryDto instance) => + { + 'name': instance.name, + if (instance.parentId case final value?) 'parent_id': value, + if (instance.defaultMarkupPercentage case final value?) + 'default_markup_percentage': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_account_entry_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_account_entry_dto.dart new file mode 100644 index 00000000..829aa45d --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_account_entry_dto.dart @@ -0,0 +1,56 @@ +/// CreateCustomerAccountEntryDto +/// { +/// "properties": { +/// "kind": { +/// "$ref": "#/components/schemas/CustomerAccountEntryKind" +/// }, +/// "amount": { +/// "type": "number", +/// "format": "double" +/// }, +/// "notes": { +/// "type": "string", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "amount", +/// "kind" +/// ], +/// "additionalProperties": false +/// } +library create_customer_account_entry_dto; + +import 'exports.dart'; +part 'create_customer_account_entry_dto.freezed.dart'; +part 'create_customer_account_entry_dto.g.dart'; // CreateCustomerAccountEntryDto + +@freezed +abstract class CreateCustomerAccountEntryDto + with _$CreateCustomerAccountEntryDto { + const CreateCustomerAccountEntryDto._(); + + @jsonSerializable + const factory CreateCustomerAccountEntryDto({ + /// kind + @JsonKey(name: CreateCustomerAccountEntryDto.kindKey_) + required CustomerAccountEntryKind kind, + + /// amount + @JsonKey(name: CreateCustomerAccountEntryDto.amountKey_) + required double amount, + + /// notes + @JsonKey(name: CreateCustomerAccountEntryDto.notesKey_) String? notes, + }) = _CreateCustomerAccountEntryDto; + + factory CreateCustomerAccountEntryDto.fromJson(Map json) => + _$CreateCustomerAccountEntryDtoFromJson(json); + + static const String kindKey_ = r'kind'; + + static const String amountKey_ = r'amount'; + + static const String notesKey_ = r'notes'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_account_entry_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_account_entry_dto.freezed.dart new file mode 100644 index 00000000..f57748b1 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_account_entry_dto.freezed.dart @@ -0,0 +1,400 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_customer_account_entry_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateCustomerAccountEntryDto { + /// kind + @JsonKey(name: CreateCustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind get kind; + + /// amount + @JsonKey(name: CreateCustomerAccountEntryDto.amountKey_) + double get amount; + + /// notes + @JsonKey(name: CreateCustomerAccountEntryDto.notesKey_) + String? get notes; + + /// Create a copy of CreateCustomerAccountEntryDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateCustomerAccountEntryDtoCopyWith + get copyWith => _$CreateCustomerAccountEntryDtoCopyWithImpl< + CreateCustomerAccountEntryDto>( + this as CreateCustomerAccountEntryDto, _$identity); + + /// Serializes this CreateCustomerAccountEntryDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateCustomerAccountEntryDto && + (identical(other.kind, kind) || other.kind == kind) && + (identical(other.amount, amount) || other.amount == amount) && + (identical(other.notes, notes) || other.notes == notes)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, kind, amount, notes); + + @override + String toString() { + return 'CreateCustomerAccountEntryDto(kind: $kind, amount: $amount, notes: $notes)'; + } +} + +/// @nodoc +abstract mixin class $CreateCustomerAccountEntryDtoCopyWith<$Res> { + factory $CreateCustomerAccountEntryDtoCopyWith( + CreateCustomerAccountEntryDto value, + $Res Function(CreateCustomerAccountEntryDto) _then) = + _$CreateCustomerAccountEntryDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreateCustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind kind, + @JsonKey(name: CreateCustomerAccountEntryDto.amountKey_) double amount, + @JsonKey(name: CreateCustomerAccountEntryDto.notesKey_) String? notes}); +} + +/// @nodoc +class _$CreateCustomerAccountEntryDtoCopyWithImpl<$Res> + implements $CreateCustomerAccountEntryDtoCopyWith<$Res> { + _$CreateCustomerAccountEntryDtoCopyWithImpl(this._self, this._then); + + final CreateCustomerAccountEntryDto _self; + final $Res Function(CreateCustomerAccountEntryDto) _then; + + /// Create a copy of CreateCustomerAccountEntryDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? kind = null, + Object? amount = null, + Object? notes = freezed, + }) { + return _then(_self.copyWith( + kind: null == kind + ? _self.kind + : kind // ignore: cast_nullable_to_non_nullable + as CustomerAccountEntryKind, + amount: null == amount + ? _self.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// Adds pattern-matching-related methods to [CreateCustomerAccountEntryDto]. +extension CreateCustomerAccountEntryDtoPatterns + on CreateCustomerAccountEntryDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreateCustomerAccountEntryDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateCustomerAccountEntryDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreateCustomerAccountEntryDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CreateCustomerAccountEntryDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreateCustomerAccountEntryDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreateCustomerAccountEntryDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreateCustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind kind, + @JsonKey(name: CreateCustomerAccountEntryDto.amountKey_) + double amount, + @JsonKey(name: CreateCustomerAccountEntryDto.notesKey_) + String? notes)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateCustomerAccountEntryDto() when $default != null: + return $default(_that.kind, _that.amount, _that.notes); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreateCustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind kind, + @JsonKey(name: CreateCustomerAccountEntryDto.amountKey_) + double amount, + @JsonKey(name: CreateCustomerAccountEntryDto.notesKey_) + String? notes) + $default, + ) { + final _that = this; + switch (_that) { + case _CreateCustomerAccountEntryDto(): + return $default(_that.kind, _that.amount, _that.notes); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreateCustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind kind, + @JsonKey(name: CreateCustomerAccountEntryDto.amountKey_) + double amount, + @JsonKey(name: CreateCustomerAccountEntryDto.notesKey_) + String? notes)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreateCustomerAccountEntryDto() when $default != null: + return $default(_that.kind, _that.amount, _that.notes); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreateCustomerAccountEntryDto extends CreateCustomerAccountEntryDto { + const _CreateCustomerAccountEntryDto( + {@JsonKey(name: CreateCustomerAccountEntryDto.kindKey_) + required this.kind, + @JsonKey(name: CreateCustomerAccountEntryDto.amountKey_) + required this.amount, + @JsonKey(name: CreateCustomerAccountEntryDto.notesKey_) this.notes}) + : super._(); + factory _CreateCustomerAccountEntryDto.fromJson(Map json) => + _$CreateCustomerAccountEntryDtoFromJson(json); + + /// kind + @override + @JsonKey(name: CreateCustomerAccountEntryDto.kindKey_) + final CustomerAccountEntryKind kind; + + /// amount + @override + @JsonKey(name: CreateCustomerAccountEntryDto.amountKey_) + final double amount; + + /// notes + @override + @JsonKey(name: CreateCustomerAccountEntryDto.notesKey_) + final String? notes; + + /// Create a copy of CreateCustomerAccountEntryDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreateCustomerAccountEntryDtoCopyWith<_CreateCustomerAccountEntryDto> + get copyWith => __$CreateCustomerAccountEntryDtoCopyWithImpl< + _CreateCustomerAccountEntryDto>(this, _$identity); + + @override + Map toJson() { + return _$CreateCustomerAccountEntryDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreateCustomerAccountEntryDto && + (identical(other.kind, kind) || other.kind == kind) && + (identical(other.amount, amount) || other.amount == amount) && + (identical(other.notes, notes) || other.notes == notes)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, kind, amount, notes); + + @override + String toString() { + return 'CreateCustomerAccountEntryDto(kind: $kind, amount: $amount, notes: $notes)'; + } +} + +/// @nodoc +abstract mixin class _$CreateCustomerAccountEntryDtoCopyWith<$Res> + implements $CreateCustomerAccountEntryDtoCopyWith<$Res> { + factory _$CreateCustomerAccountEntryDtoCopyWith( + _CreateCustomerAccountEntryDto value, + $Res Function(_CreateCustomerAccountEntryDto) _then) = + __$CreateCustomerAccountEntryDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreateCustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind kind, + @JsonKey(name: CreateCustomerAccountEntryDto.amountKey_) double amount, + @JsonKey(name: CreateCustomerAccountEntryDto.notesKey_) String? notes}); +} + +/// @nodoc +class __$CreateCustomerAccountEntryDtoCopyWithImpl<$Res> + implements _$CreateCustomerAccountEntryDtoCopyWith<$Res> { + __$CreateCustomerAccountEntryDtoCopyWithImpl(this._self, this._then); + + final _CreateCustomerAccountEntryDto _self; + final $Res Function(_CreateCustomerAccountEntryDto) _then; + + /// Create a copy of CreateCustomerAccountEntryDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? kind = null, + Object? amount = null, + Object? notes = freezed, + }) { + return _then(_CreateCustomerAccountEntryDto( + kind: null == kind + ? _self.kind + : kind // ignore: cast_nullable_to_non_nullable + as CustomerAccountEntryKind, + amount: null == amount + ? _self.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_account_entry_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_account_entry_dto.g.dart new file mode 100644 index 00000000..e16c89d1 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_account_entry_dto.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_customer_account_entry_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreateCustomerAccountEntryDto _$CreateCustomerAccountEntryDtoFromJson( + Map json) => + _CreateCustomerAccountEntryDto( + kind: CustomerAccountEntryKind.fromJson(json['kind'] as String), + amount: (json['amount'] as num).toDouble(), + notes: json['notes'] as String?, + ); + +Map _$CreateCustomerAccountEntryDtoToJson( + _CreateCustomerAccountEntryDto instance) => + { + 'kind': instance.kind.toJson(), + 'amount': instance.amount, + if (instance.notes case final value?) 'notes': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_dto.dart new file mode 100644 index 00000000..69e68bfc --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_dto.dart @@ -0,0 +1,63 @@ +/// CreateCustomerDto +/// { +/// "properties": { +/// "name": { +/// "type": "string" +/// }, +/// "cuit": { +/// "type": "string", +/// "nullable": true +/// }, +/// "address": { +/// "type": "string", +/// "nullable": true +/// }, +/// "require_full_payment_on_close": { +/// "type": "boolean" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "name", +/// "require_full_payment_on_close" +/// ], +/// "additionalProperties": false +/// } +library create_customer_dto; + +import 'exports.dart'; +part 'create_customer_dto.freezed.dart'; +part 'create_customer_dto.g.dart'; // CreateCustomerDto + +@freezed +abstract class CreateCustomerDto with _$CreateCustomerDto { + const CreateCustomerDto._(); + + @jsonSerializable + const factory CreateCustomerDto({ + /// name + @JsonKey(name: CreateCustomerDto.nameKey_) required String name, + + /// cuit + @JsonKey(name: CreateCustomerDto.cuitKey_) String? cuit, + + /// address + @JsonKey(name: CreateCustomerDto.addressKey_) String? address, + + /// requireFullPaymentOnClose + @JsonKey(name: CreateCustomerDto.requireFullPaymentOnCloseKey_) + required bool requireFullPaymentOnClose, + }) = _CreateCustomerDto; + + factory CreateCustomerDto.fromJson(Map json) => + _$CreateCustomerDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String cuitKey_ = r'cuit'; + + static const String addressKey_ = r'address'; + + static const String requireFullPaymentOnCloseKey_ = + r'require_full_payment_on_close'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_dto.freezed.dart new file mode 100644 index 00000000..e66d0bce --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_dto.freezed.dart @@ -0,0 +1,424 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_customer_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateCustomerDto { + /// name + @JsonKey(name: CreateCustomerDto.nameKey_) + String get name; + + /// cuit + @JsonKey(name: CreateCustomerDto.cuitKey_) + String? get cuit; + + /// address + @JsonKey(name: CreateCustomerDto.addressKey_) + String? get address; + + /// requireFullPaymentOnClose + @JsonKey(name: CreateCustomerDto.requireFullPaymentOnCloseKey_) + bool get requireFullPaymentOnClose; + + /// Create a copy of CreateCustomerDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateCustomerDtoCopyWith get copyWith => + _$CreateCustomerDtoCopyWithImpl( + this as CreateCustomerDto, _$identity); + + /// Serializes this CreateCustomerDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateCustomerDto && + (identical(other.name, name) || other.name == name) && + (identical(other.cuit, cuit) || other.cuit == cuit) && + (identical(other.address, address) || other.address == address) && + (identical(other.requireFullPaymentOnClose, + requireFullPaymentOnClose) || + other.requireFullPaymentOnClose == requireFullPaymentOnClose)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, cuit, address, requireFullPaymentOnClose); + + @override + String toString() { + return 'CreateCustomerDto(name: $name, cuit: $cuit, address: $address, requireFullPaymentOnClose: $requireFullPaymentOnClose)'; + } +} + +/// @nodoc +abstract mixin class $CreateCustomerDtoCopyWith<$Res> { + factory $CreateCustomerDtoCopyWith( + CreateCustomerDto value, $Res Function(CreateCustomerDto) _then) = + _$CreateCustomerDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreateCustomerDto.nameKey_) String name, + @JsonKey(name: CreateCustomerDto.cuitKey_) String? cuit, + @JsonKey(name: CreateCustomerDto.addressKey_) String? address, + @JsonKey(name: CreateCustomerDto.requireFullPaymentOnCloseKey_) + bool requireFullPaymentOnClose}); +} + +/// @nodoc +class _$CreateCustomerDtoCopyWithImpl<$Res> + implements $CreateCustomerDtoCopyWith<$Res> { + _$CreateCustomerDtoCopyWithImpl(this._self, this._then); + + final CreateCustomerDto _self; + final $Res Function(CreateCustomerDto) _then; + + /// Create a copy of CreateCustomerDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? cuit = freezed, + Object? address = freezed, + Object? requireFullPaymentOnClose = null, + }) { + return _then(_self.copyWith( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + cuit: freezed == cuit + ? _self.cuit + : cuit // ignore: cast_nullable_to_non_nullable + as String?, + address: freezed == address + ? _self.address + : address // ignore: cast_nullable_to_non_nullable + as String?, + requireFullPaymentOnClose: null == requireFullPaymentOnClose + ? _self.requireFullPaymentOnClose + : requireFullPaymentOnClose // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// Adds pattern-matching-related methods to [CreateCustomerDto]. +extension CreateCustomerDtoPatterns on CreateCustomerDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreateCustomerDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateCustomerDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreateCustomerDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CreateCustomerDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreateCustomerDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreateCustomerDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreateCustomerDto.nameKey_) String name, + @JsonKey(name: CreateCustomerDto.cuitKey_) String? cuit, + @JsonKey(name: CreateCustomerDto.addressKey_) String? address, + @JsonKey(name: CreateCustomerDto.requireFullPaymentOnCloseKey_) + bool requireFullPaymentOnClose)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateCustomerDto() when $default != null: + return $default(_that.name, _that.cuit, _that.address, + _that.requireFullPaymentOnClose); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreateCustomerDto.nameKey_) String name, + @JsonKey(name: CreateCustomerDto.cuitKey_) String? cuit, + @JsonKey(name: CreateCustomerDto.addressKey_) String? address, + @JsonKey(name: CreateCustomerDto.requireFullPaymentOnCloseKey_) + bool requireFullPaymentOnClose) + $default, + ) { + final _that = this; + switch (_that) { + case _CreateCustomerDto(): + return $default(_that.name, _that.cuit, _that.address, + _that.requireFullPaymentOnClose); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreateCustomerDto.nameKey_) String name, + @JsonKey(name: CreateCustomerDto.cuitKey_) String? cuit, + @JsonKey(name: CreateCustomerDto.addressKey_) String? address, + @JsonKey(name: CreateCustomerDto.requireFullPaymentOnCloseKey_) + bool requireFullPaymentOnClose)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreateCustomerDto() when $default != null: + return $default(_that.name, _that.cuit, _that.address, + _that.requireFullPaymentOnClose); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreateCustomerDto extends CreateCustomerDto { + const _CreateCustomerDto( + {@JsonKey(name: CreateCustomerDto.nameKey_) required this.name, + @JsonKey(name: CreateCustomerDto.cuitKey_) this.cuit, + @JsonKey(name: CreateCustomerDto.addressKey_) this.address, + @JsonKey(name: CreateCustomerDto.requireFullPaymentOnCloseKey_) + required this.requireFullPaymentOnClose}) + : super._(); + factory _CreateCustomerDto.fromJson(Map json) => + _$CreateCustomerDtoFromJson(json); + + /// name + @override + @JsonKey(name: CreateCustomerDto.nameKey_) + final String name; + + /// cuit + @override + @JsonKey(name: CreateCustomerDto.cuitKey_) + final String? cuit; + + /// address + @override + @JsonKey(name: CreateCustomerDto.addressKey_) + final String? address; + + /// requireFullPaymentOnClose + @override + @JsonKey(name: CreateCustomerDto.requireFullPaymentOnCloseKey_) + final bool requireFullPaymentOnClose; + + /// Create a copy of CreateCustomerDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreateCustomerDtoCopyWith<_CreateCustomerDto> get copyWith => + __$CreateCustomerDtoCopyWithImpl<_CreateCustomerDto>(this, _$identity); + + @override + Map toJson() { + return _$CreateCustomerDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreateCustomerDto && + (identical(other.name, name) || other.name == name) && + (identical(other.cuit, cuit) || other.cuit == cuit) && + (identical(other.address, address) || other.address == address) && + (identical(other.requireFullPaymentOnClose, + requireFullPaymentOnClose) || + other.requireFullPaymentOnClose == requireFullPaymentOnClose)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, cuit, address, requireFullPaymentOnClose); + + @override + String toString() { + return 'CreateCustomerDto(name: $name, cuit: $cuit, address: $address, requireFullPaymentOnClose: $requireFullPaymentOnClose)'; + } +} + +/// @nodoc +abstract mixin class _$CreateCustomerDtoCopyWith<$Res> + implements $CreateCustomerDtoCopyWith<$Res> { + factory _$CreateCustomerDtoCopyWith( + _CreateCustomerDto value, $Res Function(_CreateCustomerDto) _then) = + __$CreateCustomerDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreateCustomerDto.nameKey_) String name, + @JsonKey(name: CreateCustomerDto.cuitKey_) String? cuit, + @JsonKey(name: CreateCustomerDto.addressKey_) String? address, + @JsonKey(name: CreateCustomerDto.requireFullPaymentOnCloseKey_) + bool requireFullPaymentOnClose}); +} + +/// @nodoc +class __$CreateCustomerDtoCopyWithImpl<$Res> + implements _$CreateCustomerDtoCopyWith<$Res> { + __$CreateCustomerDtoCopyWithImpl(this._self, this._then); + + final _CreateCustomerDto _self; + final $Res Function(_CreateCustomerDto) _then; + + /// Create a copy of CreateCustomerDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = null, + Object? cuit = freezed, + Object? address = freezed, + Object? requireFullPaymentOnClose = null, + }) { + return _then(_CreateCustomerDto( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + cuit: freezed == cuit + ? _self.cuit + : cuit // ignore: cast_nullable_to_non_nullable + as String?, + address: freezed == address + ? _self.address + : address // ignore: cast_nullable_to_non_nullable + as String?, + requireFullPaymentOnClose: null == requireFullPaymentOnClose + ? _self.requireFullPaymentOnClose + : requireFullPaymentOnClose // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_dto.g.dart new file mode 100644 index 00000000..0ed62eb5 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_customer_dto.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_customer_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreateCustomerDto _$CreateCustomerDtoFromJson(Map json) => + _CreateCustomerDto( + name: json['name'] as String, + cuit: json['cuit'] as String?, + address: json['address'] as String?, + requireFullPaymentOnClose: json['require_full_payment_on_close'] as bool, + ); + +Map _$CreateCustomerDtoToJson(_CreateCustomerDto instance) => + { + 'name': instance.name, + if (instance.cuit case final value?) 'cuit': value, + if (instance.address case final value?) 'address': value, + 'require_full_payment_on_close': instance.requireFullPaymentOnClose, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_order_command.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_command.dart new file mode 100644 index 00000000..007f0307 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_command.dart @@ -0,0 +1,79 @@ +/// CreateOrderCommand +/// { +/// "properties": { +/// "sale_point_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "customer_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "user_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "lines": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/CreateOrderLine" +/// } +/// }, +/// "is_paid": { +/// "type": "boolean" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "customer_id", +/// "is_paid", +/// "lines", +/// "sale_point_id", +/// "user_id" +/// ], +/// "additionalProperties": false +/// } +library create_order_command; + +import 'exports.dart'; +part 'create_order_command.freezed.dart'; +part 'create_order_command.g.dart'; // CreateOrderCommand + +@freezed +abstract class CreateOrderCommand with _$CreateOrderCommand { + const CreateOrderCommand._(); + + @jsonSerializable + const factory CreateOrderCommand({ + /// salePointId + @JsonKey(name: CreateOrderCommand.salePointIdKey_) + required String salePointId, + + /// customerId + @JsonKey(name: CreateOrderCommand.customerIdKey_) + required String customerId, + + /// userId + @JsonKey(name: CreateOrderCommand.userIdKey_) required String userId, + + /// lines + @JsonKey(name: CreateOrderCommand.linesKey_) + required List lines, + + /// isPaid + @JsonKey(name: CreateOrderCommand.isPaidKey_) required bool isPaid, + }) = _CreateOrderCommand; + + factory CreateOrderCommand.fromJson(Map json) => + _$CreateOrderCommandFromJson(json); + + static const String salePointIdKey_ = r'sale_point_id'; + + static const String customerIdKey_ = r'customer_id'; + + static const String userIdKey_ = r'user_id'; + + static const String linesKey_ = r'lines'; + + static const String isPaidKey_ = r'is_paid'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_order_command.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_command.freezed.dart new file mode 100644 index 00000000..d291f7aa --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_command.freezed.dart @@ -0,0 +1,462 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_order_command.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateOrderCommand { + /// salePointId + @JsonKey(name: CreateOrderCommand.salePointIdKey_) + String get salePointId; + + /// customerId + @JsonKey(name: CreateOrderCommand.customerIdKey_) + String get customerId; + + /// userId + @JsonKey(name: CreateOrderCommand.userIdKey_) + String get userId; + + /// lines + @JsonKey(name: CreateOrderCommand.linesKey_) + List get lines; + + /// isPaid + @JsonKey(name: CreateOrderCommand.isPaidKey_) + bool get isPaid; + + /// Create a copy of CreateOrderCommand + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateOrderCommandCopyWith get copyWith => + _$CreateOrderCommandCopyWithImpl( + this as CreateOrderCommand, _$identity); + + /// Serializes this CreateOrderCommand to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateOrderCommand && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId) && + (identical(other.customerId, customerId) || + other.customerId == customerId) && + (identical(other.userId, userId) || other.userId == userId) && + const DeepCollectionEquality().equals(other.lines, lines) && + (identical(other.isPaid, isPaid) || other.isPaid == isPaid)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, salePointId, customerId, userId, + const DeepCollectionEquality().hash(lines), isPaid); + + @override + String toString() { + return 'CreateOrderCommand(salePointId: $salePointId, customerId: $customerId, userId: $userId, lines: $lines, isPaid: $isPaid)'; + } +} + +/// @nodoc +abstract mixin class $CreateOrderCommandCopyWith<$Res> { + factory $CreateOrderCommandCopyWith( + CreateOrderCommand value, $Res Function(CreateOrderCommand) _then) = + _$CreateOrderCommandCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreateOrderCommand.salePointIdKey_) String salePointId, + @JsonKey(name: CreateOrderCommand.customerIdKey_) String customerId, + @JsonKey(name: CreateOrderCommand.userIdKey_) String userId, + @JsonKey(name: CreateOrderCommand.linesKey_) List lines, + @JsonKey(name: CreateOrderCommand.isPaidKey_) bool isPaid}); +} + +/// @nodoc +class _$CreateOrderCommandCopyWithImpl<$Res> + implements $CreateOrderCommandCopyWith<$Res> { + _$CreateOrderCommandCopyWithImpl(this._self, this._then); + + final CreateOrderCommand _self; + final $Res Function(CreateOrderCommand) _then; + + /// Create a copy of CreateOrderCommand + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? salePointId = null, + Object? customerId = null, + Object? userId = null, + Object? lines = null, + Object? isPaid = null, + }) { + return _then(_self.copyWith( + salePointId: null == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String, + customerId: null == customerId + ? _self.customerId + : customerId // ignore: cast_nullable_to_non_nullable + as String, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + lines: null == lines + ? _self.lines + : lines // ignore: cast_nullable_to_non_nullable + as List, + isPaid: null == isPaid + ? _self.isPaid + : isPaid // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// Adds pattern-matching-related methods to [CreateOrderCommand]. +extension CreateOrderCommandPatterns on CreateOrderCommand { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreateOrderCommand value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateOrderCommand() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreateOrderCommand value) $default, + ) { + final _that = this; + switch (_that) { + case _CreateOrderCommand(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreateOrderCommand value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreateOrderCommand() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreateOrderCommand.salePointIdKey_) + String salePointId, + @JsonKey(name: CreateOrderCommand.customerIdKey_) String customerId, + @JsonKey(name: CreateOrderCommand.userIdKey_) String userId, + @JsonKey(name: CreateOrderCommand.linesKey_) + List lines, + @JsonKey(name: CreateOrderCommand.isPaidKey_) bool isPaid)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateOrderCommand() when $default != null: + return $default(_that.salePointId, _that.customerId, _that.userId, + _that.lines, _that.isPaid); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreateOrderCommand.salePointIdKey_) + String salePointId, + @JsonKey(name: CreateOrderCommand.customerIdKey_) String customerId, + @JsonKey(name: CreateOrderCommand.userIdKey_) String userId, + @JsonKey(name: CreateOrderCommand.linesKey_) + List lines, + @JsonKey(name: CreateOrderCommand.isPaidKey_) bool isPaid) + $default, + ) { + final _that = this; + switch (_that) { + case _CreateOrderCommand(): + return $default(_that.salePointId, _that.customerId, _that.userId, + _that.lines, _that.isPaid); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreateOrderCommand.salePointIdKey_) + String salePointId, + @JsonKey(name: CreateOrderCommand.customerIdKey_) String customerId, + @JsonKey(name: CreateOrderCommand.userIdKey_) String userId, + @JsonKey(name: CreateOrderCommand.linesKey_) + List lines, + @JsonKey(name: CreateOrderCommand.isPaidKey_) bool isPaid)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreateOrderCommand() when $default != null: + return $default(_that.salePointId, _that.customerId, _that.userId, + _that.lines, _that.isPaid); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreateOrderCommand extends CreateOrderCommand { + const _CreateOrderCommand( + {@JsonKey(name: CreateOrderCommand.salePointIdKey_) + required this.salePointId, + @JsonKey(name: CreateOrderCommand.customerIdKey_) + required this.customerId, + @JsonKey(name: CreateOrderCommand.userIdKey_) required this.userId, + @JsonKey(name: CreateOrderCommand.linesKey_) + required final List lines, + @JsonKey(name: CreateOrderCommand.isPaidKey_) required this.isPaid}) + : _lines = lines, + super._(); + factory _CreateOrderCommand.fromJson(Map json) => + _$CreateOrderCommandFromJson(json); + + /// salePointId + @override + @JsonKey(name: CreateOrderCommand.salePointIdKey_) + final String salePointId; + + /// customerId + @override + @JsonKey(name: CreateOrderCommand.customerIdKey_) + final String customerId; + + /// userId + @override + @JsonKey(name: CreateOrderCommand.userIdKey_) + final String userId; + + /// lines + final List _lines; + + /// lines + @override + @JsonKey(name: CreateOrderCommand.linesKey_) + List get lines { + if (_lines is EqualUnmodifiableListView) return _lines; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_lines); + } + + /// isPaid + @override + @JsonKey(name: CreateOrderCommand.isPaidKey_) + final bool isPaid; + + /// Create a copy of CreateOrderCommand + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreateOrderCommandCopyWith<_CreateOrderCommand> get copyWith => + __$CreateOrderCommandCopyWithImpl<_CreateOrderCommand>(this, _$identity); + + @override + Map toJson() { + return _$CreateOrderCommandToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreateOrderCommand && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId) && + (identical(other.customerId, customerId) || + other.customerId == customerId) && + (identical(other.userId, userId) || other.userId == userId) && + const DeepCollectionEquality().equals(other._lines, _lines) && + (identical(other.isPaid, isPaid) || other.isPaid == isPaid)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, salePointId, customerId, userId, + const DeepCollectionEquality().hash(_lines), isPaid); + + @override + String toString() { + return 'CreateOrderCommand(salePointId: $salePointId, customerId: $customerId, userId: $userId, lines: $lines, isPaid: $isPaid)'; + } +} + +/// @nodoc +abstract mixin class _$CreateOrderCommandCopyWith<$Res> + implements $CreateOrderCommandCopyWith<$Res> { + factory _$CreateOrderCommandCopyWith( + _CreateOrderCommand value, $Res Function(_CreateOrderCommand) _then) = + __$CreateOrderCommandCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreateOrderCommand.salePointIdKey_) String salePointId, + @JsonKey(name: CreateOrderCommand.customerIdKey_) String customerId, + @JsonKey(name: CreateOrderCommand.userIdKey_) String userId, + @JsonKey(name: CreateOrderCommand.linesKey_) List lines, + @JsonKey(name: CreateOrderCommand.isPaidKey_) bool isPaid}); +} + +/// @nodoc +class __$CreateOrderCommandCopyWithImpl<$Res> + implements _$CreateOrderCommandCopyWith<$Res> { + __$CreateOrderCommandCopyWithImpl(this._self, this._then); + + final _CreateOrderCommand _self; + final $Res Function(_CreateOrderCommand) _then; + + /// Create a copy of CreateOrderCommand + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? salePointId = null, + Object? customerId = null, + Object? userId = null, + Object? lines = null, + Object? isPaid = null, + }) { + return _then(_CreateOrderCommand( + salePointId: null == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String, + customerId: null == customerId + ? _self.customerId + : customerId // ignore: cast_nullable_to_non_nullable + as String, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + lines: null == lines + ? _self._lines + : lines // ignore: cast_nullable_to_non_nullable + as List, + isPaid: null == isPaid + ? _self.isPaid + : isPaid // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_order_command.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_command.g.dart new file mode 100644 index 00000000..ebd3c667 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_command.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_order_command.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreateOrderCommand _$CreateOrderCommandFromJson(Map json) => + _CreateOrderCommand( + salePointId: json['sale_point_id'] as String, + customerId: json['customer_id'] as String, + userId: json['user_id'] as String, + lines: (json['lines'] as List) + .map((e) => CreateOrderLine.fromJson(e as Map)) + .toList(), + isPaid: json['is_paid'] as bool, + ); + +Map _$CreateOrderCommandToJson(_CreateOrderCommand instance) => + { + 'sale_point_id': instance.salePointId, + 'customer_id': instance.customerId, + 'user_id': instance.userId, + 'lines': instance.lines.map((e) => e.toJson()).toList(), + 'is_paid': instance.isPaid, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_order_line.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_line.dart new file mode 100644 index 00000000..36cc1559 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_line.dart @@ -0,0 +1,86 @@ +/// CreateOrderLine +/// { +/// "properties": { +/// "product_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "presentation_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "variant_id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "quantity": { +/// "type": "integer", +/// "format": "int32" +/// }, +/// "sale_price": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "type": { +/// "type": "string", +/// "default": "create" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "presentation_id", +/// "product_id", +/// "quantity", +/// "type" +/// ], +/// "additionalProperties": false +/// } +library create_order_line; + +import 'exports.dart'; +part 'create_order_line.freezed.dart'; +part 'create_order_line.g.dart'; // CreateOrderLine + +@freezed +abstract class CreateOrderLine with _$CreateOrderLine { + const CreateOrderLine._(); + + @jsonSerializable + const factory CreateOrderLine({ + /// productId + @JsonKey(name: CreateOrderLine.productIdKey_) required String productId, + + /// presentationId + @JsonKey(name: CreateOrderLine.presentationIdKey_) + required String presentationId, + + /// variantId + @JsonKey(name: CreateOrderLine.variantIdKey_) String? variantId, + + /// quantity + @JsonKey(name: CreateOrderLine.quantityKey_) required int quantity, + + /// salePrice + @JsonKey(name: CreateOrderLine.salePriceKey_) double? salePrice, + + /// type + @Default('create') @JsonKey(name: CreateOrderLine.typeKey_) String type, + }) = _CreateOrderLine; + + factory CreateOrderLine.fromJson(Map json) => + _$CreateOrderLineFromJson(json); + + static const String productIdKey_ = r'product_id'; + + static const String presentationIdKey_ = r'presentation_id'; + + static const String variantIdKey_ = r'variant_id'; + + static const String quantityKey_ = r'quantity'; + + static const String salePriceKey_ = r'sale_price'; + + static const String typeKey_ = r'type'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_order_line.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_line.freezed.dart new file mode 100644 index 00000000..881554ee --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_line.freezed.dart @@ -0,0 +1,482 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_order_line.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateOrderLine { + /// productId + @JsonKey(name: CreateOrderLine.productIdKey_) + String get productId; + + /// presentationId + @JsonKey(name: CreateOrderLine.presentationIdKey_) + String get presentationId; + + /// variantId + @JsonKey(name: CreateOrderLine.variantIdKey_) + String? get variantId; + + /// quantity + @JsonKey(name: CreateOrderLine.quantityKey_) + int get quantity; + + /// salePrice + @JsonKey(name: CreateOrderLine.salePriceKey_) + double? get salePrice; + + /// type + @JsonKey(name: CreateOrderLine.typeKey_) + String get type; + + /// Create a copy of CreateOrderLine + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateOrderLineCopyWith get copyWith => + _$CreateOrderLineCopyWithImpl( + this as CreateOrderLine, _$identity); + + /// Serializes this CreateOrderLine to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateOrderLine && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.presentationId, presentationId) || + other.presentationId == presentationId) && + (identical(other.variantId, variantId) || + other.variantId == variantId) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, productId, presentationId, + variantId, quantity, salePrice, type); + + @override + String toString() { + return 'CreateOrderLine(productId: $productId, presentationId: $presentationId, variantId: $variantId, quantity: $quantity, salePrice: $salePrice, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $CreateOrderLineCopyWith<$Res> { + factory $CreateOrderLineCopyWith( + CreateOrderLine value, $Res Function(CreateOrderLine) _then) = + _$CreateOrderLineCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreateOrderLine.productIdKey_) String productId, + @JsonKey(name: CreateOrderLine.presentationIdKey_) String presentationId, + @JsonKey(name: CreateOrderLine.variantIdKey_) String? variantId, + @JsonKey(name: CreateOrderLine.quantityKey_) int quantity, + @JsonKey(name: CreateOrderLine.salePriceKey_) double? salePrice, + @JsonKey(name: CreateOrderLine.typeKey_) String type}); +} + +/// @nodoc +class _$CreateOrderLineCopyWithImpl<$Res> + implements $CreateOrderLineCopyWith<$Res> { + _$CreateOrderLineCopyWithImpl(this._self, this._then); + + final CreateOrderLine _self; + final $Res Function(CreateOrderLine) _then; + + /// Create a copy of CreateOrderLine + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? productId = null, + Object? presentationId = null, + Object? variantId = freezed, + Object? quantity = null, + Object? salePrice = freezed, + Object? type = null, + }) { + return _then(_self.copyWith( + productId: null == productId + ? _self.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + presentationId: null == presentationId + ? _self.presentationId + : presentationId // ignore: cast_nullable_to_non_nullable + as String, + variantId: freezed == variantId + ? _self.variantId + : variantId // ignore: cast_nullable_to_non_nullable + as String?, + quantity: null == quantity + ? _self.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [CreateOrderLine]. +extension CreateOrderLinePatterns on CreateOrderLine { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreateOrderLine value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateOrderLine() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreateOrderLine value) $default, + ) { + final _that = this; + switch (_that) { + case _CreateOrderLine(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreateOrderLine value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreateOrderLine() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreateOrderLine.productIdKey_) String productId, + @JsonKey(name: CreateOrderLine.presentationIdKey_) + String presentationId, + @JsonKey(name: CreateOrderLine.variantIdKey_) String? variantId, + @JsonKey(name: CreateOrderLine.quantityKey_) int quantity, + @JsonKey(name: CreateOrderLine.salePriceKey_) double? salePrice, + @JsonKey(name: CreateOrderLine.typeKey_) String type)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateOrderLine() when $default != null: + return $default(_that.productId, _that.presentationId, _that.variantId, + _that.quantity, _that.salePrice, _that.type); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreateOrderLine.productIdKey_) String productId, + @JsonKey(name: CreateOrderLine.presentationIdKey_) + String presentationId, + @JsonKey(name: CreateOrderLine.variantIdKey_) String? variantId, + @JsonKey(name: CreateOrderLine.quantityKey_) int quantity, + @JsonKey(name: CreateOrderLine.salePriceKey_) double? salePrice, + @JsonKey(name: CreateOrderLine.typeKey_) String type) + $default, + ) { + final _that = this; + switch (_that) { + case _CreateOrderLine(): + return $default(_that.productId, _that.presentationId, _that.variantId, + _that.quantity, _that.salePrice, _that.type); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreateOrderLine.productIdKey_) String productId, + @JsonKey(name: CreateOrderLine.presentationIdKey_) + String presentationId, + @JsonKey(name: CreateOrderLine.variantIdKey_) String? variantId, + @JsonKey(name: CreateOrderLine.quantityKey_) int quantity, + @JsonKey(name: CreateOrderLine.salePriceKey_) double? salePrice, + @JsonKey(name: CreateOrderLine.typeKey_) String type)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreateOrderLine() when $default != null: + return $default(_that.productId, _that.presentationId, _that.variantId, + _that.quantity, _that.salePrice, _that.type); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreateOrderLine extends CreateOrderLine { + const _CreateOrderLine( + {@JsonKey(name: CreateOrderLine.productIdKey_) required this.productId, + @JsonKey(name: CreateOrderLine.presentationIdKey_) + required this.presentationId, + @JsonKey(name: CreateOrderLine.variantIdKey_) this.variantId, + @JsonKey(name: CreateOrderLine.quantityKey_) required this.quantity, + @JsonKey(name: CreateOrderLine.salePriceKey_) this.salePrice, + @JsonKey(name: CreateOrderLine.typeKey_) this.type = 'create'}) + : super._(); + factory _CreateOrderLine.fromJson(Map json) => + _$CreateOrderLineFromJson(json); + + /// productId + @override + @JsonKey(name: CreateOrderLine.productIdKey_) + final String productId; + + /// presentationId + @override + @JsonKey(name: CreateOrderLine.presentationIdKey_) + final String presentationId; + + /// variantId + @override + @JsonKey(name: CreateOrderLine.variantIdKey_) + final String? variantId; + + /// quantity + @override + @JsonKey(name: CreateOrderLine.quantityKey_) + final int quantity; + + /// salePrice + @override + @JsonKey(name: CreateOrderLine.salePriceKey_) + final double? salePrice; + + /// type + @override + @JsonKey(name: CreateOrderLine.typeKey_) + final String type; + + /// Create a copy of CreateOrderLine + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreateOrderLineCopyWith<_CreateOrderLine> get copyWith => + __$CreateOrderLineCopyWithImpl<_CreateOrderLine>(this, _$identity); + + @override + Map toJson() { + return _$CreateOrderLineToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreateOrderLine && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.presentationId, presentationId) || + other.presentationId == presentationId) && + (identical(other.variantId, variantId) || + other.variantId == variantId) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, productId, presentationId, + variantId, quantity, salePrice, type); + + @override + String toString() { + return 'CreateOrderLine(productId: $productId, presentationId: $presentationId, variantId: $variantId, quantity: $quantity, salePrice: $salePrice, type: $type)'; + } +} + +/// @nodoc +abstract mixin class _$CreateOrderLineCopyWith<$Res> + implements $CreateOrderLineCopyWith<$Res> { + factory _$CreateOrderLineCopyWith( + _CreateOrderLine value, $Res Function(_CreateOrderLine) _then) = + __$CreateOrderLineCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreateOrderLine.productIdKey_) String productId, + @JsonKey(name: CreateOrderLine.presentationIdKey_) String presentationId, + @JsonKey(name: CreateOrderLine.variantIdKey_) String? variantId, + @JsonKey(name: CreateOrderLine.quantityKey_) int quantity, + @JsonKey(name: CreateOrderLine.salePriceKey_) double? salePrice, + @JsonKey(name: CreateOrderLine.typeKey_) String type}); +} + +/// @nodoc +class __$CreateOrderLineCopyWithImpl<$Res> + implements _$CreateOrderLineCopyWith<$Res> { + __$CreateOrderLineCopyWithImpl(this._self, this._then); + + final _CreateOrderLine _self; + final $Res Function(_CreateOrderLine) _then; + + /// Create a copy of CreateOrderLine + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? productId = null, + Object? presentationId = null, + Object? variantId = freezed, + Object? quantity = null, + Object? salePrice = freezed, + Object? type = null, + }) { + return _then(_CreateOrderLine( + productId: null == productId + ? _self.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + presentationId: null == presentationId + ? _self.presentationId + : presentationId // ignore: cast_nullable_to_non_nullable + as String, + variantId: freezed == variantId + ? _self.variantId + : variantId // ignore: cast_nullable_to_non_nullable + as String?, + quantity: null == quantity + ? _self.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_order_line.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_line.g.dart new file mode 100644 index 00000000..c8a4c0a9 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_order_line.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_order_line.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreateOrderLine _$CreateOrderLineFromJson(Map json) => + _CreateOrderLine( + productId: json['product_id'] as String, + presentationId: json['presentation_id'] as String, + variantId: json['variant_id'] as String?, + quantity: (json['quantity'] as num).toInt(), + salePrice: (json['sale_price'] as num?)?.toDouble(), + type: json['type'] as String? ?? 'create', + ); + +Map _$CreateOrderLineToJson(_CreateOrderLine instance) => + { + 'product_id': instance.productId, + 'presentation_id': instance.presentationId, + if (instance.variantId case final value?) 'variant_id': value, + 'quantity': instance.quantity, + if (instance.salePrice case final value?) 'sale_price': value, + 'type': instance.type, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_dto.dart new file mode 100644 index 00000000..b4e17639 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_dto.dart @@ -0,0 +1,81 @@ +/// CreatePriceListDto +/// { +/// "properties": { +/// "name": { +/// "type": "string" +/// }, +/// "valid_from": { +/// "type": "string", +/// "format": "date-time", +/// "nullable": true +/// }, +/// "valid_to": { +/// "type": "string", +/// "format": "date-time", +/// "nullable": true +/// }, +/// "sale_point_ids": { +/// "type": "array", +/// "items": { +/// "type": "string", +/// "format": "uuid" +/// } +/// }, +/// "policies": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/CreatePriceListPolicyDto" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "name", +/// "policies", +/// "sale_point_ids" +/// ], +/// "additionalProperties": false +/// } +library create_price_list_dto; + +import 'exports.dart'; +part 'create_price_list_dto.freezed.dart'; +part 'create_price_list_dto.g.dart'; // CreatePriceListDto + +@freezed +abstract class CreatePriceListDto with _$CreatePriceListDto { + const CreatePriceListDto._(); + + @jsonSerializable + const factory CreatePriceListDto({ + /// name + @JsonKey(name: CreatePriceListDto.nameKey_) required String name, + + /// validFrom + @JsonKey(name: CreatePriceListDto.validFromKey_) DateTime? validFrom, + + /// validTo + @JsonKey(name: CreatePriceListDto.validToKey_) DateTime? validTo, + + /// salePointIds + @JsonKey(name: CreatePriceListDto.salePointIdsKey_) + required List salePointIds, + + /// policies + @JsonKey(name: CreatePriceListDto.policiesKey_) + required List policies, + }) = _CreatePriceListDto; + + factory CreatePriceListDto.fromJson(Map json) => + _$CreatePriceListDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String validFromKey_ = r'valid_from'; + + static const String validToKey_ = r'valid_to'; + + static const String salePointIdsKey_ = r'sale_point_ids'; + + static const String policiesKey_ = r'policies'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_dto.freezed.dart new file mode 100644 index 00000000..c68bec13 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_dto.freezed.dart @@ -0,0 +1,486 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_price_list_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreatePriceListDto { + /// name + @JsonKey(name: CreatePriceListDto.nameKey_) + String get name; + + /// validFrom + @JsonKey(name: CreatePriceListDto.validFromKey_) + DateTime? get validFrom; + + /// validTo + @JsonKey(name: CreatePriceListDto.validToKey_) + DateTime? get validTo; + + /// salePointIds + @JsonKey(name: CreatePriceListDto.salePointIdsKey_) + List get salePointIds; + + /// policies + @JsonKey(name: CreatePriceListDto.policiesKey_) + List get policies; + + /// Create a copy of CreatePriceListDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreatePriceListDtoCopyWith get copyWith => + _$CreatePriceListDtoCopyWithImpl( + this as CreatePriceListDto, _$identity); + + /// Serializes this CreatePriceListDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreatePriceListDto && + (identical(other.name, name) || other.name == name) && + (identical(other.validFrom, validFrom) || + other.validFrom == validFrom) && + (identical(other.validTo, validTo) || other.validTo == validTo) && + const DeepCollectionEquality() + .equals(other.salePointIds, salePointIds) && + const DeepCollectionEquality().equals(other.policies, policies)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + name, + validFrom, + validTo, + const DeepCollectionEquality().hash(salePointIds), + const DeepCollectionEquality().hash(policies)); + + @override + String toString() { + return 'CreatePriceListDto(name: $name, validFrom: $validFrom, validTo: $validTo, salePointIds: $salePointIds, policies: $policies)'; + } +} + +/// @nodoc +abstract mixin class $CreatePriceListDtoCopyWith<$Res> { + factory $CreatePriceListDtoCopyWith( + CreatePriceListDto value, $Res Function(CreatePriceListDto) _then) = + _$CreatePriceListDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreatePriceListDto.nameKey_) String name, + @JsonKey(name: CreatePriceListDto.validFromKey_) DateTime? validFrom, + @JsonKey(name: CreatePriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: CreatePriceListDto.salePointIdsKey_) + List salePointIds, + @JsonKey(name: CreatePriceListDto.policiesKey_) + List policies}); +} + +/// @nodoc +class _$CreatePriceListDtoCopyWithImpl<$Res> + implements $CreatePriceListDtoCopyWith<$Res> { + _$CreatePriceListDtoCopyWithImpl(this._self, this._then); + + final CreatePriceListDto _self; + final $Res Function(CreatePriceListDto) _then; + + /// Create a copy of CreatePriceListDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? validFrom = freezed, + Object? validTo = freezed, + Object? salePointIds = null, + Object? policies = null, + }) { + return _then(_self.copyWith( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + validFrom: freezed == validFrom + ? _self.validFrom + : validFrom // ignore: cast_nullable_to_non_nullable + as DateTime?, + validTo: freezed == validTo + ? _self.validTo + : validTo // ignore: cast_nullable_to_non_nullable + as DateTime?, + salePointIds: null == salePointIds + ? _self.salePointIds + : salePointIds // ignore: cast_nullable_to_non_nullable + as List, + policies: null == policies + ? _self.policies + : policies // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [CreatePriceListDto]. +extension CreatePriceListDtoPatterns on CreatePriceListDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreatePriceListDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreatePriceListDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreatePriceListDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreatePriceListDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreatePriceListDto.nameKey_) String name, + @JsonKey(name: CreatePriceListDto.validFromKey_) + DateTime? validFrom, + @JsonKey(name: CreatePriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: CreatePriceListDto.salePointIdsKey_) + List salePointIds, + @JsonKey(name: CreatePriceListDto.policiesKey_) + List policies)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreatePriceListDto() when $default != null: + return $default(_that.name, _that.validFrom, _that.validTo, + _that.salePointIds, _that.policies); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreatePriceListDto.nameKey_) String name, + @JsonKey(name: CreatePriceListDto.validFromKey_) + DateTime? validFrom, + @JsonKey(name: CreatePriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: CreatePriceListDto.salePointIdsKey_) + List salePointIds, + @JsonKey(name: CreatePriceListDto.policiesKey_) + List policies) + $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListDto(): + return $default(_that.name, _that.validFrom, _that.validTo, + _that.salePointIds, _that.policies); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreatePriceListDto.nameKey_) String name, + @JsonKey(name: CreatePriceListDto.validFromKey_) + DateTime? validFrom, + @JsonKey(name: CreatePriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: CreatePriceListDto.salePointIdsKey_) + List salePointIds, + @JsonKey(name: CreatePriceListDto.policiesKey_) + List policies)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListDto() when $default != null: + return $default(_that.name, _that.validFrom, _that.validTo, + _that.salePointIds, _that.policies); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreatePriceListDto extends CreatePriceListDto { + const _CreatePriceListDto( + {@JsonKey(name: CreatePriceListDto.nameKey_) required this.name, + @JsonKey(name: CreatePriceListDto.validFromKey_) this.validFrom, + @JsonKey(name: CreatePriceListDto.validToKey_) this.validTo, + @JsonKey(name: CreatePriceListDto.salePointIdsKey_) + required final List salePointIds, + @JsonKey(name: CreatePriceListDto.policiesKey_) + required final List policies}) + : _salePointIds = salePointIds, + _policies = policies, + super._(); + factory _CreatePriceListDto.fromJson(Map json) => + _$CreatePriceListDtoFromJson(json); + + /// name + @override + @JsonKey(name: CreatePriceListDto.nameKey_) + final String name; + + /// validFrom + @override + @JsonKey(name: CreatePriceListDto.validFromKey_) + final DateTime? validFrom; + + /// validTo + @override + @JsonKey(name: CreatePriceListDto.validToKey_) + final DateTime? validTo; + + /// salePointIds + final List _salePointIds; + + /// salePointIds + @override + @JsonKey(name: CreatePriceListDto.salePointIdsKey_) + List get salePointIds { + if (_salePointIds is EqualUnmodifiableListView) return _salePointIds; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_salePointIds); + } + + /// policies + final List _policies; + + /// policies + @override + @JsonKey(name: CreatePriceListDto.policiesKey_) + List get policies { + if (_policies is EqualUnmodifiableListView) return _policies; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_policies); + } + + /// Create a copy of CreatePriceListDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreatePriceListDtoCopyWith<_CreatePriceListDto> get copyWith => + __$CreatePriceListDtoCopyWithImpl<_CreatePriceListDto>(this, _$identity); + + @override + Map toJson() { + return _$CreatePriceListDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreatePriceListDto && + (identical(other.name, name) || other.name == name) && + (identical(other.validFrom, validFrom) || + other.validFrom == validFrom) && + (identical(other.validTo, validTo) || other.validTo == validTo) && + const DeepCollectionEquality() + .equals(other._salePointIds, _salePointIds) && + const DeepCollectionEquality().equals(other._policies, _policies)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + name, + validFrom, + validTo, + const DeepCollectionEquality().hash(_salePointIds), + const DeepCollectionEquality().hash(_policies)); + + @override + String toString() { + return 'CreatePriceListDto(name: $name, validFrom: $validFrom, validTo: $validTo, salePointIds: $salePointIds, policies: $policies)'; + } +} + +/// @nodoc +abstract mixin class _$CreatePriceListDtoCopyWith<$Res> + implements $CreatePriceListDtoCopyWith<$Res> { + factory _$CreatePriceListDtoCopyWith( + _CreatePriceListDto value, $Res Function(_CreatePriceListDto) _then) = + __$CreatePriceListDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreatePriceListDto.nameKey_) String name, + @JsonKey(name: CreatePriceListDto.validFromKey_) DateTime? validFrom, + @JsonKey(name: CreatePriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: CreatePriceListDto.salePointIdsKey_) + List salePointIds, + @JsonKey(name: CreatePriceListDto.policiesKey_) + List policies}); +} + +/// @nodoc +class __$CreatePriceListDtoCopyWithImpl<$Res> + implements _$CreatePriceListDtoCopyWith<$Res> { + __$CreatePriceListDtoCopyWithImpl(this._self, this._then); + + final _CreatePriceListDto _self; + final $Res Function(_CreatePriceListDto) _then; + + /// Create a copy of CreatePriceListDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = null, + Object? validFrom = freezed, + Object? validTo = freezed, + Object? salePointIds = null, + Object? policies = null, + }) { + return _then(_CreatePriceListDto( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + validFrom: freezed == validFrom + ? _self.validFrom + : validFrom // ignore: cast_nullable_to_non_nullable + as DateTime?, + validTo: freezed == validTo + ? _self.validTo + : validTo // ignore: cast_nullable_to_non_nullable + as DateTime?, + salePointIds: null == salePointIds + ? _self._salePointIds + : salePointIds // ignore: cast_nullable_to_non_nullable + as List, + policies: null == policies + ? _self._policies + : policies // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_dto.g.dart new file mode 100644 index 00000000..8c5ed749 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_dto.g.dart @@ -0,0 +1,36 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_price_list_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreatePriceListDto _$CreatePriceListDtoFromJson(Map json) => + _CreatePriceListDto( + name: json['name'] as String, + validFrom: json['valid_from'] == null + ? null + : DateTime.parse(json['valid_from'] as String), + validTo: json['valid_to'] == null + ? null + : DateTime.parse(json['valid_to'] as String), + salePointIds: (json['sale_point_ids'] as List) + .map((e) => e as String) + .toList(), + policies: (json['policies'] as List) + .map((e) => + CreatePriceListPolicyDto.fromJson(e as Map)) + .toList(), + ); + +Map _$CreatePriceListDtoToJson(_CreatePriceListDto instance) => + { + 'name': instance.name, + if (instance.validFrom?.toIso8601String() case final value?) + 'valid_from': value, + if (instance.validTo?.toIso8601String() case final value?) + 'valid_to': value, + 'sale_point_ids': instance.salePointIds, + 'policies': instance.policies.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_dto.dart new file mode 100644 index 00000000..bb284b63 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_dto.dart @@ -0,0 +1,68 @@ +/// CreatePriceListPolicyDto +/// { +/// "properties": { +/// "policy_type": { +/// "$ref": "#/components/schemas/PriceListPolicyPolicyType" +/// }, +/// "policy_type_value": { +/// "type": "number", +/// "format": "double" +/// }, +/// "notes": { +/// "type": "string", +/// "nullable": true +/// }, +/// "items": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/CreatePriceListPolicyItemDto" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "items", +/// "policy_type", +/// "policy_type_value" +/// ], +/// "additionalProperties": false +/// } +library create_price_list_policy_dto; + +import 'exports.dart'; +part 'create_price_list_policy_dto.freezed.dart'; +part 'create_price_list_policy_dto.g.dart'; // CreatePriceListPolicyDto + +@freezed +abstract class CreatePriceListPolicyDto with _$CreatePriceListPolicyDto { + const CreatePriceListPolicyDto._(); + + @jsonSerializable + const factory CreatePriceListPolicyDto({ + /// policyType + @JsonKey(name: CreatePriceListPolicyDto.policyTypeKey_) + required PriceListPolicyPolicyType policyType, + + /// policyTypeValue + @JsonKey(name: CreatePriceListPolicyDto.policyTypeValueKey_) + required double policyTypeValue, + + /// notes + @JsonKey(name: CreatePriceListPolicyDto.notesKey_) String? notes, + + /// items + @JsonKey(name: CreatePriceListPolicyDto.itemsKey_) + required List items, + }) = _CreatePriceListPolicyDto; + + factory CreatePriceListPolicyDto.fromJson(Map json) => + _$CreatePriceListPolicyDtoFromJson(json); + + static const String policyTypeKey_ = r'policy_type'; + + static const String policyTypeValueKey_ = r'policy_type_value'; + + static const String notesKey_ = r'notes'; + + static const String itemsKey_ = r'items'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_dto.freezed.dart new file mode 100644 index 00000000..a0522cac --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_dto.freezed.dart @@ -0,0 +1,445 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_price_list_policy_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreatePriceListPolicyDto { + /// policyType + @JsonKey(name: CreatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType get policyType; + + /// policyTypeValue + @JsonKey(name: CreatePriceListPolicyDto.policyTypeValueKey_) + double get policyTypeValue; + + /// notes + @JsonKey(name: CreatePriceListPolicyDto.notesKey_) + String? get notes; + + /// items + @JsonKey(name: CreatePriceListPolicyDto.itemsKey_) + List get items; + + /// Create a copy of CreatePriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreatePriceListPolicyDtoCopyWith get copyWith => + _$CreatePriceListPolicyDtoCopyWithImpl( + this as CreatePriceListPolicyDto, _$identity); + + /// Serializes this CreatePriceListPolicyDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreatePriceListPolicyDto && + (identical(other.policyType, policyType) || + other.policyType == policyType) && + (identical(other.policyTypeValue, policyTypeValue) || + other.policyTypeValue == policyTypeValue) && + (identical(other.notes, notes) || other.notes == notes) && + const DeepCollectionEquality().equals(other.items, items)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, policyType, policyTypeValue, + notes, const DeepCollectionEquality().hash(items)); + + @override + String toString() { + return 'CreatePriceListPolicyDto(policyType: $policyType, policyTypeValue: $policyTypeValue, notes: $notes, items: $items)'; + } +} + +/// @nodoc +abstract mixin class $CreatePriceListPolicyDtoCopyWith<$Res> { + factory $CreatePriceListPolicyDtoCopyWith(CreatePriceListPolicyDto value, + $Res Function(CreatePriceListPolicyDto) _then) = + _$CreatePriceListPolicyDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType policyType, + @JsonKey(name: CreatePriceListPolicyDto.policyTypeValueKey_) + double policyTypeValue, + @JsonKey(name: CreatePriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: CreatePriceListPolicyDto.itemsKey_) + List items}); +} + +/// @nodoc +class _$CreatePriceListPolicyDtoCopyWithImpl<$Res> + implements $CreatePriceListPolicyDtoCopyWith<$Res> { + _$CreatePriceListPolicyDtoCopyWithImpl(this._self, this._then); + + final CreatePriceListPolicyDto _self; + final $Res Function(CreatePriceListPolicyDto) _then; + + /// Create a copy of CreatePriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? policyType = null, + Object? policyTypeValue = null, + Object? notes = freezed, + Object? items = null, + }) { + return _then(_self.copyWith( + policyType: null == policyType + ? _self.policyType + : policyType // ignore: cast_nullable_to_non_nullable + as PriceListPolicyPolicyType, + policyTypeValue: null == policyTypeValue + ? _self.policyTypeValue + : policyTypeValue // ignore: cast_nullable_to_non_nullable + as double, + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + items: null == items + ? _self.items + : items // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [CreatePriceListPolicyDto]. +extension CreatePriceListPolicyDtoPatterns on CreatePriceListPolicyDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreatePriceListPolicyDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreatePriceListPolicyDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreatePriceListPolicyDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType policyType, + @JsonKey(name: CreatePriceListPolicyDto.policyTypeValueKey_) + double policyTypeValue, + @JsonKey(name: CreatePriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: CreatePriceListPolicyDto.itemsKey_) + List items)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyDto() when $default != null: + return $default( + _that.policyType, _that.policyTypeValue, _that.notes, _that.items); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType policyType, + @JsonKey(name: CreatePriceListPolicyDto.policyTypeValueKey_) + double policyTypeValue, + @JsonKey(name: CreatePriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: CreatePriceListPolicyDto.itemsKey_) + List items) + $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyDto(): + return $default( + _that.policyType, _that.policyTypeValue, _that.notes, _that.items); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType policyType, + @JsonKey(name: CreatePriceListPolicyDto.policyTypeValueKey_) + double policyTypeValue, + @JsonKey(name: CreatePriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: CreatePriceListPolicyDto.itemsKey_) + List items)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyDto() when $default != null: + return $default( + _that.policyType, _that.policyTypeValue, _that.notes, _that.items); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreatePriceListPolicyDto extends CreatePriceListPolicyDto { + const _CreatePriceListPolicyDto( + {@JsonKey(name: CreatePriceListPolicyDto.policyTypeKey_) + required this.policyType, + @JsonKey(name: CreatePriceListPolicyDto.policyTypeValueKey_) + required this.policyTypeValue, + @JsonKey(name: CreatePriceListPolicyDto.notesKey_) this.notes, + @JsonKey(name: CreatePriceListPolicyDto.itemsKey_) + required final List items}) + : _items = items, + super._(); + factory _CreatePriceListPolicyDto.fromJson(Map json) => + _$CreatePriceListPolicyDtoFromJson(json); + + /// policyType + @override + @JsonKey(name: CreatePriceListPolicyDto.policyTypeKey_) + final PriceListPolicyPolicyType policyType; + + /// policyTypeValue + @override + @JsonKey(name: CreatePriceListPolicyDto.policyTypeValueKey_) + final double policyTypeValue; + + /// notes + @override + @JsonKey(name: CreatePriceListPolicyDto.notesKey_) + final String? notes; + + /// items + final List _items; + + /// items + @override + @JsonKey(name: CreatePriceListPolicyDto.itemsKey_) + List get items { + if (_items is EqualUnmodifiableListView) return _items; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_items); + } + + /// Create a copy of CreatePriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreatePriceListPolicyDtoCopyWith<_CreatePriceListPolicyDto> get copyWith => + __$CreatePriceListPolicyDtoCopyWithImpl<_CreatePriceListPolicyDto>( + this, _$identity); + + @override + Map toJson() { + return _$CreatePriceListPolicyDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreatePriceListPolicyDto && + (identical(other.policyType, policyType) || + other.policyType == policyType) && + (identical(other.policyTypeValue, policyTypeValue) || + other.policyTypeValue == policyTypeValue) && + (identical(other.notes, notes) || other.notes == notes) && + const DeepCollectionEquality().equals(other._items, _items)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, policyType, policyTypeValue, + notes, const DeepCollectionEquality().hash(_items)); + + @override + String toString() { + return 'CreatePriceListPolicyDto(policyType: $policyType, policyTypeValue: $policyTypeValue, notes: $notes, items: $items)'; + } +} + +/// @nodoc +abstract mixin class _$CreatePriceListPolicyDtoCopyWith<$Res> + implements $CreatePriceListPolicyDtoCopyWith<$Res> { + factory _$CreatePriceListPolicyDtoCopyWith(_CreatePriceListPolicyDto value, + $Res Function(_CreatePriceListPolicyDto) _then) = + __$CreatePriceListPolicyDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType policyType, + @JsonKey(name: CreatePriceListPolicyDto.policyTypeValueKey_) + double policyTypeValue, + @JsonKey(name: CreatePriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: CreatePriceListPolicyDto.itemsKey_) + List items}); +} + +/// @nodoc +class __$CreatePriceListPolicyDtoCopyWithImpl<$Res> + implements _$CreatePriceListPolicyDtoCopyWith<$Res> { + __$CreatePriceListPolicyDtoCopyWithImpl(this._self, this._then); + + final _CreatePriceListPolicyDto _self; + final $Res Function(_CreatePriceListPolicyDto) _then; + + /// Create a copy of CreatePriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? policyType = null, + Object? policyTypeValue = null, + Object? notes = freezed, + Object? items = null, + }) { + return _then(_CreatePriceListPolicyDto( + policyType: null == policyType + ? _self.policyType + : policyType // ignore: cast_nullable_to_non_nullable + as PriceListPolicyPolicyType, + policyTypeValue: null == policyTypeValue + ? _self.policyTypeValue + : policyTypeValue // ignore: cast_nullable_to_non_nullable + as double, + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + items: null == items + ? _self._items + : items // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_dto.g.dart new file mode 100644 index 00000000..b086587b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_dto.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_price_list_policy_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreatePriceListPolicyDto _$CreatePriceListPolicyDtoFromJson( + Map json) => + _CreatePriceListPolicyDto( + policyType: + PriceListPolicyPolicyType.fromJson(json['policy_type'] as String), + policyTypeValue: (json['policy_type_value'] as num).toDouble(), + notes: json['notes'] as String?, + items: (json['items'] as List) + .map((e) => + CreatePriceListPolicyItemDto.fromJson(e as Map)) + .toList(), + ); + +Map _$CreatePriceListPolicyDtoToJson( + _CreatePriceListPolicyDto instance) => + { + 'policy_type': instance.policyType.toJson(), + 'policy_type_value': instance.policyTypeValue, + if (instance.notes case final value?) 'notes': value, + 'items': instance.items.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_item_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_item_dto.dart new file mode 100644 index 00000000..8caa3cd3 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_item_dto.dart @@ -0,0 +1,48 @@ +/// CreatePriceListPolicyItemDto +/// { +/// "properties": { +/// "product_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "product_presentation_id": { +/// "type": "string", +/// "format": "uuid" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "product_id", +/// "product_presentation_id" +/// ], +/// "additionalProperties": false +/// } +library create_price_list_policy_item_dto; + +import 'exports.dart'; +part 'create_price_list_policy_item_dto.freezed.dart'; +part 'create_price_list_policy_item_dto.g.dart'; // CreatePriceListPolicyItemDto + +@freezed +abstract class CreatePriceListPolicyItemDto + with _$CreatePriceListPolicyItemDto { + const CreatePriceListPolicyItemDto._(); + + @jsonSerializable + const factory CreatePriceListPolicyItemDto({ + /// productId + @JsonKey(name: CreatePriceListPolicyItemDto.productIdKey_) + required String productId, + + /// productPresentationId + @JsonKey(name: CreatePriceListPolicyItemDto.productPresentationIdKey_) + required String productPresentationId, + }) = _CreatePriceListPolicyItemDto; + + factory CreatePriceListPolicyItemDto.fromJson(Map json) => + _$CreatePriceListPolicyItemDtoFromJson(json); + + static const String productIdKey_ = r'product_id'; + + static const String productPresentationIdKey_ = r'product_presentation_id'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_item_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_item_dto.freezed.dart new file mode 100644 index 00000000..43ef7c01 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_item_dto.freezed.dart @@ -0,0 +1,380 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_price_list_policy_item_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreatePriceListPolicyItemDto { + /// productId + @JsonKey(name: CreatePriceListPolicyItemDto.productIdKey_) + String get productId; + + /// productPresentationId + @JsonKey(name: CreatePriceListPolicyItemDto.productPresentationIdKey_) + String get productPresentationId; + + /// Create a copy of CreatePriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreatePriceListPolicyItemDtoCopyWith + get copyWith => _$CreatePriceListPolicyItemDtoCopyWithImpl< + CreatePriceListPolicyItemDto>( + this as CreatePriceListPolicyItemDto, _$identity); + + /// Serializes this CreatePriceListPolicyItemDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreatePriceListPolicyItemDto && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.productPresentationId, productPresentationId) || + other.productPresentationId == productPresentationId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, productId, productPresentationId); + + @override + String toString() { + return 'CreatePriceListPolicyItemDto(productId: $productId, productPresentationId: $productPresentationId)'; + } +} + +/// @nodoc +abstract mixin class $CreatePriceListPolicyItemDtoCopyWith<$Res> { + factory $CreatePriceListPolicyItemDtoCopyWith( + CreatePriceListPolicyItemDto value, + $Res Function(CreatePriceListPolicyItemDto) _then) = + _$CreatePriceListPolicyItemDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreatePriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey(name: CreatePriceListPolicyItemDto.productPresentationIdKey_) + String productPresentationId}); +} + +/// @nodoc +class _$CreatePriceListPolicyItemDtoCopyWithImpl<$Res> + implements $CreatePriceListPolicyItemDtoCopyWith<$Res> { + _$CreatePriceListPolicyItemDtoCopyWithImpl(this._self, this._then); + + final CreatePriceListPolicyItemDto _self; + final $Res Function(CreatePriceListPolicyItemDto) _then; + + /// Create a copy of CreatePriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? productId = null, + Object? productPresentationId = null, + }) { + return _then(_self.copyWith( + productId: null == productId + ? _self.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + productPresentationId: null == productPresentationId + ? _self.productPresentationId + : productPresentationId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [CreatePriceListPolicyItemDto]. +extension CreatePriceListPolicyItemDtoPatterns on CreatePriceListPolicyItemDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreatePriceListPolicyItemDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyItemDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreatePriceListPolicyItemDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyItemDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreatePriceListPolicyItemDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyItemDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreatePriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey( + name: CreatePriceListPolicyItemDto.productPresentationIdKey_) + String productPresentationId)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyItemDto() when $default != null: + return $default(_that.productId, _that.productPresentationId); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreatePriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey( + name: CreatePriceListPolicyItemDto.productPresentationIdKey_) + String productPresentationId) + $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyItemDto(): + return $default(_that.productId, _that.productPresentationId); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreatePriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey( + name: CreatePriceListPolicyItemDto.productPresentationIdKey_) + String productPresentationId)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreatePriceListPolicyItemDto() when $default != null: + return $default(_that.productId, _that.productPresentationId); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreatePriceListPolicyItemDto extends CreatePriceListPolicyItemDto { + const _CreatePriceListPolicyItemDto( + {@JsonKey(name: CreatePriceListPolicyItemDto.productIdKey_) + required this.productId, + @JsonKey(name: CreatePriceListPolicyItemDto.productPresentationIdKey_) + required this.productPresentationId}) + : super._(); + factory _CreatePriceListPolicyItemDto.fromJson(Map json) => + _$CreatePriceListPolicyItemDtoFromJson(json); + + /// productId + @override + @JsonKey(name: CreatePriceListPolicyItemDto.productIdKey_) + final String productId; + + /// productPresentationId + @override + @JsonKey(name: CreatePriceListPolicyItemDto.productPresentationIdKey_) + final String productPresentationId; + + /// Create a copy of CreatePriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreatePriceListPolicyItemDtoCopyWith<_CreatePriceListPolicyItemDto> + get copyWith => __$CreatePriceListPolicyItemDtoCopyWithImpl< + _CreatePriceListPolicyItemDto>(this, _$identity); + + @override + Map toJson() { + return _$CreatePriceListPolicyItemDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreatePriceListPolicyItemDto && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.productPresentationId, productPresentationId) || + other.productPresentationId == productPresentationId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, productId, productPresentationId); + + @override + String toString() { + return 'CreatePriceListPolicyItemDto(productId: $productId, productPresentationId: $productPresentationId)'; + } +} + +/// @nodoc +abstract mixin class _$CreatePriceListPolicyItemDtoCopyWith<$Res> + implements $CreatePriceListPolicyItemDtoCopyWith<$Res> { + factory _$CreatePriceListPolicyItemDtoCopyWith( + _CreatePriceListPolicyItemDto value, + $Res Function(_CreatePriceListPolicyItemDto) _then) = + __$CreatePriceListPolicyItemDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreatePriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey(name: CreatePriceListPolicyItemDto.productPresentationIdKey_) + String productPresentationId}); +} + +/// @nodoc +class __$CreatePriceListPolicyItemDtoCopyWithImpl<$Res> + implements _$CreatePriceListPolicyItemDtoCopyWith<$Res> { + __$CreatePriceListPolicyItemDtoCopyWithImpl(this._self, this._then); + + final _CreatePriceListPolicyItemDto _self; + final $Res Function(_CreatePriceListPolicyItemDto) _then; + + /// Create a copy of CreatePriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? productId = null, + Object? productPresentationId = null, + }) { + return _then(_CreatePriceListPolicyItemDto( + productId: null == productId + ? _self.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + productPresentationId: null == productPresentationId + ? _self.productPresentationId + : productPresentationId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_item_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_item_dto.g.dart new file mode 100644 index 00000000..376a4c5e --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_price_list_policy_item_dto.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_price_list_policy_item_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreatePriceListPolicyItemDto _$CreatePriceListPolicyItemDtoFromJson( + Map json) => + _CreatePriceListPolicyItemDto( + productId: json['product_id'] as String, + productPresentationId: json['product_presentation_id'] as String, + ); + +Map _$CreatePriceListPolicyItemDtoToJson( + _CreatePriceListPolicyItemDto instance) => + { + 'product_id': instance.productId, + 'product_presentation_id': instance.productPresentationId, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_product_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_dto.dart new file mode 100644 index 00000000..75c2c15f --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_dto.dart @@ -0,0 +1,148 @@ +/// CreateProductDto +/// { +/// "properties": { +/// "name": { +/// "type": "string" +/// }, +/// "category_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "base_uom": { +/// "$ref": "#/components/schemas/BaseUomKind" +/// }, +/// "description": { +/// "type": "string", +/// "nullable": true +/// }, +/// "barcode": { +/// "type": "string", +/// "nullable": true +/// }, +/// "purchase_price": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "sale_price": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "markup_percentage": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "use_boolean_stock": { +/// "type": "boolean" +/// }, +/// "allow_generic": { +/// "type": "boolean" +/// }, +/// "variants": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/CreateProductVariantDto" +/// } +/// }, +/// "presentations": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/CreateProductPresentationDto" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "allow_generic", +/// "base_uom", +/// "category_id", +/// "name", +/// "presentations", +/// "use_boolean_stock", +/// "variants" +/// ], +/// "additionalProperties": false +/// } +library create_product_dto; + +import 'exports.dart'; +part 'create_product_dto.freezed.dart'; +part 'create_product_dto.g.dart'; // CreateProductDto + +@freezed +abstract class CreateProductDto with _$CreateProductDto { + const CreateProductDto._(); + + @jsonSerializable + const factory CreateProductDto({ + /// name + @JsonKey(name: CreateProductDto.nameKey_) required String name, + + /// categoryId + @JsonKey(name: CreateProductDto.categoryIdKey_) required String categoryId, + + /// baseUom + @JsonKey(name: CreateProductDto.baseUomKey_) required BaseUomKind baseUom, + + /// description + @JsonKey(name: CreateProductDto.descriptionKey_) String? description, + + /// barcode + @JsonKey(name: CreateProductDto.barcodeKey_) String? barcode, + + /// purchasePrice + @JsonKey(name: CreateProductDto.purchasePriceKey_) double? purchasePrice, + + /// salePrice + @JsonKey(name: CreateProductDto.salePriceKey_) double? salePrice, + + /// markupPercentage + @JsonKey(name: CreateProductDto.markupPercentageKey_) + double? markupPercentage, + + /// useBooleanStock + @JsonKey(name: CreateProductDto.useBooleanStockKey_) + required bool useBooleanStock, + + /// allowGeneric + @JsonKey(name: CreateProductDto.allowGenericKey_) + required bool allowGeneric, + + /// variants + @JsonKey(name: CreateProductDto.variantsKey_) + required List variants, + + /// presentations + @JsonKey(name: CreateProductDto.presentationsKey_) + required List presentations, + }) = _CreateProductDto; + + factory CreateProductDto.fromJson(Map json) => + _$CreateProductDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String categoryIdKey_ = r'category_id'; + + static const String baseUomKey_ = r'base_uom'; + + static const String descriptionKey_ = r'description'; + + static const String barcodeKey_ = r'barcode'; + + static const String purchasePriceKey_ = r'purchase_price'; + + static const String salePriceKey_ = r'sale_price'; + + static const String markupPercentageKey_ = r'markup_percentage'; + + static const String useBooleanStockKey_ = r'use_boolean_stock'; + + static const String allowGenericKey_ = r'allow_generic'; + + static const String variantsKey_ = r'variants'; + + static const String presentationsKey_ = r'presentations'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_product_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_dto.freezed.dart new file mode 100644 index 00000000..21c859c8 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_dto.freezed.dart @@ -0,0 +1,748 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_product_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateProductDto { + /// name + @JsonKey(name: CreateProductDto.nameKey_) + String get name; + + /// categoryId + @JsonKey(name: CreateProductDto.categoryIdKey_) + String get categoryId; + + /// baseUom + @JsonKey(name: CreateProductDto.baseUomKey_) + BaseUomKind get baseUom; + + /// description + @JsonKey(name: CreateProductDto.descriptionKey_) + String? get description; + + /// barcode + @JsonKey(name: CreateProductDto.barcodeKey_) + String? get barcode; + + /// purchasePrice + @JsonKey(name: CreateProductDto.purchasePriceKey_) + double? get purchasePrice; + + /// salePrice + @JsonKey(name: CreateProductDto.salePriceKey_) + double? get salePrice; + + /// markupPercentage + @JsonKey(name: CreateProductDto.markupPercentageKey_) + double? get markupPercentage; + + /// useBooleanStock + @JsonKey(name: CreateProductDto.useBooleanStockKey_) + bool get useBooleanStock; + + /// allowGeneric + @JsonKey(name: CreateProductDto.allowGenericKey_) + bool get allowGeneric; + + /// variants + @JsonKey(name: CreateProductDto.variantsKey_) + List get variants; + + /// presentations + @JsonKey(name: CreateProductDto.presentationsKey_) + List get presentations; + + /// Create a copy of CreateProductDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateProductDtoCopyWith get copyWith => + _$CreateProductDtoCopyWithImpl( + this as CreateProductDto, _$identity); + + /// Serializes this CreateProductDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateProductDto && + (identical(other.name, name) || other.name == name) && + (identical(other.categoryId, categoryId) || + other.categoryId == categoryId) && + (identical(other.baseUom, baseUom) || other.baseUom == baseUom) && + (identical(other.description, description) || + other.description == description) && + (identical(other.barcode, barcode) || other.barcode == barcode) && + (identical(other.purchasePrice, purchasePrice) || + other.purchasePrice == purchasePrice) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice) && + (identical(other.markupPercentage, markupPercentage) || + other.markupPercentage == markupPercentage) && + (identical(other.useBooleanStock, useBooleanStock) || + other.useBooleanStock == useBooleanStock) && + (identical(other.allowGeneric, allowGeneric) || + other.allowGeneric == allowGeneric) && + const DeepCollectionEquality().equals(other.variants, variants) && + const DeepCollectionEquality() + .equals(other.presentations, presentations)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + name, + categoryId, + baseUom, + description, + barcode, + purchasePrice, + salePrice, + markupPercentage, + useBooleanStock, + allowGeneric, + const DeepCollectionEquality().hash(variants), + const DeepCollectionEquality().hash(presentations)); + + @override + String toString() { + return 'CreateProductDto(name: $name, categoryId: $categoryId, baseUom: $baseUom, description: $description, barcode: $barcode, purchasePrice: $purchasePrice, salePrice: $salePrice, markupPercentage: $markupPercentage, useBooleanStock: $useBooleanStock, allowGeneric: $allowGeneric, variants: $variants, presentations: $presentations)'; + } +} + +/// @nodoc +abstract mixin class $CreateProductDtoCopyWith<$Res> { + factory $CreateProductDtoCopyWith( + CreateProductDto value, $Res Function(CreateProductDto) _then) = + _$CreateProductDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreateProductDto.nameKey_) String name, + @JsonKey(name: CreateProductDto.categoryIdKey_) String categoryId, + @JsonKey(name: CreateProductDto.baseUomKey_) BaseUomKind baseUom, + @JsonKey(name: CreateProductDto.descriptionKey_) String? description, + @JsonKey(name: CreateProductDto.barcodeKey_) String? barcode, + @JsonKey(name: CreateProductDto.purchasePriceKey_) double? purchasePrice, + @JsonKey(name: CreateProductDto.salePriceKey_) double? salePrice, + @JsonKey(name: CreateProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: CreateProductDto.useBooleanStockKey_) bool useBooleanStock, + @JsonKey(name: CreateProductDto.allowGenericKey_) bool allowGeneric, + @JsonKey(name: CreateProductDto.variantsKey_) + List variants, + @JsonKey(name: CreateProductDto.presentationsKey_) + List presentations}); +} + +/// @nodoc +class _$CreateProductDtoCopyWithImpl<$Res> + implements $CreateProductDtoCopyWith<$Res> { + _$CreateProductDtoCopyWithImpl(this._self, this._then); + + final CreateProductDto _self; + final $Res Function(CreateProductDto) _then; + + /// Create a copy of CreateProductDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? categoryId = null, + Object? baseUom = null, + Object? description = freezed, + Object? barcode = freezed, + Object? purchasePrice = freezed, + Object? salePrice = freezed, + Object? markupPercentage = freezed, + Object? useBooleanStock = null, + Object? allowGeneric = null, + Object? variants = null, + Object? presentations = null, + }) { + return _then(_self.copyWith( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + categoryId: null == categoryId + ? _self.categoryId + : categoryId // ignore: cast_nullable_to_non_nullable + as String, + baseUom: null == baseUom + ? _self.baseUom + : baseUom // ignore: cast_nullable_to_non_nullable + as BaseUomKind, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + barcode: freezed == barcode + ? _self.barcode + : barcode // ignore: cast_nullable_to_non_nullable + as String?, + purchasePrice: freezed == purchasePrice + ? _self.purchasePrice + : purchasePrice // ignore: cast_nullable_to_non_nullable + as double?, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + markupPercentage: freezed == markupPercentage + ? _self.markupPercentage + : markupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + useBooleanStock: null == useBooleanStock + ? _self.useBooleanStock + : useBooleanStock // ignore: cast_nullable_to_non_nullable + as bool, + allowGeneric: null == allowGeneric + ? _self.allowGeneric + : allowGeneric // ignore: cast_nullable_to_non_nullable + as bool, + variants: null == variants + ? _self.variants + : variants // ignore: cast_nullable_to_non_nullable + as List, + presentations: null == presentations + ? _self.presentations + : presentations // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [CreateProductDto]. +extension CreateProductDtoPatterns on CreateProductDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreateProductDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateProductDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreateProductDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreateProductDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreateProductDto.nameKey_) String name, + @JsonKey(name: CreateProductDto.categoryIdKey_) String categoryId, + @JsonKey(name: CreateProductDto.baseUomKey_) BaseUomKind baseUom, + @JsonKey(name: CreateProductDto.descriptionKey_) + String? description, + @JsonKey(name: CreateProductDto.barcodeKey_) String? barcode, + @JsonKey(name: CreateProductDto.purchasePriceKey_) + double? purchasePrice, + @JsonKey(name: CreateProductDto.salePriceKey_) double? salePrice, + @JsonKey(name: CreateProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: CreateProductDto.useBooleanStockKey_) + bool useBooleanStock, + @JsonKey(name: CreateProductDto.allowGenericKey_) bool allowGeneric, + @JsonKey(name: CreateProductDto.variantsKey_) + List variants, + @JsonKey(name: CreateProductDto.presentationsKey_) + List presentations)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateProductDto() when $default != null: + return $default( + _that.name, + _that.categoryId, + _that.baseUom, + _that.description, + _that.barcode, + _that.purchasePrice, + _that.salePrice, + _that.markupPercentage, + _that.useBooleanStock, + _that.allowGeneric, + _that.variants, + _that.presentations); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreateProductDto.nameKey_) String name, + @JsonKey(name: CreateProductDto.categoryIdKey_) String categoryId, + @JsonKey(name: CreateProductDto.baseUomKey_) BaseUomKind baseUom, + @JsonKey(name: CreateProductDto.descriptionKey_) + String? description, + @JsonKey(name: CreateProductDto.barcodeKey_) String? barcode, + @JsonKey(name: CreateProductDto.purchasePriceKey_) + double? purchasePrice, + @JsonKey(name: CreateProductDto.salePriceKey_) double? salePrice, + @JsonKey(name: CreateProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: CreateProductDto.useBooleanStockKey_) + bool useBooleanStock, + @JsonKey(name: CreateProductDto.allowGenericKey_) bool allowGeneric, + @JsonKey(name: CreateProductDto.variantsKey_) + List variants, + @JsonKey(name: CreateProductDto.presentationsKey_) + List presentations) + $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductDto(): + return $default( + _that.name, + _that.categoryId, + _that.baseUom, + _that.description, + _that.barcode, + _that.purchasePrice, + _that.salePrice, + _that.markupPercentage, + _that.useBooleanStock, + _that.allowGeneric, + _that.variants, + _that.presentations); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreateProductDto.nameKey_) String name, + @JsonKey(name: CreateProductDto.categoryIdKey_) String categoryId, + @JsonKey(name: CreateProductDto.baseUomKey_) BaseUomKind baseUom, + @JsonKey(name: CreateProductDto.descriptionKey_) + String? description, + @JsonKey(name: CreateProductDto.barcodeKey_) String? barcode, + @JsonKey(name: CreateProductDto.purchasePriceKey_) + double? purchasePrice, + @JsonKey(name: CreateProductDto.salePriceKey_) double? salePrice, + @JsonKey(name: CreateProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: CreateProductDto.useBooleanStockKey_) + bool useBooleanStock, + @JsonKey(name: CreateProductDto.allowGenericKey_) bool allowGeneric, + @JsonKey(name: CreateProductDto.variantsKey_) + List variants, + @JsonKey(name: CreateProductDto.presentationsKey_) + List presentations)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductDto() when $default != null: + return $default( + _that.name, + _that.categoryId, + _that.baseUom, + _that.description, + _that.barcode, + _that.purchasePrice, + _that.salePrice, + _that.markupPercentage, + _that.useBooleanStock, + _that.allowGeneric, + _that.variants, + _that.presentations); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreateProductDto extends CreateProductDto { + const _CreateProductDto( + {@JsonKey(name: CreateProductDto.nameKey_) required this.name, + @JsonKey(name: CreateProductDto.categoryIdKey_) required this.categoryId, + @JsonKey(name: CreateProductDto.baseUomKey_) required this.baseUom, + @JsonKey(name: CreateProductDto.descriptionKey_) this.description, + @JsonKey(name: CreateProductDto.barcodeKey_) this.barcode, + @JsonKey(name: CreateProductDto.purchasePriceKey_) this.purchasePrice, + @JsonKey(name: CreateProductDto.salePriceKey_) this.salePrice, + @JsonKey(name: CreateProductDto.markupPercentageKey_) + this.markupPercentage, + @JsonKey(name: CreateProductDto.useBooleanStockKey_) + required this.useBooleanStock, + @JsonKey(name: CreateProductDto.allowGenericKey_) + required this.allowGeneric, + @JsonKey(name: CreateProductDto.variantsKey_) + required final List variants, + @JsonKey(name: CreateProductDto.presentationsKey_) + required final List presentations}) + : _variants = variants, + _presentations = presentations, + super._(); + factory _CreateProductDto.fromJson(Map json) => + _$CreateProductDtoFromJson(json); + + /// name + @override + @JsonKey(name: CreateProductDto.nameKey_) + final String name; + + /// categoryId + @override + @JsonKey(name: CreateProductDto.categoryIdKey_) + final String categoryId; + + /// baseUom + @override + @JsonKey(name: CreateProductDto.baseUomKey_) + final BaseUomKind baseUom; + + /// description + @override + @JsonKey(name: CreateProductDto.descriptionKey_) + final String? description; + + /// barcode + @override + @JsonKey(name: CreateProductDto.barcodeKey_) + final String? barcode; + + /// purchasePrice + @override + @JsonKey(name: CreateProductDto.purchasePriceKey_) + final double? purchasePrice; + + /// salePrice + @override + @JsonKey(name: CreateProductDto.salePriceKey_) + final double? salePrice; + + /// markupPercentage + @override + @JsonKey(name: CreateProductDto.markupPercentageKey_) + final double? markupPercentage; + + /// useBooleanStock + @override + @JsonKey(name: CreateProductDto.useBooleanStockKey_) + final bool useBooleanStock; + + /// allowGeneric + @override + @JsonKey(name: CreateProductDto.allowGenericKey_) + final bool allowGeneric; + + /// variants + final List _variants; + + /// variants + @override + @JsonKey(name: CreateProductDto.variantsKey_) + List get variants { + if (_variants is EqualUnmodifiableListView) return _variants; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_variants); + } + + /// presentations + final List _presentations; + + /// presentations + @override + @JsonKey(name: CreateProductDto.presentationsKey_) + List get presentations { + if (_presentations is EqualUnmodifiableListView) return _presentations; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_presentations); + } + + /// Create a copy of CreateProductDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreateProductDtoCopyWith<_CreateProductDto> get copyWith => + __$CreateProductDtoCopyWithImpl<_CreateProductDto>(this, _$identity); + + @override + Map toJson() { + return _$CreateProductDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreateProductDto && + (identical(other.name, name) || other.name == name) && + (identical(other.categoryId, categoryId) || + other.categoryId == categoryId) && + (identical(other.baseUom, baseUom) || other.baseUom == baseUom) && + (identical(other.description, description) || + other.description == description) && + (identical(other.barcode, barcode) || other.barcode == barcode) && + (identical(other.purchasePrice, purchasePrice) || + other.purchasePrice == purchasePrice) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice) && + (identical(other.markupPercentage, markupPercentage) || + other.markupPercentage == markupPercentage) && + (identical(other.useBooleanStock, useBooleanStock) || + other.useBooleanStock == useBooleanStock) && + (identical(other.allowGeneric, allowGeneric) || + other.allowGeneric == allowGeneric) && + const DeepCollectionEquality().equals(other._variants, _variants) && + const DeepCollectionEquality() + .equals(other._presentations, _presentations)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + name, + categoryId, + baseUom, + description, + barcode, + purchasePrice, + salePrice, + markupPercentage, + useBooleanStock, + allowGeneric, + const DeepCollectionEquality().hash(_variants), + const DeepCollectionEquality().hash(_presentations)); + + @override + String toString() { + return 'CreateProductDto(name: $name, categoryId: $categoryId, baseUom: $baseUom, description: $description, barcode: $barcode, purchasePrice: $purchasePrice, salePrice: $salePrice, markupPercentage: $markupPercentage, useBooleanStock: $useBooleanStock, allowGeneric: $allowGeneric, variants: $variants, presentations: $presentations)'; + } +} + +/// @nodoc +abstract mixin class _$CreateProductDtoCopyWith<$Res> + implements $CreateProductDtoCopyWith<$Res> { + factory _$CreateProductDtoCopyWith( + _CreateProductDto value, $Res Function(_CreateProductDto) _then) = + __$CreateProductDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreateProductDto.nameKey_) String name, + @JsonKey(name: CreateProductDto.categoryIdKey_) String categoryId, + @JsonKey(name: CreateProductDto.baseUomKey_) BaseUomKind baseUom, + @JsonKey(name: CreateProductDto.descriptionKey_) String? description, + @JsonKey(name: CreateProductDto.barcodeKey_) String? barcode, + @JsonKey(name: CreateProductDto.purchasePriceKey_) double? purchasePrice, + @JsonKey(name: CreateProductDto.salePriceKey_) double? salePrice, + @JsonKey(name: CreateProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: CreateProductDto.useBooleanStockKey_) bool useBooleanStock, + @JsonKey(name: CreateProductDto.allowGenericKey_) bool allowGeneric, + @JsonKey(name: CreateProductDto.variantsKey_) + List variants, + @JsonKey(name: CreateProductDto.presentationsKey_) + List presentations}); +} + +/// @nodoc +class __$CreateProductDtoCopyWithImpl<$Res> + implements _$CreateProductDtoCopyWith<$Res> { + __$CreateProductDtoCopyWithImpl(this._self, this._then); + + final _CreateProductDto _self; + final $Res Function(_CreateProductDto) _then; + + /// Create a copy of CreateProductDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = null, + Object? categoryId = null, + Object? baseUom = null, + Object? description = freezed, + Object? barcode = freezed, + Object? purchasePrice = freezed, + Object? salePrice = freezed, + Object? markupPercentage = freezed, + Object? useBooleanStock = null, + Object? allowGeneric = null, + Object? variants = null, + Object? presentations = null, + }) { + return _then(_CreateProductDto( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + categoryId: null == categoryId + ? _self.categoryId + : categoryId // ignore: cast_nullable_to_non_nullable + as String, + baseUom: null == baseUom + ? _self.baseUom + : baseUom // ignore: cast_nullable_to_non_nullable + as BaseUomKind, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + barcode: freezed == barcode + ? _self.barcode + : barcode // ignore: cast_nullable_to_non_nullable + as String?, + purchasePrice: freezed == purchasePrice + ? _self.purchasePrice + : purchasePrice // ignore: cast_nullable_to_non_nullable + as double?, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + markupPercentage: freezed == markupPercentage + ? _self.markupPercentage + : markupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + useBooleanStock: null == useBooleanStock + ? _self.useBooleanStock + : useBooleanStock // ignore: cast_nullable_to_non_nullable + as bool, + allowGeneric: null == allowGeneric + ? _self.allowGeneric + : allowGeneric // ignore: cast_nullable_to_non_nullable + as bool, + variants: null == variants + ? _self._variants + : variants // ignore: cast_nullable_to_non_nullable + as List, + presentations: null == presentations + ? _self._presentations + : presentations // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_product_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_dto.g.dart new file mode 100644 index 00000000..48d546ba --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_dto.g.dart @@ -0,0 +1,46 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_product_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreateProductDto _$CreateProductDtoFromJson(Map json) => + _CreateProductDto( + name: json['name'] as String, + categoryId: json['category_id'] as String, + baseUom: BaseUomKind.fromJson(json['base_uom'] as String), + description: json['description'] as String?, + barcode: json['barcode'] as String?, + purchasePrice: (json['purchase_price'] as num?)?.toDouble(), + salePrice: (json['sale_price'] as num?)?.toDouble(), + markupPercentage: (json['markup_percentage'] as num?)?.toDouble(), + useBooleanStock: json['use_boolean_stock'] as bool, + allowGeneric: json['allow_generic'] as bool, + variants: (json['variants'] as List) + .map((e) => + CreateProductVariantDto.fromJson(e as Map)) + .toList(), + presentations: (json['presentations'] as List) + .map((e) => + CreateProductPresentationDto.fromJson(e as Map)) + .toList(), + ); + +Map _$CreateProductDtoToJson(_CreateProductDto instance) => + { + 'name': instance.name, + 'category_id': instance.categoryId, + 'base_uom': instance.baseUom.toJson(), + if (instance.description case final value?) 'description': value, + if (instance.barcode case final value?) 'barcode': value, + if (instance.purchasePrice case final value?) 'purchase_price': value, + if (instance.salePrice case final value?) 'sale_price': value, + if (instance.markupPercentage case final value?) + 'markup_percentage': value, + 'use_boolean_stock': instance.useBooleanStock, + 'allow_generic': instance.allowGeneric, + 'variants': instance.variants.map((e) => e.toJson()).toList(), + 'presentations': instance.presentations.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_product_presentation_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_presentation_dto.dart new file mode 100644 index 00000000..92544218 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_presentation_dto.dart @@ -0,0 +1,56 @@ +/// CreateProductPresentationDto +/// { +/// "properties": { +/// "name": { +/// "type": "string" +/// }, +/// "quantity_multiplier": { +/// "type": "integer", +/// "format": "int32" +/// }, +/// "is_default": { +/// "type": "boolean" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "is_default", +/// "name", +/// "quantity_multiplier" +/// ], +/// "additionalProperties": false +/// } +library create_product_presentation_dto; + +import 'exports.dart'; +part 'create_product_presentation_dto.freezed.dart'; +part 'create_product_presentation_dto.g.dart'; // CreateProductPresentationDto + +@freezed +abstract class CreateProductPresentationDto + with _$CreateProductPresentationDto { + const CreateProductPresentationDto._(); + + @jsonSerializable + const factory CreateProductPresentationDto({ + /// name + @JsonKey(name: CreateProductPresentationDto.nameKey_) required String name, + + /// quantityMultiplier + @JsonKey(name: CreateProductPresentationDto.quantityMultiplierKey_) + required int quantityMultiplier, + + /// isDefault + @JsonKey(name: CreateProductPresentationDto.isDefaultKey_) + required bool isDefault, + }) = _CreateProductPresentationDto; + + factory CreateProductPresentationDto.fromJson(Map json) => + _$CreateProductPresentationDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String quantityMultiplierKey_ = r'quantity_multiplier'; + + static const String isDefaultKey_ = r'is_default'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_product_presentation_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_presentation_dto.freezed.dart new file mode 100644 index 00000000..8c03c415 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_presentation_dto.freezed.dart @@ -0,0 +1,404 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_product_presentation_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateProductPresentationDto { + /// name + @JsonKey(name: CreateProductPresentationDto.nameKey_) + String get name; + + /// quantityMultiplier + @JsonKey(name: CreateProductPresentationDto.quantityMultiplierKey_) + int get quantityMultiplier; + + /// isDefault + @JsonKey(name: CreateProductPresentationDto.isDefaultKey_) + bool get isDefault; + + /// Create a copy of CreateProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateProductPresentationDtoCopyWith + get copyWith => _$CreateProductPresentationDtoCopyWithImpl< + CreateProductPresentationDto>( + this as CreateProductPresentationDto, _$identity); + + /// Serializes this CreateProductPresentationDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateProductPresentationDto && + (identical(other.name, name) || other.name == name) && + (identical(other.quantityMultiplier, quantityMultiplier) || + other.quantityMultiplier == quantityMultiplier) && + (identical(other.isDefault, isDefault) || + other.isDefault == isDefault)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, quantityMultiplier, isDefault); + + @override + String toString() { + return 'CreateProductPresentationDto(name: $name, quantityMultiplier: $quantityMultiplier, isDefault: $isDefault)'; + } +} + +/// @nodoc +abstract mixin class $CreateProductPresentationDtoCopyWith<$Res> { + factory $CreateProductPresentationDtoCopyWith( + CreateProductPresentationDto value, + $Res Function(CreateProductPresentationDto) _then) = + _$CreateProductPresentationDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreateProductPresentationDto.nameKey_) String name, + @JsonKey(name: CreateProductPresentationDto.quantityMultiplierKey_) + int quantityMultiplier, + @JsonKey(name: CreateProductPresentationDto.isDefaultKey_) + bool isDefault}); +} + +/// @nodoc +class _$CreateProductPresentationDtoCopyWithImpl<$Res> + implements $CreateProductPresentationDtoCopyWith<$Res> { + _$CreateProductPresentationDtoCopyWithImpl(this._self, this._then); + + final CreateProductPresentationDto _self; + final $Res Function(CreateProductPresentationDto) _then; + + /// Create a copy of CreateProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? quantityMultiplier = null, + Object? isDefault = null, + }) { + return _then(_self.copyWith( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + quantityMultiplier: null == quantityMultiplier + ? _self.quantityMultiplier + : quantityMultiplier // ignore: cast_nullable_to_non_nullable + as int, + isDefault: null == isDefault + ? _self.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// Adds pattern-matching-related methods to [CreateProductPresentationDto]. +extension CreateProductPresentationDtoPatterns on CreateProductPresentationDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreateProductPresentationDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateProductPresentationDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreateProductPresentationDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductPresentationDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreateProductPresentationDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductPresentationDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreateProductPresentationDto.nameKey_) String name, + @JsonKey(name: CreateProductPresentationDto.quantityMultiplierKey_) + int quantityMultiplier, + @JsonKey(name: CreateProductPresentationDto.isDefaultKey_) + bool isDefault)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateProductPresentationDto() when $default != null: + return $default(_that.name, _that.quantityMultiplier, _that.isDefault); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreateProductPresentationDto.nameKey_) String name, + @JsonKey(name: CreateProductPresentationDto.quantityMultiplierKey_) + int quantityMultiplier, + @JsonKey(name: CreateProductPresentationDto.isDefaultKey_) + bool isDefault) + $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductPresentationDto(): + return $default(_that.name, _that.quantityMultiplier, _that.isDefault); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreateProductPresentationDto.nameKey_) String name, + @JsonKey(name: CreateProductPresentationDto.quantityMultiplierKey_) + int quantityMultiplier, + @JsonKey(name: CreateProductPresentationDto.isDefaultKey_) + bool isDefault)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductPresentationDto() when $default != null: + return $default(_that.name, _that.quantityMultiplier, _that.isDefault); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreateProductPresentationDto extends CreateProductPresentationDto { + const _CreateProductPresentationDto( + {@JsonKey(name: CreateProductPresentationDto.nameKey_) required this.name, + @JsonKey(name: CreateProductPresentationDto.quantityMultiplierKey_) + required this.quantityMultiplier, + @JsonKey(name: CreateProductPresentationDto.isDefaultKey_) + required this.isDefault}) + : super._(); + factory _CreateProductPresentationDto.fromJson(Map json) => + _$CreateProductPresentationDtoFromJson(json); + + /// name + @override + @JsonKey(name: CreateProductPresentationDto.nameKey_) + final String name; + + /// quantityMultiplier + @override + @JsonKey(name: CreateProductPresentationDto.quantityMultiplierKey_) + final int quantityMultiplier; + + /// isDefault + @override + @JsonKey(name: CreateProductPresentationDto.isDefaultKey_) + final bool isDefault; + + /// Create a copy of CreateProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreateProductPresentationDtoCopyWith<_CreateProductPresentationDto> + get copyWith => __$CreateProductPresentationDtoCopyWithImpl< + _CreateProductPresentationDto>(this, _$identity); + + @override + Map toJson() { + return _$CreateProductPresentationDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreateProductPresentationDto && + (identical(other.name, name) || other.name == name) && + (identical(other.quantityMultiplier, quantityMultiplier) || + other.quantityMultiplier == quantityMultiplier) && + (identical(other.isDefault, isDefault) || + other.isDefault == isDefault)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, quantityMultiplier, isDefault); + + @override + String toString() { + return 'CreateProductPresentationDto(name: $name, quantityMultiplier: $quantityMultiplier, isDefault: $isDefault)'; + } +} + +/// @nodoc +abstract mixin class _$CreateProductPresentationDtoCopyWith<$Res> + implements $CreateProductPresentationDtoCopyWith<$Res> { + factory _$CreateProductPresentationDtoCopyWith( + _CreateProductPresentationDto value, + $Res Function(_CreateProductPresentationDto) _then) = + __$CreateProductPresentationDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreateProductPresentationDto.nameKey_) String name, + @JsonKey(name: CreateProductPresentationDto.quantityMultiplierKey_) + int quantityMultiplier, + @JsonKey(name: CreateProductPresentationDto.isDefaultKey_) + bool isDefault}); +} + +/// @nodoc +class __$CreateProductPresentationDtoCopyWithImpl<$Res> + implements _$CreateProductPresentationDtoCopyWith<$Res> { + __$CreateProductPresentationDtoCopyWithImpl(this._self, this._then); + + final _CreateProductPresentationDto _self; + final $Res Function(_CreateProductPresentationDto) _then; + + /// Create a copy of CreateProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = null, + Object? quantityMultiplier = null, + Object? isDefault = null, + }) { + return _then(_CreateProductPresentationDto( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + quantityMultiplier: null == quantityMultiplier + ? _self.quantityMultiplier + : quantityMultiplier // ignore: cast_nullable_to_non_nullable + as int, + isDefault: null == isDefault + ? _self.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_product_presentation_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_presentation_dto.g.dart new file mode 100644 index 00000000..185635de --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_presentation_dto.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_product_presentation_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreateProductPresentationDto _$CreateProductPresentationDtoFromJson( + Map json) => + _CreateProductPresentationDto( + name: json['name'] as String, + quantityMultiplier: (json['quantity_multiplier'] as num).toInt(), + isDefault: json['is_default'] as bool, + ); + +Map _$CreateProductPresentationDtoToJson( + _CreateProductPresentationDto instance) => + { + 'name': instance.name, + 'quantity_multiplier': instance.quantityMultiplier, + 'is_default': instance.isDefault, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_product_variant_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_variant_dto.dart new file mode 100644 index 00000000..9ab3b2b7 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_variant_dto.dart @@ -0,0 +1,34 @@ +/// CreateProductVariantDto +/// { +/// "properties": { +/// "name": { +/// "type": "string" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "name" +/// ], +/// "additionalProperties": false +/// } +library create_product_variant_dto; + +import 'exports.dart'; +part 'create_product_variant_dto.freezed.dart'; +part 'create_product_variant_dto.g.dart'; // CreateProductVariantDto + +@freezed +abstract class CreateProductVariantDto with _$CreateProductVariantDto { + const CreateProductVariantDto._(); + + @jsonSerializable + const factory CreateProductVariantDto({ + /// name + @JsonKey(name: CreateProductVariantDto.nameKey_) required String name, + }) = _CreateProductVariantDto; + + factory CreateProductVariantDto.fromJson(Map json) => + _$CreateProductVariantDtoFromJson(json); + + static const String nameKey_ = r'name'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_product_variant_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_variant_dto.freezed.dart new file mode 100644 index 00000000..59012dab --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_variant_dto.freezed.dart @@ -0,0 +1,327 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_product_variant_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateProductVariantDto { + /// name + @JsonKey(name: CreateProductVariantDto.nameKey_) + String get name; + + /// Create a copy of CreateProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateProductVariantDtoCopyWith get copyWith => + _$CreateProductVariantDtoCopyWithImpl( + this as CreateProductVariantDto, _$identity); + + /// Serializes this CreateProductVariantDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateProductVariantDto && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, name); + + @override + String toString() { + return 'CreateProductVariantDto(name: $name)'; + } +} + +/// @nodoc +abstract mixin class $CreateProductVariantDtoCopyWith<$Res> { + factory $CreateProductVariantDtoCopyWith(CreateProductVariantDto value, + $Res Function(CreateProductVariantDto) _then) = + _$CreateProductVariantDtoCopyWithImpl; + @useResult + $Res call({@JsonKey(name: CreateProductVariantDto.nameKey_) String name}); +} + +/// @nodoc +class _$CreateProductVariantDtoCopyWithImpl<$Res> + implements $CreateProductVariantDtoCopyWith<$Res> { + _$CreateProductVariantDtoCopyWithImpl(this._self, this._then); + + final CreateProductVariantDto _self; + final $Res Function(CreateProductVariantDto) _then; + + /// Create a copy of CreateProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + }) { + return _then(_self.copyWith( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [CreateProductVariantDto]. +extension CreateProductVariantDtoPatterns on CreateProductVariantDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreateProductVariantDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateProductVariantDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreateProductVariantDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductVariantDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreateProductVariantDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductVariantDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreateProductVariantDto.nameKey_) String name)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateProductVariantDto() when $default != null: + return $default(_that.name); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreateProductVariantDto.nameKey_) String name) + $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductVariantDto(): + return $default(_that.name); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreateProductVariantDto.nameKey_) String name)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreateProductVariantDto() when $default != null: + return $default(_that.name); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreateProductVariantDto extends CreateProductVariantDto { + const _CreateProductVariantDto( + {@JsonKey(name: CreateProductVariantDto.nameKey_) required this.name}) + : super._(); + factory _CreateProductVariantDto.fromJson(Map json) => + _$CreateProductVariantDtoFromJson(json); + + /// name + @override + @JsonKey(name: CreateProductVariantDto.nameKey_) + final String name; + + /// Create a copy of CreateProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreateProductVariantDtoCopyWith<_CreateProductVariantDto> get copyWith => + __$CreateProductVariantDtoCopyWithImpl<_CreateProductVariantDto>( + this, _$identity); + + @override + Map toJson() { + return _$CreateProductVariantDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreateProductVariantDto && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, name); + + @override + String toString() { + return 'CreateProductVariantDto(name: $name)'; + } +} + +/// @nodoc +abstract mixin class _$CreateProductVariantDtoCopyWith<$Res> + implements $CreateProductVariantDtoCopyWith<$Res> { + factory _$CreateProductVariantDtoCopyWith(_CreateProductVariantDto value, + $Res Function(_CreateProductVariantDto) _then) = + __$CreateProductVariantDtoCopyWithImpl; + @override + @useResult + $Res call({@JsonKey(name: CreateProductVariantDto.nameKey_) String name}); +} + +/// @nodoc +class __$CreateProductVariantDtoCopyWithImpl<$Res> + implements _$CreateProductVariantDtoCopyWith<$Res> { + __$CreateProductVariantDtoCopyWithImpl(this._self, this._then); + + final _CreateProductVariantDto _self; + final $Res Function(_CreateProductVariantDto) _then; + + /// Create a copy of CreateProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = null, + }) { + return _then(_CreateProductVariantDto( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_product_variant_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_variant_dto.g.dart new file mode 100644 index 00000000..ed3dd0fd --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_product_variant_dto.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_product_variant_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreateProductVariantDto _$CreateProductVariantDtoFromJson( + Map json) => + _CreateProductVariantDto( + name: json['name'] as String, + ); + +Map _$CreateProductVariantDtoToJson( + _CreateProductVariantDto instance) => + { + 'name': instance.name, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_sale_point_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_sale_point_dto.dart new file mode 100644 index 00000000..93cc2072 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_sale_point_dto.dart @@ -0,0 +1,48 @@ +/// CreateSalePointDto +/// { +/// "properties": { +/// "name": { +/// "type": "string" +/// }, +/// "users_id": { +/// "type": "array", +/// "items": { +/// "type": "string", +/// "format": "uuid" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "name", +/// "users_id" +/// ], +/// "additionalProperties": false +/// } +library create_sale_point_dto; + +import 'exports.dart'; +part 'create_sale_point_dto.freezed.dart'; +part 'create_sale_point_dto.g.dart'; // CreateSalePointDto + +@freezed +abstract class CreateSalePointDto with _$CreateSalePointDto { + const CreateSalePointDto._(); + + @jsonSerializable + const factory CreateSalePointDto({ + /// name + @JsonKey(name: CreateSalePointDto.nameKey_) required String name, + + /// usersId + @JsonKey(name: CreateSalePointDto.usersIdKey_) + required List usersId, + }) = _CreateSalePointDto; + + factory CreateSalePointDto.fromJson(Map json) => + _$CreateSalePointDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String usersIdKey_ = r'users_id'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_sale_point_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_sale_point_dto.freezed.dart new file mode 100644 index 00000000..72513d09 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_sale_point_dto.freezed.dart @@ -0,0 +1,367 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_sale_point_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateSalePointDto { + /// name + @JsonKey(name: CreateSalePointDto.nameKey_) + String get name; + + /// usersId + @JsonKey(name: CreateSalePointDto.usersIdKey_) + List get usersId; + + /// Create a copy of CreateSalePointDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateSalePointDtoCopyWith get copyWith => + _$CreateSalePointDtoCopyWithImpl( + this as CreateSalePointDto, _$identity); + + /// Serializes this CreateSalePointDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateSalePointDto && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.usersId, usersId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, name, const DeepCollectionEquality().hash(usersId)); + + @override + String toString() { + return 'CreateSalePointDto(name: $name, usersId: $usersId)'; + } +} + +/// @nodoc +abstract mixin class $CreateSalePointDtoCopyWith<$Res> { + factory $CreateSalePointDtoCopyWith( + CreateSalePointDto value, $Res Function(CreateSalePointDto) _then) = + _$CreateSalePointDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreateSalePointDto.nameKey_) String name, + @JsonKey(name: CreateSalePointDto.usersIdKey_) List usersId}); +} + +/// @nodoc +class _$CreateSalePointDtoCopyWithImpl<$Res> + implements $CreateSalePointDtoCopyWith<$Res> { + _$CreateSalePointDtoCopyWithImpl(this._self, this._then); + + final CreateSalePointDto _self; + final $Res Function(CreateSalePointDto) _then; + + /// Create a copy of CreateSalePointDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? usersId = null, + }) { + return _then(_self.copyWith( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + usersId: null == usersId + ? _self.usersId + : usersId // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [CreateSalePointDto]. +extension CreateSalePointDtoPatterns on CreateSalePointDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreateSalePointDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateSalePointDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreateSalePointDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CreateSalePointDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreateSalePointDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreateSalePointDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreateSalePointDto.nameKey_) String name, + @JsonKey(name: CreateSalePointDto.usersIdKey_) + List usersId)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateSalePointDto() when $default != null: + return $default(_that.name, _that.usersId); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(@JsonKey(name: CreateSalePointDto.nameKey_) String name, + @JsonKey(name: CreateSalePointDto.usersIdKey_) List usersId) + $default, + ) { + final _that = this; + switch (_that) { + case _CreateSalePointDto(): + return $default(_that.name, _that.usersId); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreateSalePointDto.nameKey_) String name, + @JsonKey(name: CreateSalePointDto.usersIdKey_) + List usersId)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreateSalePointDto() when $default != null: + return $default(_that.name, _that.usersId); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreateSalePointDto extends CreateSalePointDto { + const _CreateSalePointDto( + {@JsonKey(name: CreateSalePointDto.nameKey_) required this.name, + @JsonKey(name: CreateSalePointDto.usersIdKey_) + required final List usersId}) + : _usersId = usersId, + super._(); + factory _CreateSalePointDto.fromJson(Map json) => + _$CreateSalePointDtoFromJson(json); + + /// name + @override + @JsonKey(name: CreateSalePointDto.nameKey_) + final String name; + + /// usersId + final List _usersId; + + /// usersId + @override + @JsonKey(name: CreateSalePointDto.usersIdKey_) + List get usersId { + if (_usersId is EqualUnmodifiableListView) return _usersId; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_usersId); + } + + /// Create a copy of CreateSalePointDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreateSalePointDtoCopyWith<_CreateSalePointDto> get copyWith => + __$CreateSalePointDtoCopyWithImpl<_CreateSalePointDto>(this, _$identity); + + @override + Map toJson() { + return _$CreateSalePointDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreateSalePointDto && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other._usersId, _usersId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, name, const DeepCollectionEquality().hash(_usersId)); + + @override + String toString() { + return 'CreateSalePointDto(name: $name, usersId: $usersId)'; + } +} + +/// @nodoc +abstract mixin class _$CreateSalePointDtoCopyWith<$Res> + implements $CreateSalePointDtoCopyWith<$Res> { + factory _$CreateSalePointDtoCopyWith( + _CreateSalePointDto value, $Res Function(_CreateSalePointDto) _then) = + __$CreateSalePointDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreateSalePointDto.nameKey_) String name, + @JsonKey(name: CreateSalePointDto.usersIdKey_) List usersId}); +} + +/// @nodoc +class __$CreateSalePointDtoCopyWithImpl<$Res> + implements _$CreateSalePointDtoCopyWith<$Res> { + __$CreateSalePointDtoCopyWithImpl(this._self, this._then); + + final _CreateSalePointDto _self; + final $Res Function(_CreateSalePointDto) _then; + + /// Create a copy of CreateSalePointDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = null, + Object? usersId = null, + }) { + return _then(_CreateSalePointDto( + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + usersId: null == usersId + ? _self._usersId + : usersId // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_sale_point_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_sale_point_dto.g.dart new file mode 100644 index 00000000..86bcb35a --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_sale_point_dto.g.dart @@ -0,0 +1,20 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_sale_point_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreateSalePointDto _$CreateSalePointDtoFromJson(Map json) => + _CreateSalePointDto( + name: json['name'] as String, + usersId: + (json['users_id'] as List).map((e) => e as String).toList(), + ); + +Map _$CreateSalePointDtoToJson(_CreateSalePointDto instance) => + { + 'name': instance.name, + 'users_id': instance.usersId, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_user_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_user_dto.dart new file mode 100644 index 00000000..a71d2d1d --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_user_dto.dart @@ -0,0 +1,64 @@ +/// CreateUserDto +/// { +/// "properties": { +/// "username": { +/// "type": "string" +/// }, +/// "name": { +/// "type": "string" +/// }, +/// "password": { +/// "type": "string" +/// }, +/// "roles": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/Role" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "name", +/// "password", +/// "roles", +/// "username" +/// ], +/// "additionalProperties": false +/// } +library create_user_dto; + +import 'exports.dart'; +part 'create_user_dto.freezed.dart'; +part 'create_user_dto.g.dart'; // CreateUserDto + +@freezed +abstract class CreateUserDto with _$CreateUserDto { + const CreateUserDto._(); + + @jsonSerializable + const factory CreateUserDto({ + /// username + @JsonKey(name: CreateUserDto.usernameKey_) required String username, + + /// name + @JsonKey(name: CreateUserDto.nameKey_) required String name, + + /// password + @JsonKey(name: CreateUserDto.passwordKey_) required String password, + + /// roles + @JsonKey(name: CreateUserDto.rolesKey_) required List roles, + }) = _CreateUserDto; + + factory CreateUserDto.fromJson(Map json) => + _$CreateUserDtoFromJson(json); + + static const String usernameKey_ = r'username'; + + static const String nameKey_ = r'name'; + + static const String passwordKey_ = r'password'; + + static const String rolesKey_ = r'roles'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_user_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_user_dto.freezed.dart new file mode 100644 index 00000000..c15800a0 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_user_dto.freezed.dart @@ -0,0 +1,426 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'create_user_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CreateUserDto { + /// username + @JsonKey(name: CreateUserDto.usernameKey_) + String get username; + + /// name + @JsonKey(name: CreateUserDto.nameKey_) + String get name; + + /// password + @JsonKey(name: CreateUserDto.passwordKey_) + String get password; + + /// roles + @JsonKey(name: CreateUserDto.rolesKey_) + List get roles; + + /// Create a copy of CreateUserDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CreateUserDtoCopyWith get copyWith => + _$CreateUserDtoCopyWithImpl( + this as CreateUserDto, _$identity); + + /// Serializes this CreateUserDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CreateUserDto && + (identical(other.username, username) || + other.username == username) && + (identical(other.name, name) || other.name == name) && + (identical(other.password, password) || + other.password == password) && + const DeepCollectionEquality().equals(other.roles, roles)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, username, name, password, + const DeepCollectionEquality().hash(roles)); + + @override + String toString() { + return 'CreateUserDto(username: $username, name: $name, password: $password, roles: $roles)'; + } +} + +/// @nodoc +abstract mixin class $CreateUserDtoCopyWith<$Res> { + factory $CreateUserDtoCopyWith( + CreateUserDto value, $Res Function(CreateUserDto) _then) = + _$CreateUserDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CreateUserDto.usernameKey_) String username, + @JsonKey(name: CreateUserDto.nameKey_) String name, + @JsonKey(name: CreateUserDto.passwordKey_) String password, + @JsonKey(name: CreateUserDto.rolesKey_) List roles}); +} + +/// @nodoc +class _$CreateUserDtoCopyWithImpl<$Res> + implements $CreateUserDtoCopyWith<$Res> { + _$CreateUserDtoCopyWithImpl(this._self, this._then); + + final CreateUserDto _self; + final $Res Function(CreateUserDto) _then; + + /// Create a copy of CreateUserDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? username = null, + Object? name = null, + Object? password = null, + Object? roles = null, + }) { + return _then(_self.copyWith( + username: null == username + ? _self.username + : username // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + password: null == password + ? _self.password + : password // ignore: cast_nullable_to_non_nullable + as String, + roles: null == roles + ? _self.roles + : roles // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [CreateUserDto]. +extension CreateUserDtoPatterns on CreateUserDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CreateUserDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateUserDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CreateUserDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CreateUserDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CreateUserDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CreateUserDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CreateUserDto.usernameKey_) String username, + @JsonKey(name: CreateUserDto.nameKey_) String name, + @JsonKey(name: CreateUserDto.passwordKey_) String password, + @JsonKey(name: CreateUserDto.rolesKey_) List roles)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CreateUserDto() when $default != null: + return $default( + _that.username, _that.name, _that.password, _that.roles); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CreateUserDto.usernameKey_) String username, + @JsonKey(name: CreateUserDto.nameKey_) String name, + @JsonKey(name: CreateUserDto.passwordKey_) String password, + @JsonKey(name: CreateUserDto.rolesKey_) List roles) + $default, + ) { + final _that = this; + switch (_that) { + case _CreateUserDto(): + return $default( + _that.username, _that.name, _that.password, _that.roles); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CreateUserDto.usernameKey_) String username, + @JsonKey(name: CreateUserDto.nameKey_) String name, + @JsonKey(name: CreateUserDto.passwordKey_) String password, + @JsonKey(name: CreateUserDto.rolesKey_) List roles)? + $default, + ) { + final _that = this; + switch (_that) { + case _CreateUserDto() when $default != null: + return $default( + _that.username, _that.name, _that.password, _that.roles); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CreateUserDto extends CreateUserDto { + const _CreateUserDto( + {@JsonKey(name: CreateUserDto.usernameKey_) required this.username, + @JsonKey(name: CreateUserDto.nameKey_) required this.name, + @JsonKey(name: CreateUserDto.passwordKey_) required this.password, + @JsonKey(name: CreateUserDto.rolesKey_) required final List roles}) + : _roles = roles, + super._(); + factory _CreateUserDto.fromJson(Map json) => + _$CreateUserDtoFromJson(json); + + /// username + @override + @JsonKey(name: CreateUserDto.usernameKey_) + final String username; + + /// name + @override + @JsonKey(name: CreateUserDto.nameKey_) + final String name; + + /// password + @override + @JsonKey(name: CreateUserDto.passwordKey_) + final String password; + + /// roles + final List _roles; + + /// roles + @override + @JsonKey(name: CreateUserDto.rolesKey_) + List get roles { + if (_roles is EqualUnmodifiableListView) return _roles; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_roles); + } + + /// Create a copy of CreateUserDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CreateUserDtoCopyWith<_CreateUserDto> get copyWith => + __$CreateUserDtoCopyWithImpl<_CreateUserDto>(this, _$identity); + + @override + Map toJson() { + return _$CreateUserDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CreateUserDto && + (identical(other.username, username) || + other.username == username) && + (identical(other.name, name) || other.name == name) && + (identical(other.password, password) || + other.password == password) && + const DeepCollectionEquality().equals(other._roles, _roles)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, username, name, password, + const DeepCollectionEquality().hash(_roles)); + + @override + String toString() { + return 'CreateUserDto(username: $username, name: $name, password: $password, roles: $roles)'; + } +} + +/// @nodoc +abstract mixin class _$CreateUserDtoCopyWith<$Res> + implements $CreateUserDtoCopyWith<$Res> { + factory _$CreateUserDtoCopyWith( + _CreateUserDto value, $Res Function(_CreateUserDto) _then) = + __$CreateUserDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CreateUserDto.usernameKey_) String username, + @JsonKey(name: CreateUserDto.nameKey_) String name, + @JsonKey(name: CreateUserDto.passwordKey_) String password, + @JsonKey(name: CreateUserDto.rolesKey_) List roles}); +} + +/// @nodoc +class __$CreateUserDtoCopyWithImpl<$Res> + implements _$CreateUserDtoCopyWith<$Res> { + __$CreateUserDtoCopyWithImpl(this._self, this._then); + + final _CreateUserDto _self; + final $Res Function(_CreateUserDto) _then; + + /// Create a copy of CreateUserDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? username = null, + Object? name = null, + Object? password = null, + Object? roles = null, + }) { + return _then(_CreateUserDto( + username: null == username + ? _self.username + : username // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + password: null == password + ? _self.password + : password // ignore: cast_nullable_to_non_nullable + as String, + roles: null == roles + ? _self._roles + : roles // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/create_user_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/create_user_dto.g.dart new file mode 100644 index 00000000..9ae54e3d --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/create_user_dto.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_user_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CreateUserDto _$CreateUserDtoFromJson(Map json) => + _CreateUserDto( + username: json['username'] as String, + name: json['name'] as String, + password: json['password'] as String, + roles: (json['roles'] as List) + .map((e) => Role.fromJson(e as String)) + .toList(), + ); + +Map _$CreateUserDtoToJson(_CreateUserDto instance) => + { + 'username': instance.username, + 'name': instance.name, + 'password': instance.password, + 'roles': instance.roles.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/credentials_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/credentials_dto.dart new file mode 100644 index 00000000..932bd99b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/credentials_dto.dart @@ -0,0 +1,64 @@ +/// CredentialsDto +/// { +/// "properties": { +/// "session_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "access_token": { +/// "type": "string" +/// }, +/// "refresh_token": { +/// "type": "string" +/// }, +/// "expires_at": { +/// "type": "string", +/// "format": "date-time" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "access_token", +/// "expires_at", +/// "refresh_token", +/// "session_id" +/// ], +/// "additionalProperties": false +/// } +library credentials_dto; + +import 'exports.dart'; +part 'credentials_dto.freezed.dart'; +part 'credentials_dto.g.dart'; // CredentialsDto + +@freezed +abstract class CredentialsDto with _$CredentialsDto { + const CredentialsDto._(); + + @jsonSerializable + const factory CredentialsDto({ + /// sessionId + @JsonKey(name: CredentialsDto.sessionIdKey_) required String sessionId, + + /// accessToken + @JsonKey(name: CredentialsDto.accessTokenKey_) required String accessToken, + + /// refreshToken + @JsonKey(name: CredentialsDto.refreshTokenKey_) + required String refreshToken, + + /// expiresAt + @JsonKey(name: CredentialsDto.expiresAtKey_) required DateTime expiresAt, + }) = _CredentialsDto; + + factory CredentialsDto.fromJson(Map json) => + _$CredentialsDtoFromJson(json); + + static const String sessionIdKey_ = r'session_id'; + + static const String accessTokenKey_ = r'access_token'; + + static const String refreshTokenKey_ = r'refresh_token'; + + static const String expiresAtKey_ = r'expires_at'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/credentials_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/credentials_dto.freezed.dart new file mode 100644 index 00000000..c27ce364 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/credentials_dto.freezed.dart @@ -0,0 +1,423 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'credentials_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CredentialsDto { + /// sessionId + @JsonKey(name: CredentialsDto.sessionIdKey_) + String get sessionId; + + /// accessToken + @JsonKey(name: CredentialsDto.accessTokenKey_) + String get accessToken; + + /// refreshToken + @JsonKey(name: CredentialsDto.refreshTokenKey_) + String get refreshToken; + + /// expiresAt + @JsonKey(name: CredentialsDto.expiresAtKey_) + DateTime get expiresAt; + + /// Create a copy of CredentialsDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CredentialsDtoCopyWith get copyWith => + _$CredentialsDtoCopyWithImpl( + this as CredentialsDto, _$identity); + + /// Serializes this CredentialsDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CredentialsDto && + (identical(other.sessionId, sessionId) || + other.sessionId == sessionId) && + (identical(other.accessToken, accessToken) || + other.accessToken == accessToken) && + (identical(other.refreshToken, refreshToken) || + other.refreshToken == refreshToken) && + (identical(other.expiresAt, expiresAt) || + other.expiresAt == expiresAt)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, sessionId, accessToken, refreshToken, expiresAt); + + @override + String toString() { + return 'CredentialsDto(sessionId: $sessionId, accessToken: $accessToken, refreshToken: $refreshToken, expiresAt: $expiresAt)'; + } +} + +/// @nodoc +abstract mixin class $CredentialsDtoCopyWith<$Res> { + factory $CredentialsDtoCopyWith( + CredentialsDto value, $Res Function(CredentialsDto) _then) = + _$CredentialsDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CredentialsDto.sessionIdKey_) String sessionId, + @JsonKey(name: CredentialsDto.accessTokenKey_) String accessToken, + @JsonKey(name: CredentialsDto.refreshTokenKey_) String refreshToken, + @JsonKey(name: CredentialsDto.expiresAtKey_) DateTime expiresAt}); +} + +/// @nodoc +class _$CredentialsDtoCopyWithImpl<$Res> + implements $CredentialsDtoCopyWith<$Res> { + _$CredentialsDtoCopyWithImpl(this._self, this._then); + + final CredentialsDto _self; + final $Res Function(CredentialsDto) _then; + + /// Create a copy of CredentialsDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? sessionId = null, + Object? accessToken = null, + Object? refreshToken = null, + Object? expiresAt = null, + }) { + return _then(_self.copyWith( + sessionId: null == sessionId + ? _self.sessionId + : sessionId // ignore: cast_nullable_to_non_nullable + as String, + accessToken: null == accessToken + ? _self.accessToken + : accessToken // ignore: cast_nullable_to_non_nullable + as String, + refreshToken: null == refreshToken + ? _self.refreshToken + : refreshToken // ignore: cast_nullable_to_non_nullable + as String, + expiresAt: null == expiresAt + ? _self.expiresAt + : expiresAt // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} + +/// Adds pattern-matching-related methods to [CredentialsDto]. +extension CredentialsDtoPatterns on CredentialsDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CredentialsDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CredentialsDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CredentialsDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CredentialsDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CredentialsDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CredentialsDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CredentialsDto.sessionIdKey_) String sessionId, + @JsonKey(name: CredentialsDto.accessTokenKey_) String accessToken, + @JsonKey(name: CredentialsDto.refreshTokenKey_) String refreshToken, + @JsonKey(name: CredentialsDto.expiresAtKey_) DateTime expiresAt)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CredentialsDto() when $default != null: + return $default(_that.sessionId, _that.accessToken, _that.refreshToken, + _that.expiresAt); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CredentialsDto.sessionIdKey_) String sessionId, + @JsonKey(name: CredentialsDto.accessTokenKey_) String accessToken, + @JsonKey(name: CredentialsDto.refreshTokenKey_) String refreshToken, + @JsonKey(name: CredentialsDto.expiresAtKey_) DateTime expiresAt) + $default, + ) { + final _that = this; + switch (_that) { + case _CredentialsDto(): + return $default(_that.sessionId, _that.accessToken, _that.refreshToken, + _that.expiresAt); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CredentialsDto.sessionIdKey_) String sessionId, + @JsonKey(name: CredentialsDto.accessTokenKey_) String accessToken, + @JsonKey(name: CredentialsDto.refreshTokenKey_) String refreshToken, + @JsonKey(name: CredentialsDto.expiresAtKey_) DateTime expiresAt)? + $default, + ) { + final _that = this; + switch (_that) { + case _CredentialsDto() when $default != null: + return $default(_that.sessionId, _that.accessToken, _that.refreshToken, + _that.expiresAt); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CredentialsDto extends CredentialsDto { + const _CredentialsDto( + {@JsonKey(name: CredentialsDto.sessionIdKey_) required this.sessionId, + @JsonKey(name: CredentialsDto.accessTokenKey_) required this.accessToken, + @JsonKey(name: CredentialsDto.refreshTokenKey_) + required this.refreshToken, + @JsonKey(name: CredentialsDto.expiresAtKey_) required this.expiresAt}) + : super._(); + factory _CredentialsDto.fromJson(Map json) => + _$CredentialsDtoFromJson(json); + + /// sessionId + @override + @JsonKey(name: CredentialsDto.sessionIdKey_) + final String sessionId; + + /// accessToken + @override + @JsonKey(name: CredentialsDto.accessTokenKey_) + final String accessToken; + + /// refreshToken + @override + @JsonKey(name: CredentialsDto.refreshTokenKey_) + final String refreshToken; + + /// expiresAt + @override + @JsonKey(name: CredentialsDto.expiresAtKey_) + final DateTime expiresAt; + + /// Create a copy of CredentialsDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CredentialsDtoCopyWith<_CredentialsDto> get copyWith => + __$CredentialsDtoCopyWithImpl<_CredentialsDto>(this, _$identity); + + @override + Map toJson() { + return _$CredentialsDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CredentialsDto && + (identical(other.sessionId, sessionId) || + other.sessionId == sessionId) && + (identical(other.accessToken, accessToken) || + other.accessToken == accessToken) && + (identical(other.refreshToken, refreshToken) || + other.refreshToken == refreshToken) && + (identical(other.expiresAt, expiresAt) || + other.expiresAt == expiresAt)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, sessionId, accessToken, refreshToken, expiresAt); + + @override + String toString() { + return 'CredentialsDto(sessionId: $sessionId, accessToken: $accessToken, refreshToken: $refreshToken, expiresAt: $expiresAt)'; + } +} + +/// @nodoc +abstract mixin class _$CredentialsDtoCopyWith<$Res> + implements $CredentialsDtoCopyWith<$Res> { + factory _$CredentialsDtoCopyWith( + _CredentialsDto value, $Res Function(_CredentialsDto) _then) = + __$CredentialsDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CredentialsDto.sessionIdKey_) String sessionId, + @JsonKey(name: CredentialsDto.accessTokenKey_) String accessToken, + @JsonKey(name: CredentialsDto.refreshTokenKey_) String refreshToken, + @JsonKey(name: CredentialsDto.expiresAtKey_) DateTime expiresAt}); +} + +/// @nodoc +class __$CredentialsDtoCopyWithImpl<$Res> + implements _$CredentialsDtoCopyWith<$Res> { + __$CredentialsDtoCopyWithImpl(this._self, this._then); + + final _CredentialsDto _self; + final $Res Function(_CredentialsDto) _then; + + /// Create a copy of CredentialsDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? sessionId = null, + Object? accessToken = null, + Object? refreshToken = null, + Object? expiresAt = null, + }) { + return _then(_CredentialsDto( + sessionId: null == sessionId + ? _self.sessionId + : sessionId // ignore: cast_nullable_to_non_nullable + as String, + accessToken: null == accessToken + ? _self.accessToken + : accessToken // ignore: cast_nullable_to_non_nullable + as String, + refreshToken: null == refreshToken + ? _self.refreshToken + : refreshToken // ignore: cast_nullable_to_non_nullable + as String, + expiresAt: null == expiresAt + ? _self.expiresAt + : expiresAt // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/credentials_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/credentials_dto.g.dart new file mode 100644 index 00000000..6f8c1590 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/credentials_dto.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'credentials_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CredentialsDto _$CredentialsDtoFromJson(Map json) => + _CredentialsDto( + sessionId: json['session_id'] as String, + accessToken: json['access_token'] as String, + refreshToken: json['refresh_token'] as String, + expiresAt: DateTime.parse(json['expires_at'] as String), + ); + +Map _$CredentialsDtoToJson(_CredentialsDto instance) => + { + 'session_id': instance.sessionId, + 'access_token': instance.accessToken, + 'refresh_token': instance.refreshToken, + 'expires_at': instance.expiresAt.toIso8601String(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_dto.dart new file mode 100644 index 00000000..3eacc5ce --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_dto.dart @@ -0,0 +1,102 @@ +/// CustomerAccountEntryDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "kind": { +/// "$ref": "#/components/schemas/CustomerAccountEntryKind" +/// }, +/// "notes": { +/// "type": "string", +/// "nullable": true +/// }, +/// "order": { +/// "oneOf": [ +/// { +/// "$ref": "#/components/schemas/CustomerAccountEntryOrderDetailsDto" +/// }, +/// { +/// "type": "null" +/// } +/// ] +/// }, +/// "amount": { +/// "type": "number", +/// "format": "double" +/// }, +/// "balance_after": { +/// "type": "number", +/// "format": "double" +/// }, +/// "created_at": { +/// "type": "string", +/// "format": "date-time" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "amount", +/// "balance_after", +/// "created_at", +/// "id", +/// "kind" +/// ], +/// "additionalProperties": false +/// } +library customer_account_entry_dto; + +import 'exports.dart'; +part 'customer_account_entry_dto.freezed.dart'; +part 'customer_account_entry_dto.g.dart'; // CustomerAccountEntryDto + +@freezed +abstract class CustomerAccountEntryDto with _$CustomerAccountEntryDto { + const CustomerAccountEntryDto._(); + + @jsonSerializable + const factory CustomerAccountEntryDto({ + /// id + @JsonKey(name: CustomerAccountEntryDto.idKey_) required String id, + + /// kind + @JsonKey(name: CustomerAccountEntryDto.kindKey_) + required CustomerAccountEntryKind kind, + + /// notes + @JsonKey(name: CustomerAccountEntryDto.notesKey_) String? notes, + + /// order + @JsonKey(name: CustomerAccountEntryDto.orderKey_) + CustomerAccountEntryOrderDetailsDto? order, + + /// amount + @JsonKey(name: CustomerAccountEntryDto.amountKey_) required double amount, + + /// balanceAfter + @JsonKey(name: CustomerAccountEntryDto.balanceAfterKey_) + required double balanceAfter, + + /// createdAt + @JsonKey(name: CustomerAccountEntryDto.createdAtKey_) + required DateTime createdAt, + }) = _CustomerAccountEntryDto; + + factory CustomerAccountEntryDto.fromJson(Map json) => + _$CustomerAccountEntryDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String kindKey_ = r'kind'; + + static const String notesKey_ = r'notes'; + + static const String orderKey_ = r'order'; + + static const String amountKey_ = r'amount'; + + static const String balanceAfterKey_ = r'balance_after'; + + static const String createdAtKey_ = r'created_at'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_dto.freezed.dart new file mode 100644 index 00000000..c2437093 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_dto.freezed.dart @@ -0,0 +1,557 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'customer_account_entry_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CustomerAccountEntryDto { + /// id + @JsonKey(name: CustomerAccountEntryDto.idKey_) + String get id; + + /// kind + @JsonKey(name: CustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind get kind; + + /// notes + @JsonKey(name: CustomerAccountEntryDto.notesKey_) + String? get notes; + + /// order + @JsonKey(name: CustomerAccountEntryDto.orderKey_) + CustomerAccountEntryOrderDetailsDto? get order; + + /// amount + @JsonKey(name: CustomerAccountEntryDto.amountKey_) + double get amount; + + /// balanceAfter + @JsonKey(name: CustomerAccountEntryDto.balanceAfterKey_) + double get balanceAfter; + + /// createdAt + @JsonKey(name: CustomerAccountEntryDto.createdAtKey_) + DateTime get createdAt; + + /// Create a copy of CustomerAccountEntryDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CustomerAccountEntryDtoCopyWith get copyWith => + _$CustomerAccountEntryDtoCopyWithImpl( + this as CustomerAccountEntryDto, _$identity); + + /// Serializes this CustomerAccountEntryDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CustomerAccountEntryDto && + (identical(other.id, id) || other.id == id) && + (identical(other.kind, kind) || other.kind == kind) && + (identical(other.notes, notes) || other.notes == notes) && + (identical(other.order, order) || other.order == order) && + (identical(other.amount, amount) || other.amount == amount) && + (identical(other.balanceAfter, balanceAfter) || + other.balanceAfter == balanceAfter) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, id, kind, notes, order, amount, balanceAfter, createdAt); + + @override + String toString() { + return 'CustomerAccountEntryDto(id: $id, kind: $kind, notes: $notes, order: $order, amount: $amount, balanceAfter: $balanceAfter, createdAt: $createdAt)'; + } +} + +/// @nodoc +abstract mixin class $CustomerAccountEntryDtoCopyWith<$Res> { + factory $CustomerAccountEntryDtoCopyWith(CustomerAccountEntryDto value, + $Res Function(CustomerAccountEntryDto) _then) = + _$CustomerAccountEntryDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CustomerAccountEntryDto.idKey_) String id, + @JsonKey(name: CustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind kind, + @JsonKey(name: CustomerAccountEntryDto.notesKey_) String? notes, + @JsonKey(name: CustomerAccountEntryDto.orderKey_) + CustomerAccountEntryOrderDetailsDto? order, + @JsonKey(name: CustomerAccountEntryDto.amountKey_) double amount, + @JsonKey(name: CustomerAccountEntryDto.balanceAfterKey_) + double balanceAfter, + @JsonKey(name: CustomerAccountEntryDto.createdAtKey_) + DateTime createdAt}); + + $CustomerAccountEntryOrderDetailsDtoCopyWith<$Res>? get order; +} + +/// @nodoc +class _$CustomerAccountEntryDtoCopyWithImpl<$Res> + implements $CustomerAccountEntryDtoCopyWith<$Res> { + _$CustomerAccountEntryDtoCopyWithImpl(this._self, this._then); + + final CustomerAccountEntryDto _self; + final $Res Function(CustomerAccountEntryDto) _then; + + /// Create a copy of CustomerAccountEntryDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? kind = null, + Object? notes = freezed, + Object? order = freezed, + Object? amount = null, + Object? balanceAfter = null, + Object? createdAt = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + kind: null == kind + ? _self.kind + : kind // ignore: cast_nullable_to_non_nullable + as CustomerAccountEntryKind, + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + order: freezed == order + ? _self.order + : order // ignore: cast_nullable_to_non_nullable + as CustomerAccountEntryOrderDetailsDto?, + amount: null == amount + ? _self.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + balanceAfter: null == balanceAfter + ? _self.balanceAfter + : balanceAfter // ignore: cast_nullable_to_non_nullable + as double, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } + + /// Create a copy of CustomerAccountEntryDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $CustomerAccountEntryOrderDetailsDtoCopyWith<$Res>? get order { + if (_self.order == null) { + return null; + } + + return $CustomerAccountEntryOrderDetailsDtoCopyWith<$Res>(_self.order!, + (value) { + return _then(_self.copyWith(order: value)); + }); + } +} + +/// Adds pattern-matching-related methods to [CustomerAccountEntryDto]. +extension CustomerAccountEntryDtoPatterns on CustomerAccountEntryDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CustomerAccountEntryDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CustomerAccountEntryDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CustomerAccountEntryDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CustomerAccountEntryDto.idKey_) String id, + @JsonKey(name: CustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind kind, + @JsonKey(name: CustomerAccountEntryDto.notesKey_) String? notes, + @JsonKey(name: CustomerAccountEntryDto.orderKey_) + CustomerAccountEntryOrderDetailsDto? order, + @JsonKey(name: CustomerAccountEntryDto.amountKey_) double amount, + @JsonKey(name: CustomerAccountEntryDto.balanceAfterKey_) + double balanceAfter, + @JsonKey(name: CustomerAccountEntryDto.createdAtKey_) + DateTime createdAt)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryDto() when $default != null: + return $default(_that.id, _that.kind, _that.notes, _that.order, + _that.amount, _that.balanceAfter, _that.createdAt); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CustomerAccountEntryDto.idKey_) String id, + @JsonKey(name: CustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind kind, + @JsonKey(name: CustomerAccountEntryDto.notesKey_) String? notes, + @JsonKey(name: CustomerAccountEntryDto.orderKey_) + CustomerAccountEntryOrderDetailsDto? order, + @JsonKey(name: CustomerAccountEntryDto.amountKey_) double amount, + @JsonKey(name: CustomerAccountEntryDto.balanceAfterKey_) + double balanceAfter, + @JsonKey(name: CustomerAccountEntryDto.createdAtKey_) + DateTime createdAt) + $default, + ) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryDto(): + return $default(_that.id, _that.kind, _that.notes, _that.order, + _that.amount, _that.balanceAfter, _that.createdAt); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CustomerAccountEntryDto.idKey_) String id, + @JsonKey(name: CustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind kind, + @JsonKey(name: CustomerAccountEntryDto.notesKey_) String? notes, + @JsonKey(name: CustomerAccountEntryDto.orderKey_) + CustomerAccountEntryOrderDetailsDto? order, + @JsonKey(name: CustomerAccountEntryDto.amountKey_) double amount, + @JsonKey(name: CustomerAccountEntryDto.balanceAfterKey_) + double balanceAfter, + @JsonKey(name: CustomerAccountEntryDto.createdAtKey_) + DateTime createdAt)? + $default, + ) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryDto() when $default != null: + return $default(_that.id, _that.kind, _that.notes, _that.order, + _that.amount, _that.balanceAfter, _that.createdAt); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CustomerAccountEntryDto extends CustomerAccountEntryDto { + const _CustomerAccountEntryDto( + {@JsonKey(name: CustomerAccountEntryDto.idKey_) required this.id, + @JsonKey(name: CustomerAccountEntryDto.kindKey_) required this.kind, + @JsonKey(name: CustomerAccountEntryDto.notesKey_) this.notes, + @JsonKey(name: CustomerAccountEntryDto.orderKey_) this.order, + @JsonKey(name: CustomerAccountEntryDto.amountKey_) required this.amount, + @JsonKey(name: CustomerAccountEntryDto.balanceAfterKey_) + required this.balanceAfter, + @JsonKey(name: CustomerAccountEntryDto.createdAtKey_) + required this.createdAt}) + : super._(); + factory _CustomerAccountEntryDto.fromJson(Map json) => + _$CustomerAccountEntryDtoFromJson(json); + + /// id + @override + @JsonKey(name: CustomerAccountEntryDto.idKey_) + final String id; + + /// kind + @override + @JsonKey(name: CustomerAccountEntryDto.kindKey_) + final CustomerAccountEntryKind kind; + + /// notes + @override + @JsonKey(name: CustomerAccountEntryDto.notesKey_) + final String? notes; + + /// order + @override + @JsonKey(name: CustomerAccountEntryDto.orderKey_) + final CustomerAccountEntryOrderDetailsDto? order; + + /// amount + @override + @JsonKey(name: CustomerAccountEntryDto.amountKey_) + final double amount; + + /// balanceAfter + @override + @JsonKey(name: CustomerAccountEntryDto.balanceAfterKey_) + final double balanceAfter; + + /// createdAt + @override + @JsonKey(name: CustomerAccountEntryDto.createdAtKey_) + final DateTime createdAt; + + /// Create a copy of CustomerAccountEntryDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CustomerAccountEntryDtoCopyWith<_CustomerAccountEntryDto> get copyWith => + __$CustomerAccountEntryDtoCopyWithImpl<_CustomerAccountEntryDto>( + this, _$identity); + + @override + Map toJson() { + return _$CustomerAccountEntryDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CustomerAccountEntryDto && + (identical(other.id, id) || other.id == id) && + (identical(other.kind, kind) || other.kind == kind) && + (identical(other.notes, notes) || other.notes == notes) && + (identical(other.order, order) || other.order == order) && + (identical(other.amount, amount) || other.amount == amount) && + (identical(other.balanceAfter, balanceAfter) || + other.balanceAfter == balanceAfter) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, id, kind, notes, order, amount, balanceAfter, createdAt); + + @override + String toString() { + return 'CustomerAccountEntryDto(id: $id, kind: $kind, notes: $notes, order: $order, amount: $amount, balanceAfter: $balanceAfter, createdAt: $createdAt)'; + } +} + +/// @nodoc +abstract mixin class _$CustomerAccountEntryDtoCopyWith<$Res> + implements $CustomerAccountEntryDtoCopyWith<$Res> { + factory _$CustomerAccountEntryDtoCopyWith(_CustomerAccountEntryDto value, + $Res Function(_CustomerAccountEntryDto) _then) = + __$CustomerAccountEntryDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CustomerAccountEntryDto.idKey_) String id, + @JsonKey(name: CustomerAccountEntryDto.kindKey_) + CustomerAccountEntryKind kind, + @JsonKey(name: CustomerAccountEntryDto.notesKey_) String? notes, + @JsonKey(name: CustomerAccountEntryDto.orderKey_) + CustomerAccountEntryOrderDetailsDto? order, + @JsonKey(name: CustomerAccountEntryDto.amountKey_) double amount, + @JsonKey(name: CustomerAccountEntryDto.balanceAfterKey_) + double balanceAfter, + @JsonKey(name: CustomerAccountEntryDto.createdAtKey_) + DateTime createdAt}); + + @override + $CustomerAccountEntryOrderDetailsDtoCopyWith<$Res>? get order; +} + +/// @nodoc +class __$CustomerAccountEntryDtoCopyWithImpl<$Res> + implements _$CustomerAccountEntryDtoCopyWith<$Res> { + __$CustomerAccountEntryDtoCopyWithImpl(this._self, this._then); + + final _CustomerAccountEntryDto _self; + final $Res Function(_CustomerAccountEntryDto) _then; + + /// Create a copy of CustomerAccountEntryDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? kind = null, + Object? notes = freezed, + Object? order = freezed, + Object? amount = null, + Object? balanceAfter = null, + Object? createdAt = null, + }) { + return _then(_CustomerAccountEntryDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + kind: null == kind + ? _self.kind + : kind // ignore: cast_nullable_to_non_nullable + as CustomerAccountEntryKind, + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + order: freezed == order + ? _self.order + : order // ignore: cast_nullable_to_non_nullable + as CustomerAccountEntryOrderDetailsDto?, + amount: null == amount + ? _self.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + balanceAfter: null == balanceAfter + ? _self.balanceAfter + : balanceAfter // ignore: cast_nullable_to_non_nullable + as double, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } + + /// Create a copy of CustomerAccountEntryDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $CustomerAccountEntryOrderDetailsDtoCopyWith<$Res>? get order { + if (_self.order == null) { + return null; + } + + return $CustomerAccountEntryOrderDetailsDtoCopyWith<$Res>(_self.order!, + (value) { + return _then(_self.copyWith(order: value)); + }); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_dto.g.dart new file mode 100644 index 00000000..41fce2c5 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_dto.g.dart @@ -0,0 +1,34 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'customer_account_entry_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CustomerAccountEntryDto _$CustomerAccountEntryDtoFromJson( + Map json) => + _CustomerAccountEntryDto( + id: json['id'] as String, + kind: CustomerAccountEntryKind.fromJson(json['kind'] as String), + notes: json['notes'] as String?, + order: json['order'] == null + ? null + : CustomerAccountEntryOrderDetailsDto.fromJson( + json['order'] as Map), + amount: (json['amount'] as num).toDouble(), + balanceAfter: (json['balance_after'] as num).toDouble(), + createdAt: DateTime.parse(json['created_at'] as String), + ); + +Map _$CustomerAccountEntryDtoToJson( + _CustomerAccountEntryDto instance) => + { + 'id': instance.id, + 'kind': instance.kind.toJson(), + if (instance.notes case final value?) 'notes': value, + if (instance.order?.toJson() case final value?) 'order': value, + 'amount': instance.amount, + 'balance_after': instance.balanceAfter, + 'created_at': instance.createdAt.toIso8601String(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_kind.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_kind.dart new file mode 100644 index 00000000..65e7760a --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_kind.dart @@ -0,0 +1,38 @@ +// CustomerAccountEntryKind +// { +// "type": "string", +// "enum": [ +// "sale", +// "payment", +// "creditNote", +// "debitNote", +// "other" +// ] +// } + +library customer_account_entry_kind; + +import 'exports.dart'; +part 'customer_account_entry_kind.g.dart'; + +@JsonEnum(alwaysCreate: true) +enum CustomerAccountEntryKind { + @JsonValue("sale") + sale, + @JsonValue("payment") + payment, + @JsonValue("creditNote") + creditNote, + @JsonValue("debitNote") + debitNote, + @JsonValue("other") + other; + + factory CustomerAccountEntryKind.fromJson(String json) => + CustomerAccountEntryKind.values.firstWhere( + (e) => e.toJson() == json, + orElse: () => CustomerAccountEntryKind.values.first, + ); + + String toJson() => _$CustomerAccountEntryKindEnumMap[this]!; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_kind.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_kind.g.dart new file mode 100644 index 00000000..7aee1378 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_kind.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'customer_account_entry_kind.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +const _$CustomerAccountEntryKindEnumMap = { + CustomerAccountEntryKind.sale: 'sale', + CustomerAccountEntryKind.payment: 'payment', + CustomerAccountEntryKind.creditNote: 'creditNote', + CustomerAccountEntryKind.debitNote: 'debitNote', + CustomerAccountEntryKind.other: 'other', +}; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_order_details_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_order_details_dto.dart new file mode 100644 index 00000000..fc715657 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_order_details_dto.dart @@ -0,0 +1,71 @@ +/// CustomerAccountEntryOrderDetailsDto +/// { +/// "properties": { +/// "order_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "order_number": { +/// "type": "integer", +/// "format": "int32" +/// }, +/// "amount": { +/// "type": "number", +/// "format": "double" +/// }, +/// "date": { +/// "type": "string", +/// "format": "date-time" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "amount", +/// "date", +/// "order_id", +/// "order_number" +/// ], +/// "additionalProperties": false +/// } +library customer_account_entry_order_details_dto; + +import 'exports.dart'; +part 'customer_account_entry_order_details_dto.freezed.dart'; +part 'customer_account_entry_order_details_dto.g.dart'; // CustomerAccountEntryOrderDetailsDto + +@freezed +abstract class CustomerAccountEntryOrderDetailsDto + with _$CustomerAccountEntryOrderDetailsDto { + const CustomerAccountEntryOrderDetailsDto._(); + + @jsonSerializable + const factory CustomerAccountEntryOrderDetailsDto({ + /// orderId + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderIdKey_) + required String orderId, + + /// orderNumber + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderNumberKey_) + required int orderNumber, + + /// amount + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.amountKey_) + required double amount, + + /// date + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.dateKey_) + required DateTime date, + }) = _CustomerAccountEntryOrderDetailsDto; + + factory CustomerAccountEntryOrderDetailsDto.fromJson( + Map json, + ) => _$CustomerAccountEntryOrderDetailsDtoFromJson(json); + + static const String orderIdKey_ = r'order_id'; + + static const String orderNumberKey_ = r'order_number'; + + static const String amountKey_ = r'amount'; + + static const String dateKey_ = r'date'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_order_details_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_order_details_dto.freezed.dart new file mode 100644 index 00000000..9582bc72 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_order_details_dto.freezed.dart @@ -0,0 +1,449 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'customer_account_entry_order_details_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CustomerAccountEntryOrderDetailsDto { + /// orderId + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderIdKey_) + String get orderId; + + /// orderNumber + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderNumberKey_) + int get orderNumber; + + /// amount + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.amountKey_) + double get amount; + + /// date + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.dateKey_) + DateTime get date; + + /// Create a copy of CustomerAccountEntryOrderDetailsDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CustomerAccountEntryOrderDetailsDtoCopyWith< + CustomerAccountEntryOrderDetailsDto> + get copyWith => _$CustomerAccountEntryOrderDetailsDtoCopyWithImpl< + CustomerAccountEntryOrderDetailsDto>( + this as CustomerAccountEntryOrderDetailsDto, _$identity); + + /// Serializes this CustomerAccountEntryOrderDetailsDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CustomerAccountEntryOrderDetailsDto && + (identical(other.orderId, orderId) || other.orderId == orderId) && + (identical(other.orderNumber, orderNumber) || + other.orderNumber == orderNumber) && + (identical(other.amount, amount) || other.amount == amount) && + (identical(other.date, date) || other.date == date)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, orderId, orderNumber, amount, date); + + @override + String toString() { + return 'CustomerAccountEntryOrderDetailsDto(orderId: $orderId, orderNumber: $orderNumber, amount: $amount, date: $date)'; + } +} + +/// @nodoc +abstract mixin class $CustomerAccountEntryOrderDetailsDtoCopyWith<$Res> { + factory $CustomerAccountEntryOrderDetailsDtoCopyWith( + CustomerAccountEntryOrderDetailsDto value, + $Res Function(CustomerAccountEntryOrderDetailsDto) _then) = + _$CustomerAccountEntryOrderDetailsDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderIdKey_) + String orderId, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderNumberKey_) + int orderNumber, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.amountKey_) + double amount, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.dateKey_) + DateTime date}); +} + +/// @nodoc +class _$CustomerAccountEntryOrderDetailsDtoCopyWithImpl<$Res> + implements $CustomerAccountEntryOrderDetailsDtoCopyWith<$Res> { + _$CustomerAccountEntryOrderDetailsDtoCopyWithImpl(this._self, this._then); + + final CustomerAccountEntryOrderDetailsDto _self; + final $Res Function(CustomerAccountEntryOrderDetailsDto) _then; + + /// Create a copy of CustomerAccountEntryOrderDetailsDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? orderId = null, + Object? orderNumber = null, + Object? amount = null, + Object? date = null, + }) { + return _then(_self.copyWith( + orderId: null == orderId + ? _self.orderId + : orderId // ignore: cast_nullable_to_non_nullable + as String, + orderNumber: null == orderNumber + ? _self.orderNumber + : orderNumber // ignore: cast_nullable_to_non_nullable + as int, + amount: null == amount + ? _self.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + date: null == date + ? _self.date + : date // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} + +/// Adds pattern-matching-related methods to [CustomerAccountEntryOrderDetailsDto]. +extension CustomerAccountEntryOrderDetailsDtoPatterns + on CustomerAccountEntryOrderDetailsDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CustomerAccountEntryOrderDetailsDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryOrderDetailsDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CustomerAccountEntryOrderDetailsDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryOrderDetailsDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CustomerAccountEntryOrderDetailsDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryOrderDetailsDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderIdKey_) + String orderId, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderNumberKey_) + int orderNumber, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.amountKey_) + double amount, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.dateKey_) + DateTime date)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryOrderDetailsDto() when $default != null: + return $default( + _that.orderId, _that.orderNumber, _that.amount, _that.date); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderIdKey_) + String orderId, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderNumberKey_) + int orderNumber, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.amountKey_) + double amount, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.dateKey_) + DateTime date) + $default, + ) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryOrderDetailsDto(): + return $default( + _that.orderId, _that.orderNumber, _that.amount, _that.date); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderIdKey_) + String orderId, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderNumberKey_) + int orderNumber, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.amountKey_) + double amount, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.dateKey_) + DateTime date)? + $default, + ) { + final _that = this; + switch (_that) { + case _CustomerAccountEntryOrderDetailsDto() when $default != null: + return $default( + _that.orderId, _that.orderNumber, _that.amount, _that.date); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CustomerAccountEntryOrderDetailsDto + extends CustomerAccountEntryOrderDetailsDto { + const _CustomerAccountEntryOrderDetailsDto( + {@JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderIdKey_) + required this.orderId, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderNumberKey_) + required this.orderNumber, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.amountKey_) + required this.amount, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.dateKey_) + required this.date}) + : super._(); + factory _CustomerAccountEntryOrderDetailsDto.fromJson( + Map json) => + _$CustomerAccountEntryOrderDetailsDtoFromJson(json); + + /// orderId + @override + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderIdKey_) + final String orderId; + + /// orderNumber + @override + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderNumberKey_) + final int orderNumber; + + /// amount + @override + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.amountKey_) + final double amount; + + /// date + @override + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.dateKey_) + final DateTime date; + + /// Create a copy of CustomerAccountEntryOrderDetailsDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CustomerAccountEntryOrderDetailsDtoCopyWith< + _CustomerAccountEntryOrderDetailsDto> + get copyWith => __$CustomerAccountEntryOrderDetailsDtoCopyWithImpl< + _CustomerAccountEntryOrderDetailsDto>(this, _$identity); + + @override + Map toJson() { + return _$CustomerAccountEntryOrderDetailsDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CustomerAccountEntryOrderDetailsDto && + (identical(other.orderId, orderId) || other.orderId == orderId) && + (identical(other.orderNumber, orderNumber) || + other.orderNumber == orderNumber) && + (identical(other.amount, amount) || other.amount == amount) && + (identical(other.date, date) || other.date == date)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, orderId, orderNumber, amount, date); + + @override + String toString() { + return 'CustomerAccountEntryOrderDetailsDto(orderId: $orderId, orderNumber: $orderNumber, amount: $amount, date: $date)'; + } +} + +/// @nodoc +abstract mixin class _$CustomerAccountEntryOrderDetailsDtoCopyWith<$Res> + implements $CustomerAccountEntryOrderDetailsDtoCopyWith<$Res> { + factory _$CustomerAccountEntryOrderDetailsDtoCopyWith( + _CustomerAccountEntryOrderDetailsDto value, + $Res Function(_CustomerAccountEntryOrderDetailsDto) _then) = + __$CustomerAccountEntryOrderDetailsDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderIdKey_) + String orderId, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.orderNumberKey_) + int orderNumber, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.amountKey_) + double amount, + @JsonKey(name: CustomerAccountEntryOrderDetailsDto.dateKey_) + DateTime date}); +} + +/// @nodoc +class __$CustomerAccountEntryOrderDetailsDtoCopyWithImpl<$Res> + implements _$CustomerAccountEntryOrderDetailsDtoCopyWith<$Res> { + __$CustomerAccountEntryOrderDetailsDtoCopyWithImpl(this._self, this._then); + + final _CustomerAccountEntryOrderDetailsDto _self; + final $Res Function(_CustomerAccountEntryOrderDetailsDto) _then; + + /// Create a copy of CustomerAccountEntryOrderDetailsDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? orderId = null, + Object? orderNumber = null, + Object? amount = null, + Object? date = null, + }) { + return _then(_CustomerAccountEntryOrderDetailsDto( + orderId: null == orderId + ? _self.orderId + : orderId // ignore: cast_nullable_to_non_nullable + as String, + orderNumber: null == orderNumber + ? _self.orderNumber + : orderNumber // ignore: cast_nullable_to_non_nullable + as int, + amount: null == amount + ? _self.amount + : amount // ignore: cast_nullable_to_non_nullable + as double, + date: null == date + ? _self.date + : date // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_order_details_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_order_details_dto.g.dart new file mode 100644 index 00000000..fcd943bb --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customer_account_entry_order_details_dto.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'customer_account_entry_order_details_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CustomerAccountEntryOrderDetailsDto + _$CustomerAccountEntryOrderDetailsDtoFromJson(Map json) => + _CustomerAccountEntryOrderDetailsDto( + orderId: json['order_id'] as String, + orderNumber: (json['order_number'] as num).toInt(), + amount: (json['amount'] as num).toDouble(), + date: DateTime.parse(json['date'] as String), + ); + +Map _$CustomerAccountEntryOrderDetailsDtoToJson( + _CustomerAccountEntryOrderDetailsDto instance) => + { + 'order_id': instance.orderId, + 'order_number': instance.orderNumber, + 'amount': instance.amount, + 'date': instance.date.toIso8601String(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customer_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customer_dto.dart new file mode 100644 index 00000000..55fc95aa --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customer_dto.dart @@ -0,0 +1,103 @@ +/// CustomerDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "name": { +/// "type": "string" +/// }, +/// "cuit": { +/// "type": "string", +/// "nullable": true +/// }, +/// "address": { +/// "type": "string", +/// "nullable": true +/// }, +/// "require_full_payment_on_close": { +/// "type": "boolean" +/// }, +/// "balance": { +/// "type": "number", +/// "format": "double" +/// }, +/// "created_at": { +/// "type": "string", +/// "format": "date-time" +/// }, +/// "modified_at": { +/// "type": "string", +/// "format": "date-time" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "balance", +/// "created_at", +/// "id", +/// "modified_at", +/// "name", +/// "require_full_payment_on_close" +/// ], +/// "additionalProperties": false +/// } +library customer_dto; + +import 'exports.dart'; +part 'customer_dto.freezed.dart'; +part 'customer_dto.g.dart'; // CustomerDto + +@freezed +abstract class CustomerDto with _$CustomerDto { + const CustomerDto._(); + + @jsonSerializable + const factory CustomerDto({ + /// id + @JsonKey(name: CustomerDto.idKey_) required String id, + + /// name + @JsonKey(name: CustomerDto.nameKey_) required String name, + + /// cuit + @JsonKey(name: CustomerDto.cuitKey_) String? cuit, + + /// address + @JsonKey(name: CustomerDto.addressKey_) String? address, + + /// requireFullPaymentOnClose + @JsonKey(name: CustomerDto.requireFullPaymentOnCloseKey_) + required bool requireFullPaymentOnClose, + + /// balance + @JsonKey(name: CustomerDto.balanceKey_) required double balance, + + /// createdAt + @JsonKey(name: CustomerDto.createdAtKey_) required DateTime createdAt, + + /// modifiedAt + @JsonKey(name: CustomerDto.modifiedAtKey_) required DateTime modifiedAt, + }) = _CustomerDto; + + factory CustomerDto.fromJson(Map json) => + _$CustomerDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; + + static const String cuitKey_ = r'cuit'; + + static const String addressKey_ = r'address'; + + static const String requireFullPaymentOnCloseKey_ = + r'require_full_payment_on_close'; + + static const String balanceKey_ = r'balance'; + + static const String createdAtKey_ = r'created_at'; + + static const String modifiedAtKey_ = r'modified_at'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customer_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customer_dto.freezed.dart new file mode 100644 index 00000000..06e904c9 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customer_dto.freezed.dart @@ -0,0 +1,554 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'customer_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CustomerDto { + /// id + @JsonKey(name: CustomerDto.idKey_) + String get id; + + /// name + @JsonKey(name: CustomerDto.nameKey_) + String get name; + + /// cuit + @JsonKey(name: CustomerDto.cuitKey_) + String? get cuit; + + /// address + @JsonKey(name: CustomerDto.addressKey_) + String? get address; + + /// requireFullPaymentOnClose + @JsonKey(name: CustomerDto.requireFullPaymentOnCloseKey_) + bool get requireFullPaymentOnClose; + + /// balance + @JsonKey(name: CustomerDto.balanceKey_) + double get balance; + + /// createdAt + @JsonKey(name: CustomerDto.createdAtKey_) + DateTime get createdAt; + + /// modifiedAt + @JsonKey(name: CustomerDto.modifiedAtKey_) + DateTime get modifiedAt; + + /// Create a copy of CustomerDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CustomerDtoCopyWith get copyWith => + _$CustomerDtoCopyWithImpl(this as CustomerDto, _$identity); + + /// Serializes this CustomerDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CustomerDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.cuit, cuit) || other.cuit == cuit) && + (identical(other.address, address) || other.address == address) && + (identical(other.requireFullPaymentOnClose, + requireFullPaymentOnClose) || + other.requireFullPaymentOnClose == requireFullPaymentOnClose) && + (identical(other.balance, balance) || other.balance == balance) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.modifiedAt, modifiedAt) || + other.modifiedAt == modifiedAt)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, cuit, address, + requireFullPaymentOnClose, balance, createdAt, modifiedAt); + + @override + String toString() { + return 'CustomerDto(id: $id, name: $name, cuit: $cuit, address: $address, requireFullPaymentOnClose: $requireFullPaymentOnClose, balance: $balance, createdAt: $createdAt, modifiedAt: $modifiedAt)'; + } +} + +/// @nodoc +abstract mixin class $CustomerDtoCopyWith<$Res> { + factory $CustomerDtoCopyWith( + CustomerDto value, $Res Function(CustomerDto) _then) = + _$CustomerDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CustomerDto.idKey_) String id, + @JsonKey(name: CustomerDto.nameKey_) String name, + @JsonKey(name: CustomerDto.cuitKey_) String? cuit, + @JsonKey(name: CustomerDto.addressKey_) String? address, + @JsonKey(name: CustomerDto.requireFullPaymentOnCloseKey_) + bool requireFullPaymentOnClose, + @JsonKey(name: CustomerDto.balanceKey_) double balance, + @JsonKey(name: CustomerDto.createdAtKey_) DateTime createdAt, + @JsonKey(name: CustomerDto.modifiedAtKey_) DateTime modifiedAt}); +} + +/// @nodoc +class _$CustomerDtoCopyWithImpl<$Res> implements $CustomerDtoCopyWith<$Res> { + _$CustomerDtoCopyWithImpl(this._self, this._then); + + final CustomerDto _self; + final $Res Function(CustomerDto) _then; + + /// Create a copy of CustomerDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + Object? cuit = freezed, + Object? address = freezed, + Object? requireFullPaymentOnClose = null, + Object? balance = null, + Object? createdAt = null, + Object? modifiedAt = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + cuit: freezed == cuit + ? _self.cuit + : cuit // ignore: cast_nullable_to_non_nullable + as String?, + address: freezed == address + ? _self.address + : address // ignore: cast_nullable_to_non_nullable + as String?, + requireFullPaymentOnClose: null == requireFullPaymentOnClose + ? _self.requireFullPaymentOnClose + : requireFullPaymentOnClose // ignore: cast_nullable_to_non_nullable + as bool, + balance: null == balance + ? _self.balance + : balance // ignore: cast_nullable_to_non_nullable + as double, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + modifiedAt: null == modifiedAt + ? _self.modifiedAt + : modifiedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} + +/// Adds pattern-matching-related methods to [CustomerDto]. +extension CustomerDtoPatterns on CustomerDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CustomerDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CustomerDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CustomerDto value) $default, + ) { + final _that = this; + switch (_that) { + case _CustomerDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CustomerDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _CustomerDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CustomerDto.idKey_) String id, + @JsonKey(name: CustomerDto.nameKey_) String name, + @JsonKey(name: CustomerDto.cuitKey_) String? cuit, + @JsonKey(name: CustomerDto.addressKey_) String? address, + @JsonKey(name: CustomerDto.requireFullPaymentOnCloseKey_) + bool requireFullPaymentOnClose, + @JsonKey(name: CustomerDto.balanceKey_) double balance, + @JsonKey(name: CustomerDto.createdAtKey_) DateTime createdAt, + @JsonKey(name: CustomerDto.modifiedAtKey_) DateTime modifiedAt)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CustomerDto() when $default != null: + return $default( + _that.id, + _that.name, + _that.cuit, + _that.address, + _that.requireFullPaymentOnClose, + _that.balance, + _that.createdAt, + _that.modifiedAt); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CustomerDto.idKey_) String id, + @JsonKey(name: CustomerDto.nameKey_) String name, + @JsonKey(name: CustomerDto.cuitKey_) String? cuit, + @JsonKey(name: CustomerDto.addressKey_) String? address, + @JsonKey(name: CustomerDto.requireFullPaymentOnCloseKey_) + bool requireFullPaymentOnClose, + @JsonKey(name: CustomerDto.balanceKey_) double balance, + @JsonKey(name: CustomerDto.createdAtKey_) DateTime createdAt, + @JsonKey(name: CustomerDto.modifiedAtKey_) DateTime modifiedAt) + $default, + ) { + final _that = this; + switch (_that) { + case _CustomerDto(): + return $default( + _that.id, + _that.name, + _that.cuit, + _that.address, + _that.requireFullPaymentOnClose, + _that.balance, + _that.createdAt, + _that.modifiedAt); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CustomerDto.idKey_) String id, + @JsonKey(name: CustomerDto.nameKey_) String name, + @JsonKey(name: CustomerDto.cuitKey_) String? cuit, + @JsonKey(name: CustomerDto.addressKey_) String? address, + @JsonKey(name: CustomerDto.requireFullPaymentOnCloseKey_) + bool requireFullPaymentOnClose, + @JsonKey(name: CustomerDto.balanceKey_) double balance, + @JsonKey(name: CustomerDto.createdAtKey_) DateTime createdAt, + @JsonKey(name: CustomerDto.modifiedAtKey_) DateTime modifiedAt)? + $default, + ) { + final _that = this; + switch (_that) { + case _CustomerDto() when $default != null: + return $default( + _that.id, + _that.name, + _that.cuit, + _that.address, + _that.requireFullPaymentOnClose, + _that.balance, + _that.createdAt, + _that.modifiedAt); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CustomerDto extends CustomerDto { + const _CustomerDto( + {@JsonKey(name: CustomerDto.idKey_) required this.id, + @JsonKey(name: CustomerDto.nameKey_) required this.name, + @JsonKey(name: CustomerDto.cuitKey_) this.cuit, + @JsonKey(name: CustomerDto.addressKey_) this.address, + @JsonKey(name: CustomerDto.requireFullPaymentOnCloseKey_) + required this.requireFullPaymentOnClose, + @JsonKey(name: CustomerDto.balanceKey_) required this.balance, + @JsonKey(name: CustomerDto.createdAtKey_) required this.createdAt, + @JsonKey(name: CustomerDto.modifiedAtKey_) required this.modifiedAt}) + : super._(); + factory _CustomerDto.fromJson(Map json) => + _$CustomerDtoFromJson(json); + + /// id + @override + @JsonKey(name: CustomerDto.idKey_) + final String id; + + /// name + @override + @JsonKey(name: CustomerDto.nameKey_) + final String name; + + /// cuit + @override + @JsonKey(name: CustomerDto.cuitKey_) + final String? cuit; + + /// address + @override + @JsonKey(name: CustomerDto.addressKey_) + final String? address; + + /// requireFullPaymentOnClose + @override + @JsonKey(name: CustomerDto.requireFullPaymentOnCloseKey_) + final bool requireFullPaymentOnClose; + + /// balance + @override + @JsonKey(name: CustomerDto.balanceKey_) + final double balance; + + /// createdAt + @override + @JsonKey(name: CustomerDto.createdAtKey_) + final DateTime createdAt; + + /// modifiedAt + @override + @JsonKey(name: CustomerDto.modifiedAtKey_) + final DateTime modifiedAt; + + /// Create a copy of CustomerDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CustomerDtoCopyWith<_CustomerDto> get copyWith => + __$CustomerDtoCopyWithImpl<_CustomerDto>(this, _$identity); + + @override + Map toJson() { + return _$CustomerDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CustomerDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.cuit, cuit) || other.cuit == cuit) && + (identical(other.address, address) || other.address == address) && + (identical(other.requireFullPaymentOnClose, + requireFullPaymentOnClose) || + other.requireFullPaymentOnClose == requireFullPaymentOnClose) && + (identical(other.balance, balance) || other.balance == balance) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.modifiedAt, modifiedAt) || + other.modifiedAt == modifiedAt)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, cuit, address, + requireFullPaymentOnClose, balance, createdAt, modifiedAt); + + @override + String toString() { + return 'CustomerDto(id: $id, name: $name, cuit: $cuit, address: $address, requireFullPaymentOnClose: $requireFullPaymentOnClose, balance: $balance, createdAt: $createdAt, modifiedAt: $modifiedAt)'; + } +} + +/// @nodoc +abstract mixin class _$CustomerDtoCopyWith<$Res> + implements $CustomerDtoCopyWith<$Res> { + factory _$CustomerDtoCopyWith( + _CustomerDto value, $Res Function(_CustomerDto) _then) = + __$CustomerDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CustomerDto.idKey_) String id, + @JsonKey(name: CustomerDto.nameKey_) String name, + @JsonKey(name: CustomerDto.cuitKey_) String? cuit, + @JsonKey(name: CustomerDto.addressKey_) String? address, + @JsonKey(name: CustomerDto.requireFullPaymentOnCloseKey_) + bool requireFullPaymentOnClose, + @JsonKey(name: CustomerDto.balanceKey_) double balance, + @JsonKey(name: CustomerDto.createdAtKey_) DateTime createdAt, + @JsonKey(name: CustomerDto.modifiedAtKey_) DateTime modifiedAt}); +} + +/// @nodoc +class __$CustomerDtoCopyWithImpl<$Res> implements _$CustomerDtoCopyWith<$Res> { + __$CustomerDtoCopyWithImpl(this._self, this._then); + + final _CustomerDto _self; + final $Res Function(_CustomerDto) _then; + + /// Create a copy of CustomerDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? name = null, + Object? cuit = freezed, + Object? address = freezed, + Object? requireFullPaymentOnClose = null, + Object? balance = null, + Object? createdAt = null, + Object? modifiedAt = null, + }) { + return _then(_CustomerDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + cuit: freezed == cuit + ? _self.cuit + : cuit // ignore: cast_nullable_to_non_nullable + as String?, + address: freezed == address + ? _self.address + : address // ignore: cast_nullable_to_non_nullable + as String?, + requireFullPaymentOnClose: null == requireFullPaymentOnClose + ? _self.requireFullPaymentOnClose + : requireFullPaymentOnClose // ignore: cast_nullable_to_non_nullable + as bool, + balance: null == balance + ? _self.balance + : balance // ignore: cast_nullable_to_non_nullable + as double, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + modifiedAt: null == modifiedAt + ? _self.modifiedAt + : modifiedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customer_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customer_dto.g.dart new file mode 100644 index 00000000..2a87acd8 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customer_dto.g.dart @@ -0,0 +1,30 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'customer_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CustomerDto _$CustomerDtoFromJson(Map json) => _CustomerDto( + id: json['id'] as String, + name: json['name'] as String, + cuit: json['cuit'] as String?, + address: json['address'] as String?, + requireFullPaymentOnClose: json['require_full_payment_on_close'] as bool, + balance: (json['balance'] as num).toDouble(), + createdAt: DateTime.parse(json['created_at'] as String), + modifiedAt: DateTime.parse(json['modified_at'] as String), + ); + +Map _$CustomerDtoToJson(_CustomerDto instance) => + { + 'id': instance.id, + 'name': instance.name, + if (instance.cuit case final value?) 'cuit': value, + if (instance.address case final value?) 'address': value, + 'require_full_payment_on_close': instance.requireFullPaymentOnClose, + 'balance': instance.balance, + 'created_at': instance.createdAt.toIso8601String(), + 'modified_at': instance.modifiedAt.toIso8601String(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customers_api_customers_get_query_parameters.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customers_api_customers_get_query_parameters.dart new file mode 100644 index 00000000..757ad113 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customers_api_customers_get_query_parameters.dart @@ -0,0 +1,49 @@ +/// CustomersApiCustomersGetQueryParameters +/// { +/// "properties": { +/// "search": { +/// "type": "string", +/// "nullable": true +/// }, +/// "requireFullPaymentOnClose": { +/// "type": "boolean", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "required": [] +/// } +library customers_api_customers_get_query_parameters; + +import 'exports.dart'; +part 'customers_api_customers_get_query_parameters.freezed.dart'; +part 'customers_api_customers_get_query_parameters.g.dart'; // CustomersApiCustomersGetQueryParameters + +@freezed +abstract class CustomersApiCustomersGetQueryParameters + with _$CustomersApiCustomersGetQueryParameters { + const CustomersApiCustomersGetQueryParameters._(); + + @jsonSerializable + const factory CustomersApiCustomersGetQueryParameters({ + /// search + @JsonKey(name: CustomersApiCustomersGetQueryParameters.searchKey_) + String? search, + + /// requireFullPaymentOnClose + @JsonKey( + name: + CustomersApiCustomersGetQueryParameters.requireFullPaymentOnCloseKey_, + ) + bool? requireFullPaymentOnClose, + }) = _CustomersApiCustomersGetQueryParameters; + + factory CustomersApiCustomersGetQueryParameters.fromJson( + Map json, + ) => _$CustomersApiCustomersGetQueryParametersFromJson(json); + + static const String searchKey_ = r'search'; + + static const String requireFullPaymentOnCloseKey_ = + r'requireFullPaymentOnClose'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customers_api_customers_get_query_parameters.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customers_api_customers_get_query_parameters.freezed.dart new file mode 100644 index 00000000..886b7022 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customers_api_customers_get_query_parameters.freezed.dart @@ -0,0 +1,400 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'customers_api_customers_get_query_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$CustomersApiCustomersGetQueryParameters { + /// search + @JsonKey(name: CustomersApiCustomersGetQueryParameters.searchKey_) + String? get search; + + /// requireFullPaymentOnClose + @JsonKey( + name: + CustomersApiCustomersGetQueryParameters.requireFullPaymentOnCloseKey_) + bool? get requireFullPaymentOnClose; + + /// Create a copy of CustomersApiCustomersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $CustomersApiCustomersGetQueryParametersCopyWith< + CustomersApiCustomersGetQueryParameters> + get copyWith => _$CustomersApiCustomersGetQueryParametersCopyWithImpl< + CustomersApiCustomersGetQueryParameters>( + this as CustomersApiCustomersGetQueryParameters, _$identity); + + /// Serializes this CustomersApiCustomersGetQueryParameters to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is CustomersApiCustomersGetQueryParameters && + (identical(other.search, search) || other.search == search) && + (identical(other.requireFullPaymentOnClose, + requireFullPaymentOnClose) || + other.requireFullPaymentOnClose == requireFullPaymentOnClose)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, search, requireFullPaymentOnClose); + + @override + String toString() { + return 'CustomersApiCustomersGetQueryParameters(search: $search, requireFullPaymentOnClose: $requireFullPaymentOnClose)'; + } +} + +/// @nodoc +abstract mixin class $CustomersApiCustomersGetQueryParametersCopyWith<$Res> { + factory $CustomersApiCustomersGetQueryParametersCopyWith( + CustomersApiCustomersGetQueryParameters value, + $Res Function(CustomersApiCustomersGetQueryParameters) _then) = + _$CustomersApiCustomersGetQueryParametersCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: CustomersApiCustomersGetQueryParameters.searchKey_) + String? search, + @JsonKey( + name: CustomersApiCustomersGetQueryParameters + .requireFullPaymentOnCloseKey_) + bool? requireFullPaymentOnClose}); +} + +/// @nodoc +class _$CustomersApiCustomersGetQueryParametersCopyWithImpl<$Res> + implements $CustomersApiCustomersGetQueryParametersCopyWith<$Res> { + _$CustomersApiCustomersGetQueryParametersCopyWithImpl(this._self, this._then); + + final CustomersApiCustomersGetQueryParameters _self; + final $Res Function(CustomersApiCustomersGetQueryParameters) _then; + + /// Create a copy of CustomersApiCustomersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? search = freezed, + Object? requireFullPaymentOnClose = freezed, + }) { + return _then(_self.copyWith( + search: freezed == search + ? _self.search + : search // ignore: cast_nullable_to_non_nullable + as String?, + requireFullPaymentOnClose: freezed == requireFullPaymentOnClose + ? _self.requireFullPaymentOnClose + : requireFullPaymentOnClose // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } +} + +/// Adds pattern-matching-related methods to [CustomersApiCustomersGetQueryParameters]. +extension CustomersApiCustomersGetQueryParametersPatterns + on CustomersApiCustomersGetQueryParameters { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_CustomersApiCustomersGetQueryParameters value)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CustomersApiCustomersGetQueryParameters() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_CustomersApiCustomersGetQueryParameters value) $default, + ) { + final _that = this; + switch (_that) { + case _CustomersApiCustomersGetQueryParameters(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_CustomersApiCustomersGetQueryParameters value)? $default, + ) { + final _that = this; + switch (_that) { + case _CustomersApiCustomersGetQueryParameters() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: CustomersApiCustomersGetQueryParameters.searchKey_) + String? search, + @JsonKey( + name: CustomersApiCustomersGetQueryParameters + .requireFullPaymentOnCloseKey_) + bool? requireFullPaymentOnClose)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _CustomersApiCustomersGetQueryParameters() when $default != null: + return $default(_that.search, _that.requireFullPaymentOnClose); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: CustomersApiCustomersGetQueryParameters.searchKey_) + String? search, + @JsonKey( + name: CustomersApiCustomersGetQueryParameters + .requireFullPaymentOnCloseKey_) + bool? requireFullPaymentOnClose) + $default, + ) { + final _that = this; + switch (_that) { + case _CustomersApiCustomersGetQueryParameters(): + return $default(_that.search, _that.requireFullPaymentOnClose); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: CustomersApiCustomersGetQueryParameters.searchKey_) + String? search, + @JsonKey( + name: CustomersApiCustomersGetQueryParameters + .requireFullPaymentOnCloseKey_) + bool? requireFullPaymentOnClose)? + $default, + ) { + final _that = this; + switch (_that) { + case _CustomersApiCustomersGetQueryParameters() when $default != null: + return $default(_that.search, _that.requireFullPaymentOnClose); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _CustomersApiCustomersGetQueryParameters + extends CustomersApiCustomersGetQueryParameters { + const _CustomersApiCustomersGetQueryParameters( + {@JsonKey(name: CustomersApiCustomersGetQueryParameters.searchKey_) + this.search, + @JsonKey( + name: CustomersApiCustomersGetQueryParameters + .requireFullPaymentOnCloseKey_) + this.requireFullPaymentOnClose}) + : super._(); + factory _CustomersApiCustomersGetQueryParameters.fromJson( + Map json) => + _$CustomersApiCustomersGetQueryParametersFromJson(json); + + /// search + @override + @JsonKey(name: CustomersApiCustomersGetQueryParameters.searchKey_) + final String? search; + + /// requireFullPaymentOnClose + @override + @JsonKey( + name: + CustomersApiCustomersGetQueryParameters.requireFullPaymentOnCloseKey_) + final bool? requireFullPaymentOnClose; + + /// Create a copy of CustomersApiCustomersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$CustomersApiCustomersGetQueryParametersCopyWith< + _CustomersApiCustomersGetQueryParameters> + get copyWith => __$CustomersApiCustomersGetQueryParametersCopyWithImpl< + _CustomersApiCustomersGetQueryParameters>(this, _$identity); + + @override + Map toJson() { + return _$CustomersApiCustomersGetQueryParametersToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _CustomersApiCustomersGetQueryParameters && + (identical(other.search, search) || other.search == search) && + (identical(other.requireFullPaymentOnClose, + requireFullPaymentOnClose) || + other.requireFullPaymentOnClose == requireFullPaymentOnClose)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, search, requireFullPaymentOnClose); + + @override + String toString() { + return 'CustomersApiCustomersGetQueryParameters(search: $search, requireFullPaymentOnClose: $requireFullPaymentOnClose)'; + } +} + +/// @nodoc +abstract mixin class _$CustomersApiCustomersGetQueryParametersCopyWith<$Res> + implements $CustomersApiCustomersGetQueryParametersCopyWith<$Res> { + factory _$CustomersApiCustomersGetQueryParametersCopyWith( + _CustomersApiCustomersGetQueryParameters value, + $Res Function(_CustomersApiCustomersGetQueryParameters) _then) = + __$CustomersApiCustomersGetQueryParametersCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: CustomersApiCustomersGetQueryParameters.searchKey_) + String? search, + @JsonKey( + name: CustomersApiCustomersGetQueryParameters + .requireFullPaymentOnCloseKey_) + bool? requireFullPaymentOnClose}); +} + +/// @nodoc +class __$CustomersApiCustomersGetQueryParametersCopyWithImpl<$Res> + implements _$CustomersApiCustomersGetQueryParametersCopyWith<$Res> { + __$CustomersApiCustomersGetQueryParametersCopyWithImpl( + this._self, this._then); + + final _CustomersApiCustomersGetQueryParameters _self; + final $Res Function(_CustomersApiCustomersGetQueryParameters) _then; + + /// Create a copy of CustomersApiCustomersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? search = freezed, + Object? requireFullPaymentOnClose = freezed, + }) { + return _then(_CustomersApiCustomersGetQueryParameters( + search: freezed == search + ? _self.search + : search // ignore: cast_nullable_to_non_nullable + as String?, + requireFullPaymentOnClose: freezed == requireFullPaymentOnClose + ? _self.requireFullPaymentOnClose + : requireFullPaymentOnClose // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/customers_api_customers_get_query_parameters.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/customers_api_customers_get_query_parameters.g.dart new file mode 100644 index 00000000..e65f9557 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/customers_api_customers_get_query_parameters.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'customers_api_customers_get_query_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_CustomersApiCustomersGetQueryParameters + _$CustomersApiCustomersGetQueryParametersFromJson( + Map json) => + _CustomersApiCustomersGetQueryParameters( + search: json['search'] as String?, + requireFullPaymentOnClose: json['requireFullPaymentOnClose'] as bool?, + ); + +Map _$CustomersApiCustomersGetQueryParametersToJson( + _CustomersApiCustomersGetQueryParameters instance) => + { + if (instance.search case final value?) 'search': value, + if (instance.requireFullPaymentOnClose case final value?) + 'requireFullPaymentOnClose': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/date_range.dart b/packages/swagger_to_dart/example/lib/src/gen/models/date_range.dart new file mode 100644 index 00000000..30fe87f7 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/date_range.dart @@ -0,0 +1,45 @@ +/// DateRange +/// { +/// "properties": { +/// "start": { +/// "type": "string", +/// "format": "date" +/// }, +/// "end": { +/// "type": "string", +/// "format": "date" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "end", +/// "start" +/// ], +/// "additionalProperties": false +/// } +library date_range; + +import 'exports.dart'; +part 'date_range.freezed.dart'; +part 'date_range.g.dart'; // DateRange + +@freezed +abstract class DateRange with _$DateRange { + const DateRange._(); + + @jsonSerializable + const factory DateRange({ + /// start + @JsonKey(name: DateRange.startKey_) required DateTime start, + + /// end + @JsonKey(name: DateRange.endKey_) required DateTime end, + }) = _DateRange; + + factory DateRange.fromJson(Map json) => + _$DateRangeFromJson(json); + + static const String startKey_ = r'start'; + + static const String endKey_ = r'end'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/date_range.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/date_range.freezed.dart new file mode 100644 index 00000000..87ad0846 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/date_range.freezed.dart @@ -0,0 +1,348 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'date_range.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DateRange { + /// start + @JsonKey(name: DateRange.startKey_) + DateTime get start; + + /// end + @JsonKey(name: DateRange.endKey_) + DateTime get end; + + /// Create a copy of DateRange + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DateRangeCopyWith get copyWith => + _$DateRangeCopyWithImpl(this as DateRange, _$identity); + + /// Serializes this DateRange to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DateRange && + (identical(other.start, start) || other.start == start) && + (identical(other.end, end) || other.end == end)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, start, end); + + @override + String toString() { + return 'DateRange(start: $start, end: $end)'; + } +} + +/// @nodoc +abstract mixin class $DateRangeCopyWith<$Res> { + factory $DateRangeCopyWith(DateRange value, $Res Function(DateRange) _then) = + _$DateRangeCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: DateRange.startKey_) DateTime start, + @JsonKey(name: DateRange.endKey_) DateTime end}); +} + +/// @nodoc +class _$DateRangeCopyWithImpl<$Res> implements $DateRangeCopyWith<$Res> { + _$DateRangeCopyWithImpl(this._self, this._then); + + final DateRange _self; + final $Res Function(DateRange) _then; + + /// Create a copy of DateRange + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? start = null, + Object? end = null, + }) { + return _then(_self.copyWith( + start: null == start + ? _self.start + : start // ignore: cast_nullable_to_non_nullable + as DateTime, + end: null == end + ? _self.end + : end // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} + +/// Adds pattern-matching-related methods to [DateRange]. +extension DateRangePatterns on DateRange { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_DateRange value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _DateRange() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_DateRange value) $default, + ) { + final _that = this; + switch (_that) { + case _DateRange(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_DateRange value)? $default, + ) { + final _that = this; + switch (_that) { + case _DateRange() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(@JsonKey(name: DateRange.startKey_) DateTime start, + @JsonKey(name: DateRange.endKey_) DateTime end)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _DateRange() when $default != null: + return $default(_that.start, _that.end); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(@JsonKey(name: DateRange.startKey_) DateTime start, + @JsonKey(name: DateRange.endKey_) DateTime end) + $default, + ) { + final _that = this; + switch (_that) { + case _DateRange(): + return $default(_that.start, _that.end); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(@JsonKey(name: DateRange.startKey_) DateTime start, + @JsonKey(name: DateRange.endKey_) DateTime end)? + $default, + ) { + final _that = this; + switch (_that) { + case _DateRange() when $default != null: + return $default(_that.start, _that.end); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _DateRange extends DateRange { + const _DateRange( + {@JsonKey(name: DateRange.startKey_) required this.start, + @JsonKey(name: DateRange.endKey_) required this.end}) + : super._(); + factory _DateRange.fromJson(Map json) => + _$DateRangeFromJson(json); + + /// start + @override + @JsonKey(name: DateRange.startKey_) + final DateTime start; + + /// end + @override + @JsonKey(name: DateRange.endKey_) + final DateTime end; + + /// Create a copy of DateRange + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$DateRangeCopyWith<_DateRange> get copyWith => + __$DateRangeCopyWithImpl<_DateRange>(this, _$identity); + + @override + Map toJson() { + return _$DateRangeToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _DateRange && + (identical(other.start, start) || other.start == start) && + (identical(other.end, end) || other.end == end)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, start, end); + + @override + String toString() { + return 'DateRange(start: $start, end: $end)'; + } +} + +/// @nodoc +abstract mixin class _$DateRangeCopyWith<$Res> + implements $DateRangeCopyWith<$Res> { + factory _$DateRangeCopyWith( + _DateRange value, $Res Function(_DateRange) _then) = + __$DateRangeCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: DateRange.startKey_) DateTime start, + @JsonKey(name: DateRange.endKey_) DateTime end}); +} + +/// @nodoc +class __$DateRangeCopyWithImpl<$Res> implements _$DateRangeCopyWith<$Res> { + __$DateRangeCopyWithImpl(this._self, this._then); + + final _DateRange _self; + final $Res Function(_DateRange) _then; + + /// Create a copy of DateRange + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? start = null, + Object? end = null, + }) { + return _then(_DateRange( + start: null == start + ? _self.start + : start // ignore: cast_nullable_to_non_nullable + as DateTime, + end: null == end + ? _self.end + : end // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/date_range.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/date_range.g.dart new file mode 100644 index 00000000..3336561f --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/date_range.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'date_range.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_DateRange _$DateRangeFromJson(Map json) => _DateRange( + start: DateTime.parse(json['start'] as String), + end: DateTime.parse(json['end'] as String), + ); + +Map _$DateRangeToJson(_DateRange instance) => + { + 'start': instance.start.toIso8601String(), + 'end': instance.end.toIso8601String(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/delete_order_line.dart b/packages/swagger_to_dart/example/lib/src/gen/models/delete_order_line.dart new file mode 100644 index 00000000..a8934dca --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/delete_order_line.dart @@ -0,0 +1,45 @@ +/// DeleteOrderLine +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "type": { +/// "type": "string", +/// "default": "delete" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "id", +/// "type" +/// ], +/// "additionalProperties": false +/// } +library delete_order_line; + +import 'exports.dart'; +part 'delete_order_line.freezed.dart'; +part 'delete_order_line.g.dart'; // DeleteOrderLine + +@freezed +abstract class DeleteOrderLine with _$DeleteOrderLine { + const DeleteOrderLine._(); + + @jsonSerializable + const factory DeleteOrderLine({ + /// id + @JsonKey(name: DeleteOrderLine.idKey_) required String id, + + /// type + @Default('delete') @JsonKey(name: DeleteOrderLine.typeKey_) String type, + }) = _DeleteOrderLine; + + factory DeleteOrderLine.fromJson(Map json) => + _$DeleteOrderLineFromJson(json); + + static const String idKey_ = r'id'; + + static const String typeKey_ = r'type'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/delete_order_line.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/delete_order_line.freezed.dart new file mode 100644 index 00000000..e0948572 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/delete_order_line.freezed.dart @@ -0,0 +1,352 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'delete_order_line.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeleteOrderLine { + /// id + @JsonKey(name: DeleteOrderLine.idKey_) + String get id; + + /// type + @JsonKey(name: DeleteOrderLine.typeKey_) + String get type; + + /// Create a copy of DeleteOrderLine + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeleteOrderLineCopyWith get copyWith => + _$DeleteOrderLineCopyWithImpl( + this as DeleteOrderLine, _$identity); + + /// Serializes this DeleteOrderLine to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeleteOrderLine && + (identical(other.id, id) || other.id == id) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, type); + + @override + String toString() { + return 'DeleteOrderLine(id: $id, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $DeleteOrderLineCopyWith<$Res> { + factory $DeleteOrderLineCopyWith( + DeleteOrderLine value, $Res Function(DeleteOrderLine) _then) = + _$DeleteOrderLineCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: DeleteOrderLine.idKey_) String id, + @JsonKey(name: DeleteOrderLine.typeKey_) String type}); +} + +/// @nodoc +class _$DeleteOrderLineCopyWithImpl<$Res> + implements $DeleteOrderLineCopyWith<$Res> { + _$DeleteOrderLineCopyWithImpl(this._self, this._then); + + final DeleteOrderLine _self; + final $Res Function(DeleteOrderLine) _then; + + /// Create a copy of DeleteOrderLine + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? type = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [DeleteOrderLine]. +extension DeleteOrderLinePatterns on DeleteOrderLine { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_DeleteOrderLine value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _DeleteOrderLine() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_DeleteOrderLine value) $default, + ) { + final _that = this; + switch (_that) { + case _DeleteOrderLine(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_DeleteOrderLine value)? $default, + ) { + final _that = this; + switch (_that) { + case _DeleteOrderLine() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(@JsonKey(name: DeleteOrderLine.idKey_) String id, + @JsonKey(name: DeleteOrderLine.typeKey_) String type)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _DeleteOrderLine() when $default != null: + return $default(_that.id, _that.type); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(@JsonKey(name: DeleteOrderLine.idKey_) String id, + @JsonKey(name: DeleteOrderLine.typeKey_) String type) + $default, + ) { + final _that = this; + switch (_that) { + case _DeleteOrderLine(): + return $default(_that.id, _that.type); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(@JsonKey(name: DeleteOrderLine.idKey_) String id, + @JsonKey(name: DeleteOrderLine.typeKey_) String type)? + $default, + ) { + final _that = this; + switch (_that) { + case _DeleteOrderLine() when $default != null: + return $default(_that.id, _that.type); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _DeleteOrderLine extends DeleteOrderLine { + const _DeleteOrderLine( + {@JsonKey(name: DeleteOrderLine.idKey_) required this.id, + @JsonKey(name: DeleteOrderLine.typeKey_) this.type = 'delete'}) + : super._(); + factory _DeleteOrderLine.fromJson(Map json) => + _$DeleteOrderLineFromJson(json); + + /// id + @override + @JsonKey(name: DeleteOrderLine.idKey_) + final String id; + + /// type + @override + @JsonKey(name: DeleteOrderLine.typeKey_) + final String type; + + /// Create a copy of DeleteOrderLine + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$DeleteOrderLineCopyWith<_DeleteOrderLine> get copyWith => + __$DeleteOrderLineCopyWithImpl<_DeleteOrderLine>(this, _$identity); + + @override + Map toJson() { + return _$DeleteOrderLineToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _DeleteOrderLine && + (identical(other.id, id) || other.id == id) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, type); + + @override + String toString() { + return 'DeleteOrderLine(id: $id, type: $type)'; + } +} + +/// @nodoc +abstract mixin class _$DeleteOrderLineCopyWith<$Res> + implements $DeleteOrderLineCopyWith<$Res> { + factory _$DeleteOrderLineCopyWith( + _DeleteOrderLine value, $Res Function(_DeleteOrderLine) _then) = + __$DeleteOrderLineCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: DeleteOrderLine.idKey_) String id, + @JsonKey(name: DeleteOrderLine.typeKey_) String type}); +} + +/// @nodoc +class __$DeleteOrderLineCopyWithImpl<$Res> + implements _$DeleteOrderLineCopyWith<$Res> { + __$DeleteOrderLineCopyWithImpl(this._self, this._then); + + final _DeleteOrderLine _self; + final $Res Function(_DeleteOrderLine) _then; + + /// Create a copy of DeleteOrderLine + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? type = null, + }) { + return _then(_DeleteOrderLine( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/delete_order_line.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/delete_order_line.g.dart new file mode 100644 index 00000000..7fe40152 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/delete_order_line.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'delete_order_line.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_DeleteOrderLine _$DeleteOrderLineFromJson(Map json) => + _DeleteOrderLine( + id: json['id'] as String, + type: json['type'] as String? ?? 'delete', + ); + +Map _$DeleteOrderLineToJson(_DeleteOrderLine instance) => + { + 'id': instance.id, + 'type': instance.type, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/document_kind.dart b/packages/swagger_to_dart/example/lib/src/gen/models/document_kind.dart new file mode 100644 index 00000000..245f6087 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/document_kind.dart @@ -0,0 +1,28 @@ +// DocumentKind +// { +// "type": "string", +// "enum": [ +// "order", +// "sale" +// ] +// } + +library document_kind; + +import 'exports.dart'; +part 'document_kind.g.dart'; + +@JsonEnum(alwaysCreate: true) +enum DocumentKind { + @JsonValue("order") + order, + @JsonValue("sale") + sale; + + factory DocumentKind.fromJson(String json) => DocumentKind.values.firstWhere( + (e) => e.toJson() == json, + orElse: () => DocumentKind.values.first, + ); + + String toJson() => _$DocumentKindEnumMap[this]!; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/document_kind.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/document_kind.g.dart new file mode 100644 index 00000000..21d06327 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/document_kind.g.dart @@ -0,0 +1,12 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'document_kind.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +const _$DocumentKindEnumMap = { + DocumentKind.order: 'order', + DocumentKind.sale: 'sale', +}; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/generate_invoices_request.dart b/packages/swagger_to_dart/example/lib/src/gen/models/generate_invoices_request.dart new file mode 100644 index 00000000..9e7f706b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/generate_invoices_request.dart @@ -0,0 +1,39 @@ +/// GenerateInvoicesRequest +/// { +/// "properties": { +/// "order_ids": { +/// "type": "array", +/// "items": { +/// "type": "string", +/// "format": "uuid" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "order_ids" +/// ], +/// "additionalProperties": false +/// } +library generate_invoices_request; + +import 'exports.dart'; +part 'generate_invoices_request.freezed.dart'; +part 'generate_invoices_request.g.dart'; // GenerateInvoicesRequest + +@freezed +abstract class GenerateInvoicesRequest with _$GenerateInvoicesRequest { + const GenerateInvoicesRequest._(); + + @jsonSerializable + const factory GenerateInvoicesRequest({ + /// orderIds + @JsonKey(name: GenerateInvoicesRequest.orderIdsKey_) + required List orderIds, + }) = _GenerateInvoicesRequest; + + factory GenerateInvoicesRequest.fromJson(Map json) => + _$GenerateInvoicesRequestFromJson(json); + + static const String orderIdsKey_ = r'order_ids'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/generate_invoices_request.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/generate_invoices_request.freezed.dart new file mode 100644 index 00000000..06166540 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/generate_invoices_request.freezed.dart @@ -0,0 +1,345 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'generate_invoices_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$GenerateInvoicesRequest { + /// orderIds + @JsonKey(name: GenerateInvoicesRequest.orderIdsKey_) + List get orderIds; + + /// Create a copy of GenerateInvoicesRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GenerateInvoicesRequestCopyWith get copyWith => + _$GenerateInvoicesRequestCopyWithImpl( + this as GenerateInvoicesRequest, _$identity); + + /// Serializes this GenerateInvoicesRequest to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is GenerateInvoicesRequest && + const DeepCollectionEquality().equals(other.orderIds, orderIds)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(orderIds)); + + @override + String toString() { + return 'GenerateInvoicesRequest(orderIds: $orderIds)'; + } +} + +/// @nodoc +abstract mixin class $GenerateInvoicesRequestCopyWith<$Res> { + factory $GenerateInvoicesRequestCopyWith(GenerateInvoicesRequest value, + $Res Function(GenerateInvoicesRequest) _then) = + _$GenerateInvoicesRequestCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: GenerateInvoicesRequest.orderIdsKey_) + List orderIds}); +} + +/// @nodoc +class _$GenerateInvoicesRequestCopyWithImpl<$Res> + implements $GenerateInvoicesRequestCopyWith<$Res> { + _$GenerateInvoicesRequestCopyWithImpl(this._self, this._then); + + final GenerateInvoicesRequest _self; + final $Res Function(GenerateInvoicesRequest) _then; + + /// Create a copy of GenerateInvoicesRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? orderIds = null, + }) { + return _then(_self.copyWith( + orderIds: null == orderIds + ? _self.orderIds + : orderIds // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [GenerateInvoicesRequest]. +extension GenerateInvoicesRequestPatterns on GenerateInvoicesRequest { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_GenerateInvoicesRequest value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _GenerateInvoicesRequest() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_GenerateInvoicesRequest value) $default, + ) { + final _that = this; + switch (_that) { + case _GenerateInvoicesRequest(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_GenerateInvoicesRequest value)? $default, + ) { + final _that = this; + switch (_that) { + case _GenerateInvoicesRequest() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: GenerateInvoicesRequest.orderIdsKey_) + List orderIds)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _GenerateInvoicesRequest() when $default != null: + return $default(_that.orderIds); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: GenerateInvoicesRequest.orderIdsKey_) + List orderIds) + $default, + ) { + final _that = this; + switch (_that) { + case _GenerateInvoicesRequest(): + return $default(_that.orderIds); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: GenerateInvoicesRequest.orderIdsKey_) + List orderIds)? + $default, + ) { + final _that = this; + switch (_that) { + case _GenerateInvoicesRequest() when $default != null: + return $default(_that.orderIds); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _GenerateInvoicesRequest extends GenerateInvoicesRequest { + const _GenerateInvoicesRequest( + {@JsonKey(name: GenerateInvoicesRequest.orderIdsKey_) + required final List orderIds}) + : _orderIds = orderIds, + super._(); + factory _GenerateInvoicesRequest.fromJson(Map json) => + _$GenerateInvoicesRequestFromJson(json); + + /// orderIds + final List _orderIds; + + /// orderIds + @override + @JsonKey(name: GenerateInvoicesRequest.orderIdsKey_) + List get orderIds { + if (_orderIds is EqualUnmodifiableListView) return _orderIds; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_orderIds); + } + + /// Create a copy of GenerateInvoicesRequest + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$GenerateInvoicesRequestCopyWith<_GenerateInvoicesRequest> get copyWith => + __$GenerateInvoicesRequestCopyWithImpl<_GenerateInvoicesRequest>( + this, _$identity); + + @override + Map toJson() { + return _$GenerateInvoicesRequestToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _GenerateInvoicesRequest && + const DeepCollectionEquality().equals(other._orderIds, _orderIds)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_orderIds)); + + @override + String toString() { + return 'GenerateInvoicesRequest(orderIds: $orderIds)'; + } +} + +/// @nodoc +abstract mixin class _$GenerateInvoicesRequestCopyWith<$Res> + implements $GenerateInvoicesRequestCopyWith<$Res> { + factory _$GenerateInvoicesRequestCopyWith(_GenerateInvoicesRequest value, + $Res Function(_GenerateInvoicesRequest) _then) = + __$GenerateInvoicesRequestCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: GenerateInvoicesRequest.orderIdsKey_) + List orderIds}); +} + +/// @nodoc +class __$GenerateInvoicesRequestCopyWithImpl<$Res> + implements _$GenerateInvoicesRequestCopyWith<$Res> { + __$GenerateInvoicesRequestCopyWithImpl(this._self, this._then); + + final _GenerateInvoicesRequest _self; + final $Res Function(_GenerateInvoicesRequest) _then; + + /// Create a copy of GenerateInvoicesRequest + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? orderIds = null, + }) { + return _then(_GenerateInvoicesRequest( + orderIds: null == orderIds + ? _self._orderIds + : orderIds // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/generate_invoices_request.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/generate_invoices_request.g.dart new file mode 100644 index 00000000..f3b7b78a --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/generate_invoices_request.g.dart @@ -0,0 +1,20 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'generate_invoices_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_GenerateInvoicesRequest _$GenerateInvoicesRequestFromJson( + Map json) => + _GenerateInvoicesRequest( + orderIds: + (json['order_ids'] as List).map((e) => e as String).toList(), + ); + +Map _$GenerateInvoicesRequestToJson( + _GenerateInvoicesRequest instance) => + { + 'order_ids': instance.orderIds, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/login_request_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/login_request_dto.dart new file mode 100644 index 00000000..15f91223 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/login_request_dto.dart @@ -0,0 +1,44 @@ +/// LoginRequestDto +/// { +/// "properties": { +/// "username": { +/// "type": "string" +/// }, +/// "password": { +/// "type": "string" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "password", +/// "username" +/// ], +/// "description": "Login payload from client.", +/// "additionalProperties": false +/// } +library login_request_dto; + +import 'exports.dart'; +part 'login_request_dto.freezed.dart'; +part 'login_request_dto.g.dart'; // LoginRequestDto + +@freezed +abstract class LoginRequestDto with _$LoginRequestDto { + const LoginRequestDto._(); + + @jsonSerializable + const factory LoginRequestDto({ + /// username + @JsonKey(name: LoginRequestDto.usernameKey_) required String username, + + /// password + @JsonKey(name: LoginRequestDto.passwordKey_) required String password, + }) = _LoginRequestDto; + + factory LoginRequestDto.fromJson(Map json) => + _$LoginRequestDtoFromJson(json); + + static const String usernameKey_ = r'username'; + + static const String passwordKey_ = r'password'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/login_request_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/login_request_dto.freezed.dart new file mode 100644 index 00000000..4c23b084 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/login_request_dto.freezed.dart @@ -0,0 +1,359 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'login_request_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$LoginRequestDto { + /// username + @JsonKey(name: LoginRequestDto.usernameKey_) + String get username; + + /// password + @JsonKey(name: LoginRequestDto.passwordKey_) + String get password; + + /// Create a copy of LoginRequestDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $LoginRequestDtoCopyWith get copyWith => + _$LoginRequestDtoCopyWithImpl( + this as LoginRequestDto, _$identity); + + /// Serializes this LoginRequestDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is LoginRequestDto && + (identical(other.username, username) || + other.username == username) && + (identical(other.password, password) || + other.password == password)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, username, password); + + @override + String toString() { + return 'LoginRequestDto(username: $username, password: $password)'; + } +} + +/// @nodoc +abstract mixin class $LoginRequestDtoCopyWith<$Res> { + factory $LoginRequestDtoCopyWith( + LoginRequestDto value, $Res Function(LoginRequestDto) _then) = + _$LoginRequestDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: LoginRequestDto.usernameKey_) String username, + @JsonKey(name: LoginRequestDto.passwordKey_) String password}); +} + +/// @nodoc +class _$LoginRequestDtoCopyWithImpl<$Res> + implements $LoginRequestDtoCopyWith<$Res> { + _$LoginRequestDtoCopyWithImpl(this._self, this._then); + + final LoginRequestDto _self; + final $Res Function(LoginRequestDto) _then; + + /// Create a copy of LoginRequestDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? username = null, + Object? password = null, + }) { + return _then(_self.copyWith( + username: null == username + ? _self.username + : username // ignore: cast_nullable_to_non_nullable + as String, + password: null == password + ? _self.password + : password // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [LoginRequestDto]. +extension LoginRequestDtoPatterns on LoginRequestDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_LoginRequestDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _LoginRequestDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_LoginRequestDto value) $default, + ) { + final _that = this; + switch (_that) { + case _LoginRequestDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_LoginRequestDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _LoginRequestDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: LoginRequestDto.usernameKey_) String username, + @JsonKey(name: LoginRequestDto.passwordKey_) String password)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _LoginRequestDto() when $default != null: + return $default(_that.username, _that.password); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: LoginRequestDto.usernameKey_) String username, + @JsonKey(name: LoginRequestDto.passwordKey_) String password) + $default, + ) { + final _that = this; + switch (_that) { + case _LoginRequestDto(): + return $default(_that.username, _that.password); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: LoginRequestDto.usernameKey_) String username, + @JsonKey(name: LoginRequestDto.passwordKey_) String password)? + $default, + ) { + final _that = this; + switch (_that) { + case _LoginRequestDto() when $default != null: + return $default(_that.username, _that.password); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _LoginRequestDto extends LoginRequestDto { + const _LoginRequestDto( + {@JsonKey(name: LoginRequestDto.usernameKey_) required this.username, + @JsonKey(name: LoginRequestDto.passwordKey_) required this.password}) + : super._(); + factory _LoginRequestDto.fromJson(Map json) => + _$LoginRequestDtoFromJson(json); + + /// username + @override + @JsonKey(name: LoginRequestDto.usernameKey_) + final String username; + + /// password + @override + @JsonKey(name: LoginRequestDto.passwordKey_) + final String password; + + /// Create a copy of LoginRequestDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$LoginRequestDtoCopyWith<_LoginRequestDto> get copyWith => + __$LoginRequestDtoCopyWithImpl<_LoginRequestDto>(this, _$identity); + + @override + Map toJson() { + return _$LoginRequestDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _LoginRequestDto && + (identical(other.username, username) || + other.username == username) && + (identical(other.password, password) || + other.password == password)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, username, password); + + @override + String toString() { + return 'LoginRequestDto(username: $username, password: $password)'; + } +} + +/// @nodoc +abstract mixin class _$LoginRequestDtoCopyWith<$Res> + implements $LoginRequestDtoCopyWith<$Res> { + factory _$LoginRequestDtoCopyWith( + _LoginRequestDto value, $Res Function(_LoginRequestDto) _then) = + __$LoginRequestDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: LoginRequestDto.usernameKey_) String username, + @JsonKey(name: LoginRequestDto.passwordKey_) String password}); +} + +/// @nodoc +class __$LoginRequestDtoCopyWithImpl<$Res> + implements _$LoginRequestDtoCopyWith<$Res> { + __$LoginRequestDtoCopyWithImpl(this._self, this._then); + + final _LoginRequestDto _self; + final $Res Function(_LoginRequestDto) _then; + + /// Create a copy of LoginRequestDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? username = null, + Object? password = null, + }) { + return _then(_LoginRequestDto( + username: null == username + ? _self.username + : username // ignore: cast_nullable_to_non_nullable + as String, + password: null == password + ? _self.password + : password // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/login_request_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/login_request_dto.g.dart new file mode 100644 index 00000000..9da268ba --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/login_request_dto.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'login_request_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_LoginRequestDto _$LoginRequestDtoFromJson(Map json) => + _LoginRequestDto( + username: json['username'] as String, + password: json['password'] as String, + ); + +Map _$LoginRequestDtoToJson(_LoginRequestDto instance) => + { + 'username': instance.username, + 'password': instance.password, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/login_result_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/login_result_dto.dart new file mode 100644 index 00000000..d22fe179 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/login_result_dto.dart @@ -0,0 +1,44 @@ +/// LoginResultDto +/// { +/// "properties": { +/// "credentials": { +/// "$ref": "#/components/schemas/CredentialsDto" +/// }, +/// "user": { +/// "$ref": "#/components/schemas/UserDto" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "credentials", +/// "user" +/// ], +/// "additionalProperties": false +/// } +library login_result_dto; + +import 'exports.dart'; +part 'login_result_dto.freezed.dart'; +part 'login_result_dto.g.dart'; // LoginResultDto + +@freezed +abstract class LoginResultDto with _$LoginResultDto { + const LoginResultDto._(); + + @jsonSerializable + const factory LoginResultDto({ + /// credentials + @JsonKey(name: LoginResultDto.credentialsKey_) + required CredentialsDto credentials, + + /// user + @JsonKey(name: LoginResultDto.userKey_) required UserDto user, + }) = _LoginResultDto; + + factory LoginResultDto.fromJson(Map json) => + _$LoginResultDtoFromJson(json); + + static const String credentialsKey_ = r'credentials'; + + static const String userKey_ = r'user'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/login_result_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/login_result_dto.freezed.dart new file mode 100644 index 00000000..478ec95e --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/login_result_dto.freezed.dart @@ -0,0 +1,410 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'login_result_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$LoginResultDto { + /// credentials + @JsonKey(name: LoginResultDto.credentialsKey_) + CredentialsDto get credentials; + + /// user + @JsonKey(name: LoginResultDto.userKey_) + UserDto get user; + + /// Create a copy of LoginResultDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $LoginResultDtoCopyWith get copyWith => + _$LoginResultDtoCopyWithImpl( + this as LoginResultDto, _$identity); + + /// Serializes this LoginResultDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is LoginResultDto && + (identical(other.credentials, credentials) || + other.credentials == credentials) && + (identical(other.user, user) || other.user == user)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, credentials, user); + + @override + String toString() { + return 'LoginResultDto(credentials: $credentials, user: $user)'; + } +} + +/// @nodoc +abstract mixin class $LoginResultDtoCopyWith<$Res> { + factory $LoginResultDtoCopyWith( + LoginResultDto value, $Res Function(LoginResultDto) _then) = + _$LoginResultDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: LoginResultDto.credentialsKey_) + CredentialsDto credentials, + @JsonKey(name: LoginResultDto.userKey_) UserDto user}); + + $CredentialsDtoCopyWith<$Res> get credentials; + $UserDtoCopyWith<$Res> get user; +} + +/// @nodoc +class _$LoginResultDtoCopyWithImpl<$Res> + implements $LoginResultDtoCopyWith<$Res> { + _$LoginResultDtoCopyWithImpl(this._self, this._then); + + final LoginResultDto _self; + final $Res Function(LoginResultDto) _then; + + /// Create a copy of LoginResultDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? credentials = null, + Object? user = null, + }) { + return _then(_self.copyWith( + credentials: null == credentials + ? _self.credentials + : credentials // ignore: cast_nullable_to_non_nullable + as CredentialsDto, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserDto, + )); + } + + /// Create a copy of LoginResultDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $CredentialsDtoCopyWith<$Res> get credentials { + return $CredentialsDtoCopyWith<$Res>(_self.credentials, (value) { + return _then(_self.copyWith(credentials: value)); + }); + } + + /// Create a copy of LoginResultDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UserDtoCopyWith<$Res> get user { + return $UserDtoCopyWith<$Res>(_self.user, (value) { + return _then(_self.copyWith(user: value)); + }); + } +} + +/// Adds pattern-matching-related methods to [LoginResultDto]. +extension LoginResultDtoPatterns on LoginResultDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_LoginResultDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _LoginResultDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_LoginResultDto value) $default, + ) { + final _that = this; + switch (_that) { + case _LoginResultDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_LoginResultDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _LoginResultDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: LoginResultDto.credentialsKey_) + CredentialsDto credentials, + @JsonKey(name: LoginResultDto.userKey_) UserDto user)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _LoginResultDto() when $default != null: + return $default(_that.credentials, _that.user); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: LoginResultDto.credentialsKey_) + CredentialsDto credentials, + @JsonKey(name: LoginResultDto.userKey_) UserDto user) + $default, + ) { + final _that = this; + switch (_that) { + case _LoginResultDto(): + return $default(_that.credentials, _that.user); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: LoginResultDto.credentialsKey_) + CredentialsDto credentials, + @JsonKey(name: LoginResultDto.userKey_) UserDto user)? + $default, + ) { + final _that = this; + switch (_that) { + case _LoginResultDto() when $default != null: + return $default(_that.credentials, _that.user); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _LoginResultDto extends LoginResultDto { + const _LoginResultDto( + {@JsonKey(name: LoginResultDto.credentialsKey_) required this.credentials, + @JsonKey(name: LoginResultDto.userKey_) required this.user}) + : super._(); + factory _LoginResultDto.fromJson(Map json) => + _$LoginResultDtoFromJson(json); + + /// credentials + @override + @JsonKey(name: LoginResultDto.credentialsKey_) + final CredentialsDto credentials; + + /// user + @override + @JsonKey(name: LoginResultDto.userKey_) + final UserDto user; + + /// Create a copy of LoginResultDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$LoginResultDtoCopyWith<_LoginResultDto> get copyWith => + __$LoginResultDtoCopyWithImpl<_LoginResultDto>(this, _$identity); + + @override + Map toJson() { + return _$LoginResultDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _LoginResultDto && + (identical(other.credentials, credentials) || + other.credentials == credentials) && + (identical(other.user, user) || other.user == user)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, credentials, user); + + @override + String toString() { + return 'LoginResultDto(credentials: $credentials, user: $user)'; + } +} + +/// @nodoc +abstract mixin class _$LoginResultDtoCopyWith<$Res> + implements $LoginResultDtoCopyWith<$Res> { + factory _$LoginResultDtoCopyWith( + _LoginResultDto value, $Res Function(_LoginResultDto) _then) = + __$LoginResultDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: LoginResultDto.credentialsKey_) + CredentialsDto credentials, + @JsonKey(name: LoginResultDto.userKey_) UserDto user}); + + @override + $CredentialsDtoCopyWith<$Res> get credentials; + @override + $UserDtoCopyWith<$Res> get user; +} + +/// @nodoc +class __$LoginResultDtoCopyWithImpl<$Res> + implements _$LoginResultDtoCopyWith<$Res> { + __$LoginResultDtoCopyWithImpl(this._self, this._then); + + final _LoginResultDto _self; + final $Res Function(_LoginResultDto) _then; + + /// Create a copy of LoginResultDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? credentials = null, + Object? user = null, + }) { + return _then(_LoginResultDto( + credentials: null == credentials + ? _self.credentials + : credentials // ignore: cast_nullable_to_non_nullable + as CredentialsDto, + user: null == user + ? _self.user + : user // ignore: cast_nullable_to_non_nullable + as UserDto, + )); + } + + /// Create a copy of LoginResultDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $CredentialsDtoCopyWith<$Res> get credentials { + return $CredentialsDtoCopyWith<$Res>(_self.credentials, (value) { + return _then(_self.copyWith(credentials: value)); + }); + } + + /// Create a copy of LoginResultDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UserDtoCopyWith<$Res> get user { + return $UserDtoCopyWith<$Res>(_self.user, (value) { + return _then(_self.copyWith(user: value)); + }); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/login_result_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/login_result_dto.g.dart new file mode 100644 index 00000000..2b32a3cf --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/login_result_dto.g.dart @@ -0,0 +1,20 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'login_result_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_LoginResultDto _$LoginResultDtoFromJson(Map json) => + _LoginResultDto( + credentials: + CredentialsDto.fromJson(json['credentials'] as Map), + user: UserDto.fromJson(json['user'] as Map), + ); + +Map _$LoginResultDtoToJson(_LoginResultDto instance) => + { + 'credentials': instance.credentials.toJson(), + 'user': instance.user.toJson(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto.dart new file mode 100644 index 00000000..5c93e9c0 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto.dart @@ -0,0 +1,180 @@ +/// OrderDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "kind": { +/// "$ref": "#/components/schemas/DocumentKind" +/// }, +/// "sale_point_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "sale_point_name": { +/// "type": "string" +/// }, +/// "customer_id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "customer_name": { +/// "type": "string", +/// "nullable": true +/// }, +/// "user_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "user_name": { +/// "type": "string" +/// }, +/// "status": { +/// "$ref": "#/components/schemas/OrderStatus" +/// }, +/// "payment_status": { +/// "$ref": "#/components/schemas/OrderPaymentStatus" +/// }, +/// "is_paid": { +/// "type": "boolean" +/// }, +/// "number": { +/// "type": "string" +/// }, +/// "total": { +/// "type": "number", +/// "format": "double" +/// }, +/// "created_at": { +/// "type": "string", +/// "format": "date-time" +/// }, +/// "modified_at": { +/// "type": "string", +/// "format": "date-time" +/// }, +/// "lines": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/OrderLineDto" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "created_at", +/// "id", +/// "is_paid", +/// "kind", +/// "lines", +/// "modified_at", +/// "number", +/// "payment_status", +/// "sale_point_id", +/// "sale_point_name", +/// "status", +/// "total", +/// "user_id", +/// "user_name" +/// ], +/// "additionalProperties": false +/// } +library order_dto; + +import 'exports.dart'; +part 'order_dto.freezed.dart'; +part 'order_dto.g.dart'; // OrderDto + +@freezed +abstract class OrderDto with _$OrderDto { + const OrderDto._(); + + @jsonSerializable + const factory OrderDto({ + /// id + @JsonKey(name: OrderDto.idKey_) required String id, + + /// kind + @JsonKey(name: OrderDto.kindKey_) required DocumentKind kind, + + /// salePointId + @JsonKey(name: OrderDto.salePointIdKey_) required String salePointId, + + /// salePointName + @JsonKey(name: OrderDto.salePointNameKey_) required String salePointName, + + /// customerId + @JsonKey(name: OrderDto.customerIdKey_) String? customerId, + + /// customerName + @JsonKey(name: OrderDto.customerNameKey_) String? customerName, + + /// userId + @JsonKey(name: OrderDto.userIdKey_) required String userId, + + /// userName + @JsonKey(name: OrderDto.userNameKey_) required String userName, + + /// status + @JsonKey(name: OrderDto.statusKey_) required OrderStatus status, + + /// paymentStatus + @JsonKey(name: OrderDto.paymentStatusKey_) + required OrderPaymentStatus paymentStatus, + + /// isPaid + @JsonKey(name: OrderDto.isPaidKey_) required bool isPaid, + + /// number + @JsonKey(name: OrderDto.numberKey_) required String number, + + /// total + @JsonKey(name: OrderDto.totalKey_) required double total, + + /// createdAt + @JsonKey(name: OrderDto.createdAtKey_) required DateTime createdAt, + + /// modifiedAt + @JsonKey(name: OrderDto.modifiedAtKey_) required DateTime modifiedAt, + + /// lines + @JsonKey(name: OrderDto.linesKey_) required List lines, + }) = _OrderDto; + + factory OrderDto.fromJson(Map json) => + _$OrderDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String kindKey_ = r'kind'; + + static const String salePointIdKey_ = r'sale_point_id'; + + static const String salePointNameKey_ = r'sale_point_name'; + + static const String customerIdKey_ = r'customer_id'; + + static const String customerNameKey_ = r'customer_name'; + + static const String userIdKey_ = r'user_id'; + + static const String userNameKey_ = r'user_name'; + + static const String statusKey_ = r'status'; + + static const String paymentStatusKey_ = r'payment_status'; + + static const String isPaidKey_ = r'is_paid'; + + static const String numberKey_ = r'number'; + + static const String totalKey_ = r'total'; + + static const String createdAtKey_ = r'created_at'; + + static const String modifiedAtKey_ = r'modified_at'; + + static const String linesKey_ = r'lines'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto.freezed.dart new file mode 100644 index 00000000..4009fd32 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto.freezed.dart @@ -0,0 +1,840 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'order_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$OrderDto { + /// id + @JsonKey(name: OrderDto.idKey_) + String get id; + + /// kind + @JsonKey(name: OrderDto.kindKey_) + DocumentKind get kind; + + /// salePointId + @JsonKey(name: OrderDto.salePointIdKey_) + String get salePointId; + + /// salePointName + @JsonKey(name: OrderDto.salePointNameKey_) + String get salePointName; + + /// customerId + @JsonKey(name: OrderDto.customerIdKey_) + String? get customerId; + + /// customerName + @JsonKey(name: OrderDto.customerNameKey_) + String? get customerName; + + /// userId + @JsonKey(name: OrderDto.userIdKey_) + String get userId; + + /// userName + @JsonKey(name: OrderDto.userNameKey_) + String get userName; + + /// status + @JsonKey(name: OrderDto.statusKey_) + OrderStatus get status; + + /// paymentStatus + @JsonKey(name: OrderDto.paymentStatusKey_) + OrderPaymentStatus get paymentStatus; + + /// isPaid + @JsonKey(name: OrderDto.isPaidKey_) + bool get isPaid; + + /// number + @JsonKey(name: OrderDto.numberKey_) + String get number; + + /// total + @JsonKey(name: OrderDto.totalKey_) + double get total; + + /// createdAt + @JsonKey(name: OrderDto.createdAtKey_) + DateTime get createdAt; + + /// modifiedAt + @JsonKey(name: OrderDto.modifiedAtKey_) + DateTime get modifiedAt; + + /// lines + @JsonKey(name: OrderDto.linesKey_) + List get lines; + + /// Create a copy of OrderDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OrderDtoCopyWith get copyWith => + _$OrderDtoCopyWithImpl(this as OrderDto, _$identity); + + /// Serializes this OrderDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OrderDto && + (identical(other.id, id) || other.id == id) && + (identical(other.kind, kind) || other.kind == kind) && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId) && + (identical(other.salePointName, salePointName) || + other.salePointName == salePointName) && + (identical(other.customerId, customerId) || + other.customerId == customerId) && + (identical(other.customerName, customerName) || + other.customerName == customerName) && + (identical(other.userId, userId) || other.userId == userId) && + (identical(other.userName, userName) || + other.userName == userName) && + (identical(other.status, status) || other.status == status) && + (identical(other.paymentStatus, paymentStatus) || + other.paymentStatus == paymentStatus) && + (identical(other.isPaid, isPaid) || other.isPaid == isPaid) && + (identical(other.number, number) || other.number == number) && + (identical(other.total, total) || other.total == total) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.modifiedAt, modifiedAt) || + other.modifiedAt == modifiedAt) && + const DeepCollectionEquality().equals(other.lines, lines)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + kind, + salePointId, + salePointName, + customerId, + customerName, + userId, + userName, + status, + paymentStatus, + isPaid, + number, + total, + createdAt, + modifiedAt, + const DeepCollectionEquality().hash(lines)); + + @override + String toString() { + return 'OrderDto(id: $id, kind: $kind, salePointId: $salePointId, salePointName: $salePointName, customerId: $customerId, customerName: $customerName, userId: $userId, userName: $userName, status: $status, paymentStatus: $paymentStatus, isPaid: $isPaid, number: $number, total: $total, createdAt: $createdAt, modifiedAt: $modifiedAt, lines: $lines)'; + } +} + +/// @nodoc +abstract mixin class $OrderDtoCopyWith<$Res> { + factory $OrderDtoCopyWith(OrderDto value, $Res Function(OrderDto) _then) = + _$OrderDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: OrderDto.idKey_) String id, + @JsonKey(name: OrderDto.kindKey_) DocumentKind kind, + @JsonKey(name: OrderDto.salePointIdKey_) String salePointId, + @JsonKey(name: OrderDto.salePointNameKey_) String salePointName, + @JsonKey(name: OrderDto.customerIdKey_) String? customerId, + @JsonKey(name: OrderDto.customerNameKey_) String? customerName, + @JsonKey(name: OrderDto.userIdKey_) String userId, + @JsonKey(name: OrderDto.userNameKey_) String userName, + @JsonKey(name: OrderDto.statusKey_) OrderStatus status, + @JsonKey(name: OrderDto.paymentStatusKey_) + OrderPaymentStatus paymentStatus, + @JsonKey(name: OrderDto.isPaidKey_) bool isPaid, + @JsonKey(name: OrderDto.numberKey_) String number, + @JsonKey(name: OrderDto.totalKey_) double total, + @JsonKey(name: OrderDto.createdAtKey_) DateTime createdAt, + @JsonKey(name: OrderDto.modifiedAtKey_) DateTime modifiedAt, + @JsonKey(name: OrderDto.linesKey_) List lines}); +} + +/// @nodoc +class _$OrderDtoCopyWithImpl<$Res> implements $OrderDtoCopyWith<$Res> { + _$OrderDtoCopyWithImpl(this._self, this._then); + + final OrderDto _self; + final $Res Function(OrderDto) _then; + + /// Create a copy of OrderDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? kind = null, + Object? salePointId = null, + Object? salePointName = null, + Object? customerId = freezed, + Object? customerName = freezed, + Object? userId = null, + Object? userName = null, + Object? status = null, + Object? paymentStatus = null, + Object? isPaid = null, + Object? number = null, + Object? total = null, + Object? createdAt = null, + Object? modifiedAt = null, + Object? lines = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + kind: null == kind + ? _self.kind + : kind // ignore: cast_nullable_to_non_nullable + as DocumentKind, + salePointId: null == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String, + salePointName: null == salePointName + ? _self.salePointName + : salePointName // ignore: cast_nullable_to_non_nullable + as String, + customerId: freezed == customerId + ? _self.customerId + : customerId // ignore: cast_nullable_to_non_nullable + as String?, + customerName: freezed == customerName + ? _self.customerName + : customerName // ignore: cast_nullable_to_non_nullable + as String?, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + userName: null == userName + ? _self.userName + : userName // ignore: cast_nullable_to_non_nullable + as String, + status: null == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as OrderStatus, + paymentStatus: null == paymentStatus + ? _self.paymentStatus + : paymentStatus // ignore: cast_nullable_to_non_nullable + as OrderPaymentStatus, + isPaid: null == isPaid + ? _self.isPaid + : isPaid // ignore: cast_nullable_to_non_nullable + as bool, + number: null == number + ? _self.number + : number // ignore: cast_nullable_to_non_nullable + as String, + total: null == total + ? _self.total + : total // ignore: cast_nullable_to_non_nullable + as double, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + modifiedAt: null == modifiedAt + ? _self.modifiedAt + : modifiedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + lines: null == lines + ? _self.lines + : lines // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [OrderDto]. +extension OrderDtoPatterns on OrderDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_OrderDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _OrderDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_OrderDto value) $default, + ) { + final _that = this; + switch (_that) { + case _OrderDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_OrderDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _OrderDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: OrderDto.idKey_) String id, + @JsonKey(name: OrderDto.kindKey_) DocumentKind kind, + @JsonKey(name: OrderDto.salePointIdKey_) String salePointId, + @JsonKey(name: OrderDto.salePointNameKey_) String salePointName, + @JsonKey(name: OrderDto.customerIdKey_) String? customerId, + @JsonKey(name: OrderDto.customerNameKey_) String? customerName, + @JsonKey(name: OrderDto.userIdKey_) String userId, + @JsonKey(name: OrderDto.userNameKey_) String userName, + @JsonKey(name: OrderDto.statusKey_) OrderStatus status, + @JsonKey(name: OrderDto.paymentStatusKey_) + OrderPaymentStatus paymentStatus, + @JsonKey(name: OrderDto.isPaidKey_) bool isPaid, + @JsonKey(name: OrderDto.numberKey_) String number, + @JsonKey(name: OrderDto.totalKey_) double total, + @JsonKey(name: OrderDto.createdAtKey_) DateTime createdAt, + @JsonKey(name: OrderDto.modifiedAtKey_) DateTime modifiedAt, + @JsonKey(name: OrderDto.linesKey_) List lines)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _OrderDto() when $default != null: + return $default( + _that.id, + _that.kind, + _that.salePointId, + _that.salePointName, + _that.customerId, + _that.customerName, + _that.userId, + _that.userName, + _that.status, + _that.paymentStatus, + _that.isPaid, + _that.number, + _that.total, + _that.createdAt, + _that.modifiedAt, + _that.lines); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: OrderDto.idKey_) String id, + @JsonKey(name: OrderDto.kindKey_) DocumentKind kind, + @JsonKey(name: OrderDto.salePointIdKey_) String salePointId, + @JsonKey(name: OrderDto.salePointNameKey_) String salePointName, + @JsonKey(name: OrderDto.customerIdKey_) String? customerId, + @JsonKey(name: OrderDto.customerNameKey_) String? customerName, + @JsonKey(name: OrderDto.userIdKey_) String userId, + @JsonKey(name: OrderDto.userNameKey_) String userName, + @JsonKey(name: OrderDto.statusKey_) OrderStatus status, + @JsonKey(name: OrderDto.paymentStatusKey_) + OrderPaymentStatus paymentStatus, + @JsonKey(name: OrderDto.isPaidKey_) bool isPaid, + @JsonKey(name: OrderDto.numberKey_) String number, + @JsonKey(name: OrderDto.totalKey_) double total, + @JsonKey(name: OrderDto.createdAtKey_) DateTime createdAt, + @JsonKey(name: OrderDto.modifiedAtKey_) DateTime modifiedAt, + @JsonKey(name: OrderDto.linesKey_) List lines) + $default, + ) { + final _that = this; + switch (_that) { + case _OrderDto(): + return $default( + _that.id, + _that.kind, + _that.salePointId, + _that.salePointName, + _that.customerId, + _that.customerName, + _that.userId, + _that.userName, + _that.status, + _that.paymentStatus, + _that.isPaid, + _that.number, + _that.total, + _that.createdAt, + _that.modifiedAt, + _that.lines); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: OrderDto.idKey_) String id, + @JsonKey(name: OrderDto.kindKey_) DocumentKind kind, + @JsonKey(name: OrderDto.salePointIdKey_) String salePointId, + @JsonKey(name: OrderDto.salePointNameKey_) String salePointName, + @JsonKey(name: OrderDto.customerIdKey_) String? customerId, + @JsonKey(name: OrderDto.customerNameKey_) String? customerName, + @JsonKey(name: OrderDto.userIdKey_) String userId, + @JsonKey(name: OrderDto.userNameKey_) String userName, + @JsonKey(name: OrderDto.statusKey_) OrderStatus status, + @JsonKey(name: OrderDto.paymentStatusKey_) + OrderPaymentStatus paymentStatus, + @JsonKey(name: OrderDto.isPaidKey_) bool isPaid, + @JsonKey(name: OrderDto.numberKey_) String number, + @JsonKey(name: OrderDto.totalKey_) double total, + @JsonKey(name: OrderDto.createdAtKey_) DateTime createdAt, + @JsonKey(name: OrderDto.modifiedAtKey_) DateTime modifiedAt, + @JsonKey(name: OrderDto.linesKey_) List lines)? + $default, + ) { + final _that = this; + switch (_that) { + case _OrderDto() when $default != null: + return $default( + _that.id, + _that.kind, + _that.salePointId, + _that.salePointName, + _that.customerId, + _that.customerName, + _that.userId, + _that.userName, + _that.status, + _that.paymentStatus, + _that.isPaid, + _that.number, + _that.total, + _that.createdAt, + _that.modifiedAt, + _that.lines); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _OrderDto extends OrderDto { + const _OrderDto( + {@JsonKey(name: OrderDto.idKey_) required this.id, + @JsonKey(name: OrderDto.kindKey_) required this.kind, + @JsonKey(name: OrderDto.salePointIdKey_) required this.salePointId, + @JsonKey(name: OrderDto.salePointNameKey_) required this.salePointName, + @JsonKey(name: OrderDto.customerIdKey_) this.customerId, + @JsonKey(name: OrderDto.customerNameKey_) this.customerName, + @JsonKey(name: OrderDto.userIdKey_) required this.userId, + @JsonKey(name: OrderDto.userNameKey_) required this.userName, + @JsonKey(name: OrderDto.statusKey_) required this.status, + @JsonKey(name: OrderDto.paymentStatusKey_) required this.paymentStatus, + @JsonKey(name: OrderDto.isPaidKey_) required this.isPaid, + @JsonKey(name: OrderDto.numberKey_) required this.number, + @JsonKey(name: OrderDto.totalKey_) required this.total, + @JsonKey(name: OrderDto.createdAtKey_) required this.createdAt, + @JsonKey(name: OrderDto.modifiedAtKey_) required this.modifiedAt, + @JsonKey(name: OrderDto.linesKey_) + required final List lines}) + : _lines = lines, + super._(); + factory _OrderDto.fromJson(Map json) => + _$OrderDtoFromJson(json); + + /// id + @override + @JsonKey(name: OrderDto.idKey_) + final String id; + + /// kind + @override + @JsonKey(name: OrderDto.kindKey_) + final DocumentKind kind; + + /// salePointId + @override + @JsonKey(name: OrderDto.salePointIdKey_) + final String salePointId; + + /// salePointName + @override + @JsonKey(name: OrderDto.salePointNameKey_) + final String salePointName; + + /// customerId + @override + @JsonKey(name: OrderDto.customerIdKey_) + final String? customerId; + + /// customerName + @override + @JsonKey(name: OrderDto.customerNameKey_) + final String? customerName; + + /// userId + @override + @JsonKey(name: OrderDto.userIdKey_) + final String userId; + + /// userName + @override + @JsonKey(name: OrderDto.userNameKey_) + final String userName; + + /// status + @override + @JsonKey(name: OrderDto.statusKey_) + final OrderStatus status; + + /// paymentStatus + @override + @JsonKey(name: OrderDto.paymentStatusKey_) + final OrderPaymentStatus paymentStatus; + + /// isPaid + @override + @JsonKey(name: OrderDto.isPaidKey_) + final bool isPaid; + + /// number + @override + @JsonKey(name: OrderDto.numberKey_) + final String number; + + /// total + @override + @JsonKey(name: OrderDto.totalKey_) + final double total; + + /// createdAt + @override + @JsonKey(name: OrderDto.createdAtKey_) + final DateTime createdAt; + + /// modifiedAt + @override + @JsonKey(name: OrderDto.modifiedAtKey_) + final DateTime modifiedAt; + + /// lines + final List _lines; + + /// lines + @override + @JsonKey(name: OrderDto.linesKey_) + List get lines { + if (_lines is EqualUnmodifiableListView) return _lines; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_lines); + } + + /// Create a copy of OrderDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$OrderDtoCopyWith<_OrderDto> get copyWith => + __$OrderDtoCopyWithImpl<_OrderDto>(this, _$identity); + + @override + Map toJson() { + return _$OrderDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _OrderDto && + (identical(other.id, id) || other.id == id) && + (identical(other.kind, kind) || other.kind == kind) && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId) && + (identical(other.salePointName, salePointName) || + other.salePointName == salePointName) && + (identical(other.customerId, customerId) || + other.customerId == customerId) && + (identical(other.customerName, customerName) || + other.customerName == customerName) && + (identical(other.userId, userId) || other.userId == userId) && + (identical(other.userName, userName) || + other.userName == userName) && + (identical(other.status, status) || other.status == status) && + (identical(other.paymentStatus, paymentStatus) || + other.paymentStatus == paymentStatus) && + (identical(other.isPaid, isPaid) || other.isPaid == isPaid) && + (identical(other.number, number) || other.number == number) && + (identical(other.total, total) || other.total == total) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.modifiedAt, modifiedAt) || + other.modifiedAt == modifiedAt) && + const DeepCollectionEquality().equals(other._lines, _lines)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + kind, + salePointId, + salePointName, + customerId, + customerName, + userId, + userName, + status, + paymentStatus, + isPaid, + number, + total, + createdAt, + modifiedAt, + const DeepCollectionEquality().hash(_lines)); + + @override + String toString() { + return 'OrderDto(id: $id, kind: $kind, salePointId: $salePointId, salePointName: $salePointName, customerId: $customerId, customerName: $customerName, userId: $userId, userName: $userName, status: $status, paymentStatus: $paymentStatus, isPaid: $isPaid, number: $number, total: $total, createdAt: $createdAt, modifiedAt: $modifiedAt, lines: $lines)'; + } +} + +/// @nodoc +abstract mixin class _$OrderDtoCopyWith<$Res> + implements $OrderDtoCopyWith<$Res> { + factory _$OrderDtoCopyWith(_OrderDto value, $Res Function(_OrderDto) _then) = + __$OrderDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: OrderDto.idKey_) String id, + @JsonKey(name: OrderDto.kindKey_) DocumentKind kind, + @JsonKey(name: OrderDto.salePointIdKey_) String salePointId, + @JsonKey(name: OrderDto.salePointNameKey_) String salePointName, + @JsonKey(name: OrderDto.customerIdKey_) String? customerId, + @JsonKey(name: OrderDto.customerNameKey_) String? customerName, + @JsonKey(name: OrderDto.userIdKey_) String userId, + @JsonKey(name: OrderDto.userNameKey_) String userName, + @JsonKey(name: OrderDto.statusKey_) OrderStatus status, + @JsonKey(name: OrderDto.paymentStatusKey_) + OrderPaymentStatus paymentStatus, + @JsonKey(name: OrderDto.isPaidKey_) bool isPaid, + @JsonKey(name: OrderDto.numberKey_) String number, + @JsonKey(name: OrderDto.totalKey_) double total, + @JsonKey(name: OrderDto.createdAtKey_) DateTime createdAt, + @JsonKey(name: OrderDto.modifiedAtKey_) DateTime modifiedAt, + @JsonKey(name: OrderDto.linesKey_) List lines}); +} + +/// @nodoc +class __$OrderDtoCopyWithImpl<$Res> implements _$OrderDtoCopyWith<$Res> { + __$OrderDtoCopyWithImpl(this._self, this._then); + + final _OrderDto _self; + final $Res Function(_OrderDto) _then; + + /// Create a copy of OrderDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? kind = null, + Object? salePointId = null, + Object? salePointName = null, + Object? customerId = freezed, + Object? customerName = freezed, + Object? userId = null, + Object? userName = null, + Object? status = null, + Object? paymentStatus = null, + Object? isPaid = null, + Object? number = null, + Object? total = null, + Object? createdAt = null, + Object? modifiedAt = null, + Object? lines = null, + }) { + return _then(_OrderDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + kind: null == kind + ? _self.kind + : kind // ignore: cast_nullable_to_non_nullable + as DocumentKind, + salePointId: null == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String, + salePointName: null == salePointName + ? _self.salePointName + : salePointName // ignore: cast_nullable_to_non_nullable + as String, + customerId: freezed == customerId + ? _self.customerId + : customerId // ignore: cast_nullable_to_non_nullable + as String?, + customerName: freezed == customerName + ? _self.customerName + : customerName // ignore: cast_nullable_to_non_nullable + as String?, + userId: null == userId + ? _self.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + userName: null == userName + ? _self.userName + : userName // ignore: cast_nullable_to_non_nullable + as String, + status: null == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as OrderStatus, + paymentStatus: null == paymentStatus + ? _self.paymentStatus + : paymentStatus // ignore: cast_nullable_to_non_nullable + as OrderPaymentStatus, + isPaid: null == isPaid + ? _self.isPaid + : isPaid // ignore: cast_nullable_to_non_nullable + as bool, + number: null == number + ? _self.number + : number // ignore: cast_nullable_to_non_nullable + as String, + total: null == total + ? _self.total + : total // ignore: cast_nullable_to_non_nullable + as double, + createdAt: null == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + modifiedAt: null == modifiedAt + ? _self.modifiedAt + : modifiedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + lines: null == lines + ? _self._lines + : lines // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto.g.dart new file mode 100644 index 00000000..8ca5faca --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto.g.dart @@ -0,0 +1,48 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'order_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_OrderDto _$OrderDtoFromJson(Map json) => _OrderDto( + id: json['id'] as String, + kind: DocumentKind.fromJson(json['kind'] as String), + salePointId: json['sale_point_id'] as String, + salePointName: json['sale_point_name'] as String, + customerId: json['customer_id'] as String?, + customerName: json['customer_name'] as String?, + userId: json['user_id'] as String, + userName: json['user_name'] as String, + status: OrderStatus.fromJson(json['status'] as String), + paymentStatus: + OrderPaymentStatus.fromJson(json['payment_status'] as String), + isPaid: json['is_paid'] as bool, + number: json['number'] as String, + total: (json['total'] as num).toDouble(), + createdAt: DateTime.parse(json['created_at'] as String), + modifiedAt: DateTime.parse(json['modified_at'] as String), + lines: (json['lines'] as List) + .map((e) => OrderLineDto.fromJson(e as Map)) + .toList(), + ); + +Map _$OrderDtoToJson(_OrderDto instance) => { + 'id': instance.id, + 'kind': instance.kind.toJson(), + 'sale_point_id': instance.salePointId, + 'sale_point_name': instance.salePointName, + if (instance.customerId case final value?) 'customer_id': value, + if (instance.customerName case final value?) 'customer_name': value, + 'user_id': instance.userId, + 'user_name': instance.userName, + 'status': instance.status.toJson(), + 'payment_status': instance.paymentStatus.toJson(), + 'is_paid': instance.isPaid, + 'number': instance.number, + 'total': instance.total, + 'created_at': instance.createdAt.toIso8601String(), + 'modified_at': instance.modifiedAt.toIso8601String(), + 'lines': instance.lines.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_dto_paged_result.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto_paged_result.dart new file mode 100644 index 00000000..caac4391 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto_paged_result.dart @@ -0,0 +1,46 @@ +/// OrderDtoPagedResult +/// { +/// "properties": { +/// "items": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/OrderDto" +/// } +/// }, +/// "next_page_token": { +/// "type": "string", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "items" +/// ], +/// "additionalProperties": false +/// } +library order_dto_paged_result; + +import 'exports.dart'; +part 'order_dto_paged_result.freezed.dart'; +part 'order_dto_paged_result.g.dart'; // OrderDtoPagedResult + +@freezed +abstract class OrderDtoPagedResult with _$OrderDtoPagedResult { + const OrderDtoPagedResult._(); + + @jsonSerializable + const factory OrderDtoPagedResult({ + /// items + @JsonKey(name: OrderDtoPagedResult.itemsKey_) required List items, + + /// nextPageToken + @JsonKey(name: OrderDtoPagedResult.nextPageTokenKey_) String? nextPageToken, + }) = _OrderDtoPagedResult; + + factory OrderDtoPagedResult.fromJson(Map json) => + _$OrderDtoPagedResultFromJson(json); + + static const String itemsKey_ = r'items'; + + static const String nextPageTokenKey_ = r'next_page_token'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_dto_paged_result.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto_paged_result.freezed.dart new file mode 100644 index 00000000..ff30f2e0 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto_paged_result.freezed.dart @@ -0,0 +1,374 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'order_dto_paged_result.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$OrderDtoPagedResult { + /// items + @JsonKey(name: OrderDtoPagedResult.itemsKey_) + List get items; + + /// nextPageToken + @JsonKey(name: OrderDtoPagedResult.nextPageTokenKey_) + String? get nextPageToken; + + /// Create a copy of OrderDtoPagedResult + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OrderDtoPagedResultCopyWith get copyWith => + _$OrderDtoPagedResultCopyWithImpl( + this as OrderDtoPagedResult, _$identity); + + /// Serializes this OrderDtoPagedResult to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OrderDtoPagedResult && + const DeepCollectionEquality().equals(other.items, items) && + (identical(other.nextPageToken, nextPageToken) || + other.nextPageToken == nextPageToken)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(items), nextPageToken); + + @override + String toString() { + return 'OrderDtoPagedResult(items: $items, nextPageToken: $nextPageToken)'; + } +} + +/// @nodoc +abstract mixin class $OrderDtoPagedResultCopyWith<$Res> { + factory $OrderDtoPagedResultCopyWith( + OrderDtoPagedResult value, $Res Function(OrderDtoPagedResult) _then) = + _$OrderDtoPagedResultCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: OrderDtoPagedResult.itemsKey_) List items, + @JsonKey(name: OrderDtoPagedResult.nextPageTokenKey_) + String? nextPageToken}); +} + +/// @nodoc +class _$OrderDtoPagedResultCopyWithImpl<$Res> + implements $OrderDtoPagedResultCopyWith<$Res> { + _$OrderDtoPagedResultCopyWithImpl(this._self, this._then); + + final OrderDtoPagedResult _self; + final $Res Function(OrderDtoPagedResult) _then; + + /// Create a copy of OrderDtoPagedResult + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? items = null, + Object? nextPageToken = freezed, + }) { + return _then(_self.copyWith( + items: null == items + ? _self.items + : items // ignore: cast_nullable_to_non_nullable + as List, + nextPageToken: freezed == nextPageToken + ? _self.nextPageToken + : nextPageToken // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// Adds pattern-matching-related methods to [OrderDtoPagedResult]. +extension OrderDtoPagedResultPatterns on OrderDtoPagedResult { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_OrderDtoPagedResult value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _OrderDtoPagedResult() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_OrderDtoPagedResult value) $default, + ) { + final _that = this; + switch (_that) { + case _OrderDtoPagedResult(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_OrderDtoPagedResult value)? $default, + ) { + final _that = this; + switch (_that) { + case _OrderDtoPagedResult() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: OrderDtoPagedResult.itemsKey_) List items, + @JsonKey(name: OrderDtoPagedResult.nextPageTokenKey_) + String? nextPageToken)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _OrderDtoPagedResult() when $default != null: + return $default(_that.items, _that.nextPageToken); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: OrderDtoPagedResult.itemsKey_) List items, + @JsonKey(name: OrderDtoPagedResult.nextPageTokenKey_) + String? nextPageToken) + $default, + ) { + final _that = this; + switch (_that) { + case _OrderDtoPagedResult(): + return $default(_that.items, _that.nextPageToken); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: OrderDtoPagedResult.itemsKey_) List items, + @JsonKey(name: OrderDtoPagedResult.nextPageTokenKey_) + String? nextPageToken)? + $default, + ) { + final _that = this; + switch (_that) { + case _OrderDtoPagedResult() when $default != null: + return $default(_that.items, _that.nextPageToken); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _OrderDtoPagedResult extends OrderDtoPagedResult { + const _OrderDtoPagedResult( + {@JsonKey(name: OrderDtoPagedResult.itemsKey_) + required final List items, + @JsonKey(name: OrderDtoPagedResult.nextPageTokenKey_) this.nextPageToken}) + : _items = items, + super._(); + factory _OrderDtoPagedResult.fromJson(Map json) => + _$OrderDtoPagedResultFromJson(json); + + /// items + final List _items; + + /// items + @override + @JsonKey(name: OrderDtoPagedResult.itemsKey_) + List get items { + if (_items is EqualUnmodifiableListView) return _items; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_items); + } + + /// nextPageToken + @override + @JsonKey(name: OrderDtoPagedResult.nextPageTokenKey_) + final String? nextPageToken; + + /// Create a copy of OrderDtoPagedResult + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$OrderDtoPagedResultCopyWith<_OrderDtoPagedResult> get copyWith => + __$OrderDtoPagedResultCopyWithImpl<_OrderDtoPagedResult>( + this, _$identity); + + @override + Map toJson() { + return _$OrderDtoPagedResultToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _OrderDtoPagedResult && + const DeepCollectionEquality().equals(other._items, _items) && + (identical(other.nextPageToken, nextPageToken) || + other.nextPageToken == nextPageToken)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_items), nextPageToken); + + @override + String toString() { + return 'OrderDtoPagedResult(items: $items, nextPageToken: $nextPageToken)'; + } +} + +/// @nodoc +abstract mixin class _$OrderDtoPagedResultCopyWith<$Res> + implements $OrderDtoPagedResultCopyWith<$Res> { + factory _$OrderDtoPagedResultCopyWith(_OrderDtoPagedResult value, + $Res Function(_OrderDtoPagedResult) _then) = + __$OrderDtoPagedResultCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: OrderDtoPagedResult.itemsKey_) List items, + @JsonKey(name: OrderDtoPagedResult.nextPageTokenKey_) + String? nextPageToken}); +} + +/// @nodoc +class __$OrderDtoPagedResultCopyWithImpl<$Res> + implements _$OrderDtoPagedResultCopyWith<$Res> { + __$OrderDtoPagedResultCopyWithImpl(this._self, this._then); + + final _OrderDtoPagedResult _self; + final $Res Function(_OrderDtoPagedResult) _then; + + /// Create a copy of OrderDtoPagedResult + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? items = null, + Object? nextPageToken = freezed, + }) { + return _then(_OrderDtoPagedResult( + items: null == items + ? _self._items + : items // ignore: cast_nullable_to_non_nullable + as List, + nextPageToken: freezed == nextPageToken + ? _self.nextPageToken + : nextPageToken // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_dto_paged_result.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto_paged_result.g.dart new file mode 100644 index 00000000..e28b2b72 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_dto_paged_result.g.dart @@ -0,0 +1,22 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'order_dto_paged_result.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_OrderDtoPagedResult _$OrderDtoPagedResultFromJson(Map json) => + _OrderDtoPagedResult( + items: (json['items'] as List) + .map((e) => OrderDto.fromJson(e as Map)) + .toList(), + nextPageToken: json['next_page_token'] as String?, + ); + +Map _$OrderDtoPagedResultToJson( + _OrderDtoPagedResult instance) => + { + 'items': instance.items.map((e) => e.toJson()).toList(), + if (instance.nextPageToken case final value?) 'next_page_token': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_line_change.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_change.dart new file mode 100644 index 00000000..874e4587 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_change.dart @@ -0,0 +1,105 @@ +/// OrderLineChange +/// { +/// "oneOf": [ +/// { +/// "$ref": "#/components/schemas/CreateOrderLine" +/// }, +/// { +/// "$ref": "#/components/schemas/UpdateOrderLine" +/// }, +/// { +/// "$ref": "#/components/schemas/DeleteOrderLine" +/// } +/// ], +/// "title": "OrderLineChange", +/// "discriminator": { +/// "propertyName": "type", +/// "mapping": { +/// "create": "#/components/schemas/CreateOrderLine", +/// "update": "#/components/schemas/UpdateOrderLine", +/// "delete": "#/components/schemas/DeleteOrderLine" +/// } +/// }, +/// "runtimeType": "oneOf" +/// } +library order_line_change; + +import 'exports.dart'; +part 'order_line_change.freezed.dart'; +part 'order_line_change.g.dart'; // OrderLineChange + +@Freezed(fallbackUnion: r"fallback", unionKey: r"type") +sealed class OrderLineChange with _$OrderLineChange { + const OrderLineChange._(); + + @jsonSerializable + @FreezedUnionValue(r"create") + const factory OrderLineChange.create({ + /// productId + @JsonKey(name: OrderLineChange.productIdKey_) required String productId, + + /// presentationId + @JsonKey(name: OrderLineChange.presentationIdKey_) + required String presentationId, + + /// variantId + @JsonKey(name: OrderLineChange.variantIdKey_) String? variantId, + + /// quantity + @JsonKey(name: OrderLineChange.quantityKey_) required int quantity, + + /// salePrice + @JsonKey(name: OrderLineChange.salePriceKey_) double? salePrice, + + /// type + @Default('create') @JsonKey(name: OrderLineChange.typeKey_) String type, + }) = OrderLineChangeCreate; + + @jsonSerializable + @FreezedUnionValue(r"update") + const factory OrderLineChange.update({ + /// id + @JsonKey(name: OrderLineChange.idKey_) required String id, + + /// quantity + @JsonKey(name: OrderLineChange.quantityKey_) int? quantity, + + /// salePrice + @JsonKey(name: OrderLineChange.salePriceKey_) double? salePrice, + + /// type + @Default('update') @JsonKey(name: OrderLineChange.typeKey_) String type, + }) = OrderLineChangeUpdate; + + @jsonSerializable + @FreezedUnionValue(r"delete") + const factory OrderLineChange.delete({ + /// id + @JsonKey(name: OrderLineChange.idKey_) required String id, + + /// type + @Default('delete') @JsonKey(name: OrderLineChange.typeKey_) String type, + }) = OrderLineChangeDelete; + + @jsonSerializable + @FreezedUnionValue(r"fallback") + const factory OrderLineChange.fallback({Map? json}) = + OrderLineChangeFallback; + + factory OrderLineChange.fromJson(Map json) => + _$OrderLineChangeFromJson(json); + + static const String productIdKey_ = r'product_id'; + + static const String presentationIdKey_ = r'presentation_id'; + + static const String variantIdKey_ = r'variant_id'; + + static const String quantityKey_ = r'quantity'; + + static const String salePriceKey_ = r'sale_price'; + + static const String typeKey_ = r'type'; + + static const String idKey_ = r'id'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_line_change.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_change.freezed.dart new file mode 100644 index 00000000..3205c1b4 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_change.freezed.dart @@ -0,0 +1,758 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'order_line_change.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; +OrderLineChange _$OrderLineChangeFromJson(Map json) { + switch (json['type']) { + case 'create': + return OrderLineChangeCreate.fromJson(json); + case 'update': + return OrderLineChangeUpdate.fromJson(json); + case 'delete': + return OrderLineChangeDelete.fromJson(json); + + default: + return OrderLineChangeFallback.fromJson(json); + } +} + +/// @nodoc +mixin _$OrderLineChange { + /// Serializes this OrderLineChange to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is OrderLineChange); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; + + @override + String toString() { + return 'OrderLineChange()'; + } +} + +/// @nodoc +class $OrderLineChangeCopyWith<$Res> { + $OrderLineChangeCopyWith( + OrderLineChange _, $Res Function(OrderLineChange) __); +} + +/// Adds pattern-matching-related methods to [OrderLineChange]. +extension OrderLineChangePatterns on OrderLineChange { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap({ + TResult Function(OrderLineChangeCreate value)? create, + TResult Function(OrderLineChangeUpdate value)? update, + TResult Function(OrderLineChangeDelete value)? delete, + TResult Function(OrderLineChangeFallback value)? fallback, + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case OrderLineChangeCreate() when create != null: + return create(_that); + case OrderLineChangeUpdate() when update != null: + return update(_that); + case OrderLineChangeDelete() when delete != null: + return delete(_that); + case OrderLineChangeFallback() when fallback != null: + return fallback(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map({ + required TResult Function(OrderLineChangeCreate value) create, + required TResult Function(OrderLineChangeUpdate value) update, + required TResult Function(OrderLineChangeDelete value) delete, + required TResult Function(OrderLineChangeFallback value) fallback, + }) { + final _that = this; + switch (_that) { + case OrderLineChangeCreate(): + return create(_that); + case OrderLineChangeUpdate(): + return update(_that); + case OrderLineChangeDelete(): + return delete(_that); + case OrderLineChangeFallback(): + return fallback(_that); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(OrderLineChangeCreate value)? create, + TResult? Function(OrderLineChangeUpdate value)? update, + TResult? Function(OrderLineChangeDelete value)? delete, + TResult? Function(OrderLineChangeFallback value)? fallback, + }) { + final _that = this; + switch (_that) { + case OrderLineChangeCreate() when create != null: + return create(_that); + case OrderLineChangeUpdate() when update != null: + return update(_that); + case OrderLineChangeDelete() when delete != null: + return delete(_that); + case OrderLineChangeFallback() when fallback != null: + return fallback(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: OrderLineChange.productIdKey_) String productId, + @JsonKey(name: OrderLineChange.presentationIdKey_) + String presentationId, + @JsonKey(name: OrderLineChange.variantIdKey_) String? variantId, + @JsonKey(name: OrderLineChange.quantityKey_) int quantity, + @JsonKey(name: OrderLineChange.salePriceKey_) double? salePrice, + @JsonKey(name: OrderLineChange.typeKey_) String type)? + create, + TResult Function( + @JsonKey(name: OrderLineChange.idKey_) String id, + @JsonKey(name: OrderLineChange.quantityKey_) int? quantity, + @JsonKey(name: OrderLineChange.salePriceKey_) double? salePrice, + @JsonKey(name: OrderLineChange.typeKey_) String type)? + update, + TResult Function(@JsonKey(name: OrderLineChange.idKey_) String id, + @JsonKey(name: OrderLineChange.typeKey_) String type)? + delete, + TResult Function(Map? json)? fallback, + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case OrderLineChangeCreate() when create != null: + return create(_that.productId, _that.presentationId, _that.variantId, + _that.quantity, _that.salePrice, _that.type); + case OrderLineChangeUpdate() when update != null: + return update(_that.id, _that.quantity, _that.salePrice, _that.type); + case OrderLineChangeDelete() when delete != null: + return delete(_that.id, _that.type); + case OrderLineChangeFallback() when fallback != null: + return fallback(_that.json); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: OrderLineChange.productIdKey_) String productId, + @JsonKey(name: OrderLineChange.presentationIdKey_) + String presentationId, + @JsonKey(name: OrderLineChange.variantIdKey_) String? variantId, + @JsonKey(name: OrderLineChange.quantityKey_) int quantity, + @JsonKey(name: OrderLineChange.salePriceKey_) double? salePrice, + @JsonKey(name: OrderLineChange.typeKey_) String type) + create, + required TResult Function( + @JsonKey(name: OrderLineChange.idKey_) String id, + @JsonKey(name: OrderLineChange.quantityKey_) int? quantity, + @JsonKey(name: OrderLineChange.salePriceKey_) double? salePrice, + @JsonKey(name: OrderLineChange.typeKey_) String type) + update, + required TResult Function(@JsonKey(name: OrderLineChange.idKey_) String id, + @JsonKey(name: OrderLineChange.typeKey_) String type) + delete, + required TResult Function(Map? json) fallback, + }) { + final _that = this; + switch (_that) { + case OrderLineChangeCreate(): + return create(_that.productId, _that.presentationId, _that.variantId, + _that.quantity, _that.salePrice, _that.type); + case OrderLineChangeUpdate(): + return update(_that.id, _that.quantity, _that.salePrice, _that.type); + case OrderLineChangeDelete(): + return delete(_that.id, _that.type); + case OrderLineChangeFallback(): + return fallback(_that.json); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: OrderLineChange.productIdKey_) String productId, + @JsonKey(name: OrderLineChange.presentationIdKey_) + String presentationId, + @JsonKey(name: OrderLineChange.variantIdKey_) String? variantId, + @JsonKey(name: OrderLineChange.quantityKey_) int quantity, + @JsonKey(name: OrderLineChange.salePriceKey_) double? salePrice, + @JsonKey(name: OrderLineChange.typeKey_) String type)? + create, + TResult? Function( + @JsonKey(name: OrderLineChange.idKey_) String id, + @JsonKey(name: OrderLineChange.quantityKey_) int? quantity, + @JsonKey(name: OrderLineChange.salePriceKey_) double? salePrice, + @JsonKey(name: OrderLineChange.typeKey_) String type)? + update, + TResult? Function(@JsonKey(name: OrderLineChange.idKey_) String id, + @JsonKey(name: OrderLineChange.typeKey_) String type)? + delete, + TResult? Function(Map? json)? fallback, + }) { + final _that = this; + switch (_that) { + case OrderLineChangeCreate() when create != null: + return create(_that.productId, _that.presentationId, _that.variantId, + _that.quantity, _that.salePrice, _that.type); + case OrderLineChangeUpdate() when update != null: + return update(_that.id, _that.quantity, _that.salePrice, _that.type); + case OrderLineChangeDelete() when delete != null: + return delete(_that.id, _that.type); + case OrderLineChangeFallback() when fallback != null: + return fallback(_that.json); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class OrderLineChangeCreate extends OrderLineChange { + const OrderLineChangeCreate( + {@JsonKey(name: OrderLineChange.productIdKey_) required this.productId, + @JsonKey(name: OrderLineChange.presentationIdKey_) + required this.presentationId, + @JsonKey(name: OrderLineChange.variantIdKey_) this.variantId, + @JsonKey(name: OrderLineChange.quantityKey_) required this.quantity, + @JsonKey(name: OrderLineChange.salePriceKey_) this.salePrice, + @JsonKey(name: OrderLineChange.typeKey_) this.type = 'create'}) + : super._(); + factory OrderLineChangeCreate.fromJson(Map json) => + _$OrderLineChangeCreateFromJson(json); + + /// productId + @JsonKey(name: OrderLineChange.productIdKey_) + final String productId; + + /// presentationId + @JsonKey(name: OrderLineChange.presentationIdKey_) + final String presentationId; + + /// variantId + @JsonKey(name: OrderLineChange.variantIdKey_) + final String? variantId; + + /// quantity + @JsonKey(name: OrderLineChange.quantityKey_) + final int quantity; + + /// salePrice + @JsonKey(name: OrderLineChange.salePriceKey_) + final double? salePrice; + + /// type + @JsonKey(name: OrderLineChange.typeKey_) + final String type; + + /// Create a copy of OrderLineChange + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OrderLineChangeCreateCopyWith get copyWith => + _$OrderLineChangeCreateCopyWithImpl( + this, _$identity); + + @override + Map toJson() { + return _$OrderLineChangeCreateToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OrderLineChangeCreate && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.presentationId, presentationId) || + other.presentationId == presentationId) && + (identical(other.variantId, variantId) || + other.variantId == variantId) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, productId, presentationId, + variantId, quantity, salePrice, type); + + @override + String toString() { + return 'OrderLineChange.create(productId: $productId, presentationId: $presentationId, variantId: $variantId, quantity: $quantity, salePrice: $salePrice, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $OrderLineChangeCreateCopyWith<$Res> + implements $OrderLineChangeCopyWith<$Res> { + factory $OrderLineChangeCreateCopyWith(OrderLineChangeCreate value, + $Res Function(OrderLineChangeCreate) _then) = + _$OrderLineChangeCreateCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: OrderLineChange.productIdKey_) String productId, + @JsonKey(name: OrderLineChange.presentationIdKey_) String presentationId, + @JsonKey(name: OrderLineChange.variantIdKey_) String? variantId, + @JsonKey(name: OrderLineChange.quantityKey_) int quantity, + @JsonKey(name: OrderLineChange.salePriceKey_) double? salePrice, + @JsonKey(name: OrderLineChange.typeKey_) String type}); +} + +/// @nodoc +class _$OrderLineChangeCreateCopyWithImpl<$Res> + implements $OrderLineChangeCreateCopyWith<$Res> { + _$OrderLineChangeCreateCopyWithImpl(this._self, this._then); + + final OrderLineChangeCreate _self; + final $Res Function(OrderLineChangeCreate) _then; + + /// Create a copy of OrderLineChange + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({ + Object? productId = null, + Object? presentationId = null, + Object? variantId = freezed, + Object? quantity = null, + Object? salePrice = freezed, + Object? type = null, + }) { + return _then(OrderLineChangeCreate( + productId: null == productId + ? _self.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + presentationId: null == presentationId + ? _self.presentationId + : presentationId // ignore: cast_nullable_to_non_nullable + as String, + variantId: freezed == variantId + ? _self.variantId + : variantId // ignore: cast_nullable_to_non_nullable + as String?, + quantity: null == quantity + ? _self.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +@jsonSerializable +class OrderLineChangeUpdate extends OrderLineChange { + const OrderLineChangeUpdate( + {@JsonKey(name: OrderLineChange.idKey_) required this.id, + @JsonKey(name: OrderLineChange.quantityKey_) this.quantity, + @JsonKey(name: OrderLineChange.salePriceKey_) this.salePrice, + @JsonKey(name: OrderLineChange.typeKey_) this.type = 'update'}) + : super._(); + factory OrderLineChangeUpdate.fromJson(Map json) => + _$OrderLineChangeUpdateFromJson(json); + + /// id + @JsonKey(name: OrderLineChange.idKey_) + final String id; + + /// quantity + @JsonKey(name: OrderLineChange.quantityKey_) + final int? quantity; + + /// salePrice + @JsonKey(name: OrderLineChange.salePriceKey_) + final double? salePrice; + + /// type + @JsonKey(name: OrderLineChange.typeKey_) + final String type; + + /// Create a copy of OrderLineChange + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OrderLineChangeUpdateCopyWith get copyWith => + _$OrderLineChangeUpdateCopyWithImpl( + this, _$identity); + + @override + Map toJson() { + return _$OrderLineChangeUpdateToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OrderLineChangeUpdate && + (identical(other.id, id) || other.id == id) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, quantity, salePrice, type); + + @override + String toString() { + return 'OrderLineChange.update(id: $id, quantity: $quantity, salePrice: $salePrice, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $OrderLineChangeUpdateCopyWith<$Res> + implements $OrderLineChangeCopyWith<$Res> { + factory $OrderLineChangeUpdateCopyWith(OrderLineChangeUpdate value, + $Res Function(OrderLineChangeUpdate) _then) = + _$OrderLineChangeUpdateCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: OrderLineChange.idKey_) String id, + @JsonKey(name: OrderLineChange.quantityKey_) int? quantity, + @JsonKey(name: OrderLineChange.salePriceKey_) double? salePrice, + @JsonKey(name: OrderLineChange.typeKey_) String type}); +} + +/// @nodoc +class _$OrderLineChangeUpdateCopyWithImpl<$Res> + implements $OrderLineChangeUpdateCopyWith<$Res> { + _$OrderLineChangeUpdateCopyWithImpl(this._self, this._then); + + final OrderLineChangeUpdate _self; + final $Res Function(OrderLineChangeUpdate) _then; + + /// Create a copy of OrderLineChange + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? quantity = freezed, + Object? salePrice = freezed, + Object? type = null, + }) { + return _then(OrderLineChangeUpdate( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + quantity: freezed == quantity + ? _self.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int?, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +@jsonSerializable +class OrderLineChangeDelete extends OrderLineChange { + const OrderLineChangeDelete( + {@JsonKey(name: OrderLineChange.idKey_) required this.id, + @JsonKey(name: OrderLineChange.typeKey_) this.type = 'delete'}) + : super._(); + factory OrderLineChangeDelete.fromJson(Map json) => + _$OrderLineChangeDeleteFromJson(json); + + /// id + @JsonKey(name: OrderLineChange.idKey_) + final String id; + + /// type + @JsonKey(name: OrderLineChange.typeKey_) + final String type; + + /// Create a copy of OrderLineChange + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OrderLineChangeDeleteCopyWith get copyWith => + _$OrderLineChangeDeleteCopyWithImpl( + this, _$identity); + + @override + Map toJson() { + return _$OrderLineChangeDeleteToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OrderLineChangeDelete && + (identical(other.id, id) || other.id == id) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, type); + + @override + String toString() { + return 'OrderLineChange.delete(id: $id, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $OrderLineChangeDeleteCopyWith<$Res> + implements $OrderLineChangeCopyWith<$Res> { + factory $OrderLineChangeDeleteCopyWith(OrderLineChangeDelete value, + $Res Function(OrderLineChangeDelete) _then) = + _$OrderLineChangeDeleteCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: OrderLineChange.idKey_) String id, + @JsonKey(name: OrderLineChange.typeKey_) String type}); +} + +/// @nodoc +class _$OrderLineChangeDeleteCopyWithImpl<$Res> + implements $OrderLineChangeDeleteCopyWith<$Res> { + _$OrderLineChangeDeleteCopyWithImpl(this._self, this._then); + + final OrderLineChangeDelete _self; + final $Res Function(OrderLineChangeDelete) _then; + + /// Create a copy of OrderLineChange + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? type = null, + }) { + return _then(OrderLineChangeDelete( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +@jsonSerializable +class OrderLineChangeFallback extends OrderLineChange { + const OrderLineChangeFallback( + {final Map? json, final String? $type}) + : _json = json, + $type = $type ?? 'fallback', + super._(); + factory OrderLineChangeFallback.fromJson(Map json) => + _$OrderLineChangeFallbackFromJson(json); + + final Map? _json; + Map? get json { + final value = _json; + if (value == null) return null; + if (_json is EqualUnmodifiableMapView) return _json; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + @JsonKey(name: 'type') + final String $type; + + /// Create a copy of OrderLineChange + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OrderLineChangeFallbackCopyWith get copyWith => + _$OrderLineChangeFallbackCopyWithImpl( + this, _$identity); + + @override + Map toJson() { + return _$OrderLineChangeFallbackToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OrderLineChangeFallback && + const DeepCollectionEquality().equals(other._json, _json)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_json)); + + @override + String toString() { + return 'OrderLineChange.fallback(json: $json)'; + } +} + +/// @nodoc +abstract mixin class $OrderLineChangeFallbackCopyWith<$Res> + implements $OrderLineChangeCopyWith<$Res> { + factory $OrderLineChangeFallbackCopyWith(OrderLineChangeFallback value, + $Res Function(OrderLineChangeFallback) _then) = + _$OrderLineChangeFallbackCopyWithImpl; + @useResult + $Res call({Map? json}); +} + +/// @nodoc +class _$OrderLineChangeFallbackCopyWithImpl<$Res> + implements $OrderLineChangeFallbackCopyWith<$Res> { + _$OrderLineChangeFallbackCopyWithImpl(this._self, this._then); + + final OrderLineChangeFallback _self; + final $Res Function(OrderLineChangeFallback) _then; + + /// Create a copy of OrderLineChange + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({ + Object? json = freezed, + }) { + return _then(OrderLineChangeFallback( + json: freezed == json + ? _self._json + : json // ignore: cast_nullable_to_non_nullable + as Map?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_line_change.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_change.g.dart new file mode 100644 index 00000000..65b0be0e --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_change.g.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'order_line_change.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +OrderLineChangeCreate _$OrderLineChangeCreateFromJson( + Map json) => + OrderLineChangeCreate( + productId: json['product_id'] as String, + presentationId: json['presentation_id'] as String, + variantId: json['variant_id'] as String?, + quantity: (json['quantity'] as num).toInt(), + salePrice: (json['sale_price'] as num?)?.toDouble(), + type: json['type'] as String? ?? 'create', + ); + +Map _$OrderLineChangeCreateToJson( + OrderLineChangeCreate instance) => + { + 'product_id': instance.productId, + 'presentation_id': instance.presentationId, + if (instance.variantId case final value?) 'variant_id': value, + 'quantity': instance.quantity, + if (instance.salePrice case final value?) 'sale_price': value, + 'type': instance.type, + }; + +OrderLineChangeUpdate _$OrderLineChangeUpdateFromJson( + Map json) => + OrderLineChangeUpdate( + id: json['id'] as String, + quantity: (json['quantity'] as num?)?.toInt(), + salePrice: (json['sale_price'] as num?)?.toDouble(), + type: json['type'] as String? ?? 'update', + ); + +Map _$OrderLineChangeUpdateToJson( + OrderLineChangeUpdate instance) => + { + 'id': instance.id, + if (instance.quantity case final value?) 'quantity': value, + if (instance.salePrice case final value?) 'sale_price': value, + 'type': instance.type, + }; + +OrderLineChangeDelete _$OrderLineChangeDeleteFromJson( + Map json) => + OrderLineChangeDelete( + id: json['id'] as String, + type: json['type'] as String? ?? 'delete', + ); + +Map _$OrderLineChangeDeleteToJson( + OrderLineChangeDelete instance) => + { + 'id': instance.id, + 'type': instance.type, + }; + +OrderLineChangeFallback _$OrderLineChangeFallbackFromJson( + Map json) => + OrderLineChangeFallback( + json: json['json'] as Map?, + $type: json['type'] as String?, + ); + +Map _$OrderLineChangeFallbackToJson( + OrderLineChangeFallback instance) => + { + if (instance.json case final value?) 'json': value, + 'type': instance.$type, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_line_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_dto.dart new file mode 100644 index 00000000..f778e267 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_dto.dart @@ -0,0 +1,179 @@ +/// OrderLineDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "product_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "product_name": { +/// "type": "string" +/// }, +/// "variant_id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "variant_name": { +/// "type": "string", +/// "nullable": true +/// }, +/// "presentation_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "presentation_name": { +/// "type": "string" +/// }, +/// "presentation_quantity_multiplier": { +/// "type": "integer", +/// "format": "int32" +/// }, +/// "quantity": { +/// "type": "integer", +/// "format": "int32" +/// }, +/// "unit_price_excluding_tax": { +/// "type": "number", +/// "format": "double" +/// }, +/// "discount_percentage": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "discount_amount": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "net_excluding_tax": { +/// "type": "number", +/// "format": "double" +/// }, +/// "total_tax": { +/// "type": "number", +/// "format": "double" +/// }, +/// "total": { +/// "type": "number", +/// "format": "double" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "id", +/// "net_excluding_tax", +/// "presentation_id", +/// "presentation_name", +/// "presentation_quantity_multiplier", +/// "product_id", +/// "product_name", +/// "quantity", +/// "total", +/// "total_tax", +/// "unit_price_excluding_tax" +/// ], +/// "additionalProperties": false +/// } +library order_line_dto; + +import 'exports.dart'; +part 'order_line_dto.freezed.dart'; +part 'order_line_dto.g.dart'; // OrderLineDto + +@freezed +abstract class OrderLineDto with _$OrderLineDto { + const OrderLineDto._(); + + @jsonSerializable + const factory OrderLineDto({ + /// id + @JsonKey(name: OrderLineDto.idKey_) required String id, + + /// productId + @JsonKey(name: OrderLineDto.productIdKey_) required String productId, + + /// productName + @JsonKey(name: OrderLineDto.productNameKey_) required String productName, + + /// variantId + @JsonKey(name: OrderLineDto.variantIdKey_) String? variantId, + + /// variantName + @JsonKey(name: OrderLineDto.variantNameKey_) String? variantName, + + /// presentationId + @JsonKey(name: OrderLineDto.presentationIdKey_) + required String presentationId, + + /// presentationName + @JsonKey(name: OrderLineDto.presentationNameKey_) + required String presentationName, + + /// presentationQuantityMultiplier + @JsonKey(name: OrderLineDto.presentationQuantityMultiplierKey_) + required int presentationQuantityMultiplier, + + /// quantity + @JsonKey(name: OrderLineDto.quantityKey_) required int quantity, + + /// unitPriceExcludingTax + @JsonKey(name: OrderLineDto.unitPriceExcludingTaxKey_) + required double unitPriceExcludingTax, + + /// discountPercentage + @JsonKey(name: OrderLineDto.discountPercentageKey_) + double? discountPercentage, + + /// discountAmount + @JsonKey(name: OrderLineDto.discountAmountKey_) double? discountAmount, + + /// netExcludingTax + @JsonKey(name: OrderLineDto.netExcludingTaxKey_) + required double netExcludingTax, + + /// totalTax + @JsonKey(name: OrderLineDto.totalTaxKey_) required double totalTax, + + /// total + @JsonKey(name: OrderLineDto.totalKey_) required double total, + }) = _OrderLineDto; + + factory OrderLineDto.fromJson(Map json) => + _$OrderLineDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String productIdKey_ = r'product_id'; + + static const String productNameKey_ = r'product_name'; + + static const String variantIdKey_ = r'variant_id'; + + static const String variantNameKey_ = r'variant_name'; + + static const String presentationIdKey_ = r'presentation_id'; + + static const String presentationNameKey_ = r'presentation_name'; + + static const String presentationQuantityMultiplierKey_ = + r'presentation_quantity_multiplier'; + + static const String quantityKey_ = r'quantity'; + + static const String unitPriceExcludingTaxKey_ = r'unit_price_excluding_tax'; + + static const String discountPercentageKey_ = r'discount_percentage'; + + static const String discountAmountKey_ = r'discount_amount'; + + static const String netExcludingTaxKey_ = r'net_excluding_tax'; + + static const String totalTaxKey_ = r'total_tax'; + + static const String totalKey_ = r'total'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_line_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_dto.freezed.dart new file mode 100644 index 00000000..86938996 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_dto.freezed.dart @@ -0,0 +1,845 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'order_line_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$OrderLineDto { + /// id + @JsonKey(name: OrderLineDto.idKey_) + String get id; + + /// productId + @JsonKey(name: OrderLineDto.productIdKey_) + String get productId; + + /// productName + @JsonKey(name: OrderLineDto.productNameKey_) + String get productName; + + /// variantId + @JsonKey(name: OrderLineDto.variantIdKey_) + String? get variantId; + + /// variantName + @JsonKey(name: OrderLineDto.variantNameKey_) + String? get variantName; + + /// presentationId + @JsonKey(name: OrderLineDto.presentationIdKey_) + String get presentationId; + + /// presentationName + @JsonKey(name: OrderLineDto.presentationNameKey_) + String get presentationName; + + /// presentationQuantityMultiplier + @JsonKey(name: OrderLineDto.presentationQuantityMultiplierKey_) + int get presentationQuantityMultiplier; + + /// quantity + @JsonKey(name: OrderLineDto.quantityKey_) + int get quantity; + + /// unitPriceExcludingTax + @JsonKey(name: OrderLineDto.unitPriceExcludingTaxKey_) + double get unitPriceExcludingTax; + + /// discountPercentage + @JsonKey(name: OrderLineDto.discountPercentageKey_) + double? get discountPercentage; + + /// discountAmount + @JsonKey(name: OrderLineDto.discountAmountKey_) + double? get discountAmount; + + /// netExcludingTax + @JsonKey(name: OrderLineDto.netExcludingTaxKey_) + double get netExcludingTax; + + /// totalTax + @JsonKey(name: OrderLineDto.totalTaxKey_) + double get totalTax; + + /// total + @JsonKey(name: OrderLineDto.totalKey_) + double get total; + + /// Create a copy of OrderLineDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OrderLineDtoCopyWith get copyWith => + _$OrderLineDtoCopyWithImpl( + this as OrderLineDto, _$identity); + + /// Serializes this OrderLineDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OrderLineDto && + (identical(other.id, id) || other.id == id) && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.productName, productName) || + other.productName == productName) && + (identical(other.variantId, variantId) || + other.variantId == variantId) && + (identical(other.variantName, variantName) || + other.variantName == variantName) && + (identical(other.presentationId, presentationId) || + other.presentationId == presentationId) && + (identical(other.presentationName, presentationName) || + other.presentationName == presentationName) && + (identical(other.presentationQuantityMultiplier, + presentationQuantityMultiplier) || + other.presentationQuantityMultiplier == + presentationQuantityMultiplier) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.unitPriceExcludingTax, unitPriceExcludingTax) || + other.unitPriceExcludingTax == unitPriceExcludingTax) && + (identical(other.discountPercentage, discountPercentage) || + other.discountPercentage == discountPercentage) && + (identical(other.discountAmount, discountAmount) || + other.discountAmount == discountAmount) && + (identical(other.netExcludingTax, netExcludingTax) || + other.netExcludingTax == netExcludingTax) && + (identical(other.totalTax, totalTax) || + other.totalTax == totalTax) && + (identical(other.total, total) || other.total == total)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + productId, + productName, + variantId, + variantName, + presentationId, + presentationName, + presentationQuantityMultiplier, + quantity, + unitPriceExcludingTax, + discountPercentage, + discountAmount, + netExcludingTax, + totalTax, + total); + + @override + String toString() { + return 'OrderLineDto(id: $id, productId: $productId, productName: $productName, variantId: $variantId, variantName: $variantName, presentationId: $presentationId, presentationName: $presentationName, presentationQuantityMultiplier: $presentationQuantityMultiplier, quantity: $quantity, unitPriceExcludingTax: $unitPriceExcludingTax, discountPercentage: $discountPercentage, discountAmount: $discountAmount, netExcludingTax: $netExcludingTax, totalTax: $totalTax, total: $total)'; + } +} + +/// @nodoc +abstract mixin class $OrderLineDtoCopyWith<$Res> { + factory $OrderLineDtoCopyWith( + OrderLineDto value, $Res Function(OrderLineDto) _then) = + _$OrderLineDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: OrderLineDto.idKey_) String id, + @JsonKey(name: OrderLineDto.productIdKey_) String productId, + @JsonKey(name: OrderLineDto.productNameKey_) String productName, + @JsonKey(name: OrderLineDto.variantIdKey_) String? variantId, + @JsonKey(name: OrderLineDto.variantNameKey_) String? variantName, + @JsonKey(name: OrderLineDto.presentationIdKey_) String presentationId, + @JsonKey(name: OrderLineDto.presentationNameKey_) String presentationName, + @JsonKey(name: OrderLineDto.presentationQuantityMultiplierKey_) + int presentationQuantityMultiplier, + @JsonKey(name: OrderLineDto.quantityKey_) int quantity, + @JsonKey(name: OrderLineDto.unitPriceExcludingTaxKey_) + double unitPriceExcludingTax, + @JsonKey(name: OrderLineDto.discountPercentageKey_) + double? discountPercentage, + @JsonKey(name: OrderLineDto.discountAmountKey_) double? discountAmount, + @JsonKey(name: OrderLineDto.netExcludingTaxKey_) double netExcludingTax, + @JsonKey(name: OrderLineDto.totalTaxKey_) double totalTax, + @JsonKey(name: OrderLineDto.totalKey_) double total}); +} + +/// @nodoc +class _$OrderLineDtoCopyWithImpl<$Res> implements $OrderLineDtoCopyWith<$Res> { + _$OrderLineDtoCopyWithImpl(this._self, this._then); + + final OrderLineDto _self; + final $Res Function(OrderLineDto) _then; + + /// Create a copy of OrderLineDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? productId = null, + Object? productName = null, + Object? variantId = freezed, + Object? variantName = freezed, + Object? presentationId = null, + Object? presentationName = null, + Object? presentationQuantityMultiplier = null, + Object? quantity = null, + Object? unitPriceExcludingTax = null, + Object? discountPercentage = freezed, + Object? discountAmount = freezed, + Object? netExcludingTax = null, + Object? totalTax = null, + Object? total = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + productId: null == productId + ? _self.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + productName: null == productName + ? _self.productName + : productName // ignore: cast_nullable_to_non_nullable + as String, + variantId: freezed == variantId + ? _self.variantId + : variantId // ignore: cast_nullable_to_non_nullable + as String?, + variantName: freezed == variantName + ? _self.variantName + : variantName // ignore: cast_nullable_to_non_nullable + as String?, + presentationId: null == presentationId + ? _self.presentationId + : presentationId // ignore: cast_nullable_to_non_nullable + as String, + presentationName: null == presentationName + ? _self.presentationName + : presentationName // ignore: cast_nullable_to_non_nullable + as String, + presentationQuantityMultiplier: null == presentationQuantityMultiplier + ? _self.presentationQuantityMultiplier + : presentationQuantityMultiplier // ignore: cast_nullable_to_non_nullable + as int, + quantity: null == quantity + ? _self.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + unitPriceExcludingTax: null == unitPriceExcludingTax + ? _self.unitPriceExcludingTax + : unitPriceExcludingTax // ignore: cast_nullable_to_non_nullable + as double, + discountPercentage: freezed == discountPercentage + ? _self.discountPercentage + : discountPercentage // ignore: cast_nullable_to_non_nullable + as double?, + discountAmount: freezed == discountAmount + ? _self.discountAmount + : discountAmount // ignore: cast_nullable_to_non_nullable + as double?, + netExcludingTax: null == netExcludingTax + ? _self.netExcludingTax + : netExcludingTax // ignore: cast_nullable_to_non_nullable + as double, + totalTax: null == totalTax + ? _self.totalTax + : totalTax // ignore: cast_nullable_to_non_nullable + as double, + total: null == total + ? _self.total + : total // ignore: cast_nullable_to_non_nullable + as double, + )); + } +} + +/// Adds pattern-matching-related methods to [OrderLineDto]. +extension OrderLineDtoPatterns on OrderLineDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_OrderLineDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _OrderLineDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_OrderLineDto value) $default, + ) { + final _that = this; + switch (_that) { + case _OrderLineDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_OrderLineDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _OrderLineDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: OrderLineDto.idKey_) String id, + @JsonKey(name: OrderLineDto.productIdKey_) String productId, + @JsonKey(name: OrderLineDto.productNameKey_) String productName, + @JsonKey(name: OrderLineDto.variantIdKey_) String? variantId, + @JsonKey(name: OrderLineDto.variantNameKey_) String? variantName, + @JsonKey(name: OrderLineDto.presentationIdKey_) + String presentationId, + @JsonKey(name: OrderLineDto.presentationNameKey_) + String presentationName, + @JsonKey(name: OrderLineDto.presentationQuantityMultiplierKey_) + int presentationQuantityMultiplier, + @JsonKey(name: OrderLineDto.quantityKey_) int quantity, + @JsonKey(name: OrderLineDto.unitPriceExcludingTaxKey_) + double unitPriceExcludingTax, + @JsonKey(name: OrderLineDto.discountPercentageKey_) + double? discountPercentage, + @JsonKey(name: OrderLineDto.discountAmountKey_) + double? discountAmount, + @JsonKey(name: OrderLineDto.netExcludingTaxKey_) + double netExcludingTax, + @JsonKey(name: OrderLineDto.totalTaxKey_) double totalTax, + @JsonKey(name: OrderLineDto.totalKey_) double total)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _OrderLineDto() when $default != null: + return $default( + _that.id, + _that.productId, + _that.productName, + _that.variantId, + _that.variantName, + _that.presentationId, + _that.presentationName, + _that.presentationQuantityMultiplier, + _that.quantity, + _that.unitPriceExcludingTax, + _that.discountPercentage, + _that.discountAmount, + _that.netExcludingTax, + _that.totalTax, + _that.total); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: OrderLineDto.idKey_) String id, + @JsonKey(name: OrderLineDto.productIdKey_) String productId, + @JsonKey(name: OrderLineDto.productNameKey_) String productName, + @JsonKey(name: OrderLineDto.variantIdKey_) String? variantId, + @JsonKey(name: OrderLineDto.variantNameKey_) String? variantName, + @JsonKey(name: OrderLineDto.presentationIdKey_) + String presentationId, + @JsonKey(name: OrderLineDto.presentationNameKey_) + String presentationName, + @JsonKey(name: OrderLineDto.presentationQuantityMultiplierKey_) + int presentationQuantityMultiplier, + @JsonKey(name: OrderLineDto.quantityKey_) int quantity, + @JsonKey(name: OrderLineDto.unitPriceExcludingTaxKey_) + double unitPriceExcludingTax, + @JsonKey(name: OrderLineDto.discountPercentageKey_) + double? discountPercentage, + @JsonKey(name: OrderLineDto.discountAmountKey_) + double? discountAmount, + @JsonKey(name: OrderLineDto.netExcludingTaxKey_) + double netExcludingTax, + @JsonKey(name: OrderLineDto.totalTaxKey_) double totalTax, + @JsonKey(name: OrderLineDto.totalKey_) double total) + $default, + ) { + final _that = this; + switch (_that) { + case _OrderLineDto(): + return $default( + _that.id, + _that.productId, + _that.productName, + _that.variantId, + _that.variantName, + _that.presentationId, + _that.presentationName, + _that.presentationQuantityMultiplier, + _that.quantity, + _that.unitPriceExcludingTax, + _that.discountPercentage, + _that.discountAmount, + _that.netExcludingTax, + _that.totalTax, + _that.total); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: OrderLineDto.idKey_) String id, + @JsonKey(name: OrderLineDto.productIdKey_) String productId, + @JsonKey(name: OrderLineDto.productNameKey_) String productName, + @JsonKey(name: OrderLineDto.variantIdKey_) String? variantId, + @JsonKey(name: OrderLineDto.variantNameKey_) String? variantName, + @JsonKey(name: OrderLineDto.presentationIdKey_) + String presentationId, + @JsonKey(name: OrderLineDto.presentationNameKey_) + String presentationName, + @JsonKey(name: OrderLineDto.presentationQuantityMultiplierKey_) + int presentationQuantityMultiplier, + @JsonKey(name: OrderLineDto.quantityKey_) int quantity, + @JsonKey(name: OrderLineDto.unitPriceExcludingTaxKey_) + double unitPriceExcludingTax, + @JsonKey(name: OrderLineDto.discountPercentageKey_) + double? discountPercentage, + @JsonKey(name: OrderLineDto.discountAmountKey_) + double? discountAmount, + @JsonKey(name: OrderLineDto.netExcludingTaxKey_) + double netExcludingTax, + @JsonKey(name: OrderLineDto.totalTaxKey_) double totalTax, + @JsonKey(name: OrderLineDto.totalKey_) double total)? + $default, + ) { + final _that = this; + switch (_that) { + case _OrderLineDto() when $default != null: + return $default( + _that.id, + _that.productId, + _that.productName, + _that.variantId, + _that.variantName, + _that.presentationId, + _that.presentationName, + _that.presentationQuantityMultiplier, + _that.quantity, + _that.unitPriceExcludingTax, + _that.discountPercentage, + _that.discountAmount, + _that.netExcludingTax, + _that.totalTax, + _that.total); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _OrderLineDto extends OrderLineDto { + const _OrderLineDto( + {@JsonKey(name: OrderLineDto.idKey_) required this.id, + @JsonKey(name: OrderLineDto.productIdKey_) required this.productId, + @JsonKey(name: OrderLineDto.productNameKey_) required this.productName, + @JsonKey(name: OrderLineDto.variantIdKey_) this.variantId, + @JsonKey(name: OrderLineDto.variantNameKey_) this.variantName, + @JsonKey(name: OrderLineDto.presentationIdKey_) + required this.presentationId, + @JsonKey(name: OrderLineDto.presentationNameKey_) + required this.presentationName, + @JsonKey(name: OrderLineDto.presentationQuantityMultiplierKey_) + required this.presentationQuantityMultiplier, + @JsonKey(name: OrderLineDto.quantityKey_) required this.quantity, + @JsonKey(name: OrderLineDto.unitPriceExcludingTaxKey_) + required this.unitPriceExcludingTax, + @JsonKey(name: OrderLineDto.discountPercentageKey_) + this.discountPercentage, + @JsonKey(name: OrderLineDto.discountAmountKey_) this.discountAmount, + @JsonKey(name: OrderLineDto.netExcludingTaxKey_) + required this.netExcludingTax, + @JsonKey(name: OrderLineDto.totalTaxKey_) required this.totalTax, + @JsonKey(name: OrderLineDto.totalKey_) required this.total}) + : super._(); + factory _OrderLineDto.fromJson(Map json) => + _$OrderLineDtoFromJson(json); + + /// id + @override + @JsonKey(name: OrderLineDto.idKey_) + final String id; + + /// productId + @override + @JsonKey(name: OrderLineDto.productIdKey_) + final String productId; + + /// productName + @override + @JsonKey(name: OrderLineDto.productNameKey_) + final String productName; + + /// variantId + @override + @JsonKey(name: OrderLineDto.variantIdKey_) + final String? variantId; + + /// variantName + @override + @JsonKey(name: OrderLineDto.variantNameKey_) + final String? variantName; + + /// presentationId + @override + @JsonKey(name: OrderLineDto.presentationIdKey_) + final String presentationId; + + /// presentationName + @override + @JsonKey(name: OrderLineDto.presentationNameKey_) + final String presentationName; + + /// presentationQuantityMultiplier + @override + @JsonKey(name: OrderLineDto.presentationQuantityMultiplierKey_) + final int presentationQuantityMultiplier; + + /// quantity + @override + @JsonKey(name: OrderLineDto.quantityKey_) + final int quantity; + + /// unitPriceExcludingTax + @override + @JsonKey(name: OrderLineDto.unitPriceExcludingTaxKey_) + final double unitPriceExcludingTax; + + /// discountPercentage + @override + @JsonKey(name: OrderLineDto.discountPercentageKey_) + final double? discountPercentage; + + /// discountAmount + @override + @JsonKey(name: OrderLineDto.discountAmountKey_) + final double? discountAmount; + + /// netExcludingTax + @override + @JsonKey(name: OrderLineDto.netExcludingTaxKey_) + final double netExcludingTax; + + /// totalTax + @override + @JsonKey(name: OrderLineDto.totalTaxKey_) + final double totalTax; + + /// total + @override + @JsonKey(name: OrderLineDto.totalKey_) + final double total; + + /// Create a copy of OrderLineDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$OrderLineDtoCopyWith<_OrderLineDto> get copyWith => + __$OrderLineDtoCopyWithImpl<_OrderLineDto>(this, _$identity); + + @override + Map toJson() { + return _$OrderLineDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _OrderLineDto && + (identical(other.id, id) || other.id == id) && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.productName, productName) || + other.productName == productName) && + (identical(other.variantId, variantId) || + other.variantId == variantId) && + (identical(other.variantName, variantName) || + other.variantName == variantName) && + (identical(other.presentationId, presentationId) || + other.presentationId == presentationId) && + (identical(other.presentationName, presentationName) || + other.presentationName == presentationName) && + (identical(other.presentationQuantityMultiplier, + presentationQuantityMultiplier) || + other.presentationQuantityMultiplier == + presentationQuantityMultiplier) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.unitPriceExcludingTax, unitPriceExcludingTax) || + other.unitPriceExcludingTax == unitPriceExcludingTax) && + (identical(other.discountPercentage, discountPercentage) || + other.discountPercentage == discountPercentage) && + (identical(other.discountAmount, discountAmount) || + other.discountAmount == discountAmount) && + (identical(other.netExcludingTax, netExcludingTax) || + other.netExcludingTax == netExcludingTax) && + (identical(other.totalTax, totalTax) || + other.totalTax == totalTax) && + (identical(other.total, total) || other.total == total)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + productId, + productName, + variantId, + variantName, + presentationId, + presentationName, + presentationQuantityMultiplier, + quantity, + unitPriceExcludingTax, + discountPercentage, + discountAmount, + netExcludingTax, + totalTax, + total); + + @override + String toString() { + return 'OrderLineDto(id: $id, productId: $productId, productName: $productName, variantId: $variantId, variantName: $variantName, presentationId: $presentationId, presentationName: $presentationName, presentationQuantityMultiplier: $presentationQuantityMultiplier, quantity: $quantity, unitPriceExcludingTax: $unitPriceExcludingTax, discountPercentage: $discountPercentage, discountAmount: $discountAmount, netExcludingTax: $netExcludingTax, totalTax: $totalTax, total: $total)'; + } +} + +/// @nodoc +abstract mixin class _$OrderLineDtoCopyWith<$Res> + implements $OrderLineDtoCopyWith<$Res> { + factory _$OrderLineDtoCopyWith( + _OrderLineDto value, $Res Function(_OrderLineDto) _then) = + __$OrderLineDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: OrderLineDto.idKey_) String id, + @JsonKey(name: OrderLineDto.productIdKey_) String productId, + @JsonKey(name: OrderLineDto.productNameKey_) String productName, + @JsonKey(name: OrderLineDto.variantIdKey_) String? variantId, + @JsonKey(name: OrderLineDto.variantNameKey_) String? variantName, + @JsonKey(name: OrderLineDto.presentationIdKey_) String presentationId, + @JsonKey(name: OrderLineDto.presentationNameKey_) String presentationName, + @JsonKey(name: OrderLineDto.presentationQuantityMultiplierKey_) + int presentationQuantityMultiplier, + @JsonKey(name: OrderLineDto.quantityKey_) int quantity, + @JsonKey(name: OrderLineDto.unitPriceExcludingTaxKey_) + double unitPriceExcludingTax, + @JsonKey(name: OrderLineDto.discountPercentageKey_) + double? discountPercentage, + @JsonKey(name: OrderLineDto.discountAmountKey_) double? discountAmount, + @JsonKey(name: OrderLineDto.netExcludingTaxKey_) double netExcludingTax, + @JsonKey(name: OrderLineDto.totalTaxKey_) double totalTax, + @JsonKey(name: OrderLineDto.totalKey_) double total}); +} + +/// @nodoc +class __$OrderLineDtoCopyWithImpl<$Res> + implements _$OrderLineDtoCopyWith<$Res> { + __$OrderLineDtoCopyWithImpl(this._self, this._then); + + final _OrderLineDto _self; + final $Res Function(_OrderLineDto) _then; + + /// Create a copy of OrderLineDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? productId = null, + Object? productName = null, + Object? variantId = freezed, + Object? variantName = freezed, + Object? presentationId = null, + Object? presentationName = null, + Object? presentationQuantityMultiplier = null, + Object? quantity = null, + Object? unitPriceExcludingTax = null, + Object? discountPercentage = freezed, + Object? discountAmount = freezed, + Object? netExcludingTax = null, + Object? totalTax = null, + Object? total = null, + }) { + return _then(_OrderLineDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + productId: null == productId + ? _self.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + productName: null == productName + ? _self.productName + : productName // ignore: cast_nullable_to_non_nullable + as String, + variantId: freezed == variantId + ? _self.variantId + : variantId // ignore: cast_nullable_to_non_nullable + as String?, + variantName: freezed == variantName + ? _self.variantName + : variantName // ignore: cast_nullable_to_non_nullable + as String?, + presentationId: null == presentationId + ? _self.presentationId + : presentationId // ignore: cast_nullable_to_non_nullable + as String, + presentationName: null == presentationName + ? _self.presentationName + : presentationName // ignore: cast_nullable_to_non_nullable + as String, + presentationQuantityMultiplier: null == presentationQuantityMultiplier + ? _self.presentationQuantityMultiplier + : presentationQuantityMultiplier // ignore: cast_nullable_to_non_nullable + as int, + quantity: null == quantity + ? _self.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int, + unitPriceExcludingTax: null == unitPriceExcludingTax + ? _self.unitPriceExcludingTax + : unitPriceExcludingTax // ignore: cast_nullable_to_non_nullable + as double, + discountPercentage: freezed == discountPercentage + ? _self.discountPercentage + : discountPercentage // ignore: cast_nullable_to_non_nullable + as double?, + discountAmount: freezed == discountAmount + ? _self.discountAmount + : discountAmount // ignore: cast_nullable_to_non_nullable + as double?, + netExcludingTax: null == netExcludingTax + ? _self.netExcludingTax + : netExcludingTax // ignore: cast_nullable_to_non_nullable + as double, + totalTax: null == totalTax + ? _self.totalTax + : totalTax // ignore: cast_nullable_to_non_nullable + as double, + total: null == total + ? _self.total + : total // ignore: cast_nullable_to_non_nullable + as double, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_line_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_dto.g.dart new file mode 100644 index 00000000..5b6843b2 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_line_dto.g.dart @@ -0,0 +1,49 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'order_line_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_OrderLineDto _$OrderLineDtoFromJson(Map json) => + _OrderLineDto( + id: json['id'] as String, + productId: json['product_id'] as String, + productName: json['product_name'] as String, + variantId: json['variant_id'] as String?, + variantName: json['variant_name'] as String?, + presentationId: json['presentation_id'] as String, + presentationName: json['presentation_name'] as String, + presentationQuantityMultiplier: + (json['presentation_quantity_multiplier'] as num).toInt(), + quantity: (json['quantity'] as num).toInt(), + unitPriceExcludingTax: + (json['unit_price_excluding_tax'] as num).toDouble(), + discountPercentage: (json['discount_percentage'] as num?)?.toDouble(), + discountAmount: (json['discount_amount'] as num?)?.toDouble(), + netExcludingTax: (json['net_excluding_tax'] as num).toDouble(), + totalTax: (json['total_tax'] as num).toDouble(), + total: (json['total'] as num).toDouble(), + ); + +Map _$OrderLineDtoToJson(_OrderLineDto instance) => + { + 'id': instance.id, + 'product_id': instance.productId, + 'product_name': instance.productName, + if (instance.variantId case final value?) 'variant_id': value, + if (instance.variantName case final value?) 'variant_name': value, + 'presentation_id': instance.presentationId, + 'presentation_name': instance.presentationName, + 'presentation_quantity_multiplier': + instance.presentationQuantityMultiplier, + 'quantity': instance.quantity, + 'unit_price_excluding_tax': instance.unitPriceExcludingTax, + if (instance.discountPercentage case final value?) + 'discount_percentage': value, + if (instance.discountAmount case final value?) 'discount_amount': value, + 'net_excluding_tax': instance.netExcludingTax, + 'total_tax': instance.totalTax, + 'total': instance.total, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_payment_status.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_payment_status.dart new file mode 100644 index 00000000..888cbb20 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_payment_status.dart @@ -0,0 +1,29 @@ +// OrderPaymentStatus +// { +// "type": "string", +// "enum": [ +// "awaitingPayment", +// "paid" +// ] +// } + +library order_payment_status; + +import 'exports.dart'; +part 'order_payment_status.g.dart'; + +@JsonEnum(alwaysCreate: true) +enum OrderPaymentStatus { + @JsonValue("awaitingPayment") + awaitingPayment, + @JsonValue("paid") + paid; + + factory OrderPaymentStatus.fromJson(String json) => + OrderPaymentStatus.values.firstWhere( + (e) => e.toJson() == json, + orElse: () => OrderPaymentStatus.values.first, + ); + + String toJson() => _$OrderPaymentStatusEnumMap[this]!; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_payment_status.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_payment_status.g.dart new file mode 100644 index 00000000..48d2bb43 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_payment_status.g.dart @@ -0,0 +1,12 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'order_payment_status.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +const _$OrderPaymentStatusEnumMap = { + OrderPaymentStatus.awaitingPayment: 'awaitingPayment', + OrderPaymentStatus.paid: 'paid', +}; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_status.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_status.dart new file mode 100644 index 00000000..adfc4d38 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_status.dart @@ -0,0 +1,31 @@ +// OrderStatus +// { +// "type": "string", +// "enum": [ +// "created", +// "closed", +// "deleted" +// ] +// } + +library order_status; + +import 'exports.dart'; +part 'order_status.g.dart'; + +@JsonEnum(alwaysCreate: true) +enum OrderStatus { + @JsonValue("created") + created, + @JsonValue("closed") + closed, + @JsonValue("deleted") + deleted; + + factory OrderStatus.fromJson(String json) => OrderStatus.values.firstWhere( + (e) => e.toJson() == json, + orElse: () => OrderStatus.values.first, + ); + + String toJson() => _$OrderStatusEnumMap[this]!; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/order_status.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/order_status.g.dart new file mode 100644 index 00000000..a7666933 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/order_status.g.dart @@ -0,0 +1,13 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'order_status.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +const _$OrderStatusEnumMap = { + OrderStatus.created: 'created', + OrderStatus.closed: 'closed', + OrderStatus.deleted: 'deleted', +}; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/orders_api_orders_get_query_parameters.dart b/packages/swagger_to_dart/example/lib/src/gen/models/orders_api_orders_get_query_parameters.dart new file mode 100644 index 00000000..29137beb --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/orders_api_orders_get_query_parameters.dart @@ -0,0 +1,103 @@ +/// OrdersApiOrdersGetQueryParameters +/// { +/// "properties": { +/// "pageToken": { +/// "type": "string", +/// "nullable": true +/// }, +/// "pageSize": { +/// "type": "integer", +/// "format": "int32", +/// "default": 100 +/// }, +/// "salePointId": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "status": { +/// "oneOf": [ +/// { +/// "$ref": "#/components/schemas/OrderStatus" +/// }, +/// { +/// "type": "null" +/// } +/// ], +/// "nullable": true +/// }, +/// "customerId": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "dateRange": { +/// "oneOf": [ +/// { +/// "$ref": "#/components/schemas/DateRange" +/// }, +/// { +/// "type": "null" +/// } +/// ], +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "required": [] +/// } +library orders_api_orders_get_query_parameters; + +import 'exports.dart'; +part 'orders_api_orders_get_query_parameters.freezed.dart'; +part 'orders_api_orders_get_query_parameters.g.dart'; // OrdersApiOrdersGetQueryParameters + +@freezed +abstract class OrdersApiOrdersGetQueryParameters + with _$OrdersApiOrdersGetQueryParameters { + const OrdersApiOrdersGetQueryParameters._(); + + @jsonSerializable + const factory OrdersApiOrdersGetQueryParameters({ + /// pageToken + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageTokenKey_) + String? pageToken, + + /// pageSize + @Default(100) + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageSizeKey_) + int pageSize, + + /// salePointId + @JsonKey(name: OrdersApiOrdersGetQueryParameters.salePointIdKey_) + String? salePointId, + + /// status + @JsonKey(name: OrdersApiOrdersGetQueryParameters.statusKey_) + OrderStatus? status, + + /// customerId + @JsonKey(name: OrdersApiOrdersGetQueryParameters.customerIdKey_) + String? customerId, + + /// dateRange + @JsonKey(name: OrdersApiOrdersGetQueryParameters.dateRangeKey_) + DateRange? dateRange, + }) = _OrdersApiOrdersGetQueryParameters; + + factory OrdersApiOrdersGetQueryParameters.fromJson( + Map json, + ) => _$OrdersApiOrdersGetQueryParametersFromJson(json); + + static const String pageTokenKey_ = r'pageToken'; + + static const String pageSizeKey_ = r'pageSize'; + + static const String salePointIdKey_ = r'salePointId'; + + static const String statusKey_ = r'status'; + + static const String customerIdKey_ = r'customerId'; + + static const String dateRangeKey_ = r'dateRange'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/orders_api_orders_get_query_parameters.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/orders_api_orders_get_query_parameters.freezed.dart new file mode 100644 index 00000000..7384ae3b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/orders_api_orders_get_query_parameters.freezed.dart @@ -0,0 +1,554 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'orders_api_orders_get_query_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$OrdersApiOrdersGetQueryParameters { + /// pageToken + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageTokenKey_) + String? get pageToken; + + /// pageSize + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageSizeKey_) + int get pageSize; + + /// salePointId + @JsonKey(name: OrdersApiOrdersGetQueryParameters.salePointIdKey_) + String? get salePointId; + + /// status + @JsonKey(name: OrdersApiOrdersGetQueryParameters.statusKey_) + OrderStatus? get status; + + /// customerId + @JsonKey(name: OrdersApiOrdersGetQueryParameters.customerIdKey_) + String? get customerId; + + /// dateRange + @JsonKey(name: OrdersApiOrdersGetQueryParameters.dateRangeKey_) + DateRange? get dateRange; + + /// Create a copy of OrdersApiOrdersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $OrdersApiOrdersGetQueryParametersCopyWith + get copyWith => _$OrdersApiOrdersGetQueryParametersCopyWithImpl< + OrdersApiOrdersGetQueryParameters>( + this as OrdersApiOrdersGetQueryParameters, _$identity); + + /// Serializes this OrdersApiOrdersGetQueryParameters to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is OrdersApiOrdersGetQueryParameters && + (identical(other.pageToken, pageToken) || + other.pageToken == pageToken) && + (identical(other.pageSize, pageSize) || + other.pageSize == pageSize) && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId) && + (identical(other.status, status) || other.status == status) && + (identical(other.customerId, customerId) || + other.customerId == customerId) && + (identical(other.dateRange, dateRange) || + other.dateRange == dateRange)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, pageToken, pageSize, salePointId, + status, customerId, dateRange); + + @override + String toString() { + return 'OrdersApiOrdersGetQueryParameters(pageToken: $pageToken, pageSize: $pageSize, salePointId: $salePointId, status: $status, customerId: $customerId, dateRange: $dateRange)'; + } +} + +/// @nodoc +abstract mixin class $OrdersApiOrdersGetQueryParametersCopyWith<$Res> { + factory $OrdersApiOrdersGetQueryParametersCopyWith( + OrdersApiOrdersGetQueryParameters value, + $Res Function(OrdersApiOrdersGetQueryParameters) _then) = + _$OrdersApiOrdersGetQueryParametersCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: OrdersApiOrdersGetQueryParameters.pageTokenKey_) + String? pageToken, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageSizeKey_) + int pageSize, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.salePointIdKey_) + String? salePointId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.statusKey_) + OrderStatus? status, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.customerIdKey_) + String? customerId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.dateRangeKey_) + DateRange? dateRange}); + + $DateRangeCopyWith<$Res>? get dateRange; +} + +/// @nodoc +class _$OrdersApiOrdersGetQueryParametersCopyWithImpl<$Res> + implements $OrdersApiOrdersGetQueryParametersCopyWith<$Res> { + _$OrdersApiOrdersGetQueryParametersCopyWithImpl(this._self, this._then); + + final OrdersApiOrdersGetQueryParameters _self; + final $Res Function(OrdersApiOrdersGetQueryParameters) _then; + + /// Create a copy of OrdersApiOrdersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? pageToken = freezed, + Object? pageSize = null, + Object? salePointId = freezed, + Object? status = freezed, + Object? customerId = freezed, + Object? dateRange = freezed, + }) { + return _then(_self.copyWith( + pageToken: freezed == pageToken + ? _self.pageToken + : pageToken // ignore: cast_nullable_to_non_nullable + as String?, + pageSize: null == pageSize + ? _self.pageSize + : pageSize // ignore: cast_nullable_to_non_nullable + as int, + salePointId: freezed == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String?, + status: freezed == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as OrderStatus?, + customerId: freezed == customerId + ? _self.customerId + : customerId // ignore: cast_nullable_to_non_nullable + as String?, + dateRange: freezed == dateRange + ? _self.dateRange + : dateRange // ignore: cast_nullable_to_non_nullable + as DateRange?, + )); + } + + /// Create a copy of OrdersApiOrdersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $DateRangeCopyWith<$Res>? get dateRange { + if (_self.dateRange == null) { + return null; + } + + return $DateRangeCopyWith<$Res>(_self.dateRange!, (value) { + return _then(_self.copyWith(dateRange: value)); + }); + } +} + +/// Adds pattern-matching-related methods to [OrdersApiOrdersGetQueryParameters]. +extension OrdersApiOrdersGetQueryParametersPatterns + on OrdersApiOrdersGetQueryParameters { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_OrdersApiOrdersGetQueryParameters value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _OrdersApiOrdersGetQueryParameters() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_OrdersApiOrdersGetQueryParameters value) $default, + ) { + final _that = this; + switch (_that) { + case _OrdersApiOrdersGetQueryParameters(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_OrdersApiOrdersGetQueryParameters value)? $default, + ) { + final _that = this; + switch (_that) { + case _OrdersApiOrdersGetQueryParameters() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageTokenKey_) + String? pageToken, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageSizeKey_) + int pageSize, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.salePointIdKey_) + String? salePointId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.statusKey_) + OrderStatus? status, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.customerIdKey_) + String? customerId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.dateRangeKey_) + DateRange? dateRange)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _OrdersApiOrdersGetQueryParameters() when $default != null: + return $default(_that.pageToken, _that.pageSize, _that.salePointId, + _that.status, _that.customerId, _that.dateRange); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageTokenKey_) + String? pageToken, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageSizeKey_) + int pageSize, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.salePointIdKey_) + String? salePointId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.statusKey_) + OrderStatus? status, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.customerIdKey_) + String? customerId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.dateRangeKey_) + DateRange? dateRange) + $default, + ) { + final _that = this; + switch (_that) { + case _OrdersApiOrdersGetQueryParameters(): + return $default(_that.pageToken, _that.pageSize, _that.salePointId, + _that.status, _that.customerId, _that.dateRange); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageTokenKey_) + String? pageToken, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageSizeKey_) + int pageSize, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.salePointIdKey_) + String? salePointId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.statusKey_) + OrderStatus? status, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.customerIdKey_) + String? customerId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.dateRangeKey_) + DateRange? dateRange)? + $default, + ) { + final _that = this; + switch (_that) { + case _OrdersApiOrdersGetQueryParameters() when $default != null: + return $default(_that.pageToken, _that.pageSize, _that.salePointId, + _that.status, _that.customerId, _that.dateRange); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _OrdersApiOrdersGetQueryParameters + extends OrdersApiOrdersGetQueryParameters { + const _OrdersApiOrdersGetQueryParameters( + {@JsonKey(name: OrdersApiOrdersGetQueryParameters.pageTokenKey_) + this.pageToken, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageSizeKey_) + this.pageSize = 100, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.salePointIdKey_) + this.salePointId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.statusKey_) this.status, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.customerIdKey_) + this.customerId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.dateRangeKey_) + this.dateRange}) + : super._(); + factory _OrdersApiOrdersGetQueryParameters.fromJson( + Map json) => + _$OrdersApiOrdersGetQueryParametersFromJson(json); + + /// pageToken + @override + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageTokenKey_) + final String? pageToken; + + /// pageSize + @override + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageSizeKey_) + final int pageSize; + + /// salePointId + @override + @JsonKey(name: OrdersApiOrdersGetQueryParameters.salePointIdKey_) + final String? salePointId; + + /// status + @override + @JsonKey(name: OrdersApiOrdersGetQueryParameters.statusKey_) + final OrderStatus? status; + + /// customerId + @override + @JsonKey(name: OrdersApiOrdersGetQueryParameters.customerIdKey_) + final String? customerId; + + /// dateRange + @override + @JsonKey(name: OrdersApiOrdersGetQueryParameters.dateRangeKey_) + final DateRange? dateRange; + + /// Create a copy of OrdersApiOrdersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$OrdersApiOrdersGetQueryParametersCopyWith< + _OrdersApiOrdersGetQueryParameters> + get copyWith => __$OrdersApiOrdersGetQueryParametersCopyWithImpl< + _OrdersApiOrdersGetQueryParameters>(this, _$identity); + + @override + Map toJson() { + return _$OrdersApiOrdersGetQueryParametersToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _OrdersApiOrdersGetQueryParameters && + (identical(other.pageToken, pageToken) || + other.pageToken == pageToken) && + (identical(other.pageSize, pageSize) || + other.pageSize == pageSize) && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId) && + (identical(other.status, status) || other.status == status) && + (identical(other.customerId, customerId) || + other.customerId == customerId) && + (identical(other.dateRange, dateRange) || + other.dateRange == dateRange)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, pageToken, pageSize, salePointId, + status, customerId, dateRange); + + @override + String toString() { + return 'OrdersApiOrdersGetQueryParameters(pageToken: $pageToken, pageSize: $pageSize, salePointId: $salePointId, status: $status, customerId: $customerId, dateRange: $dateRange)'; + } +} + +/// @nodoc +abstract mixin class _$OrdersApiOrdersGetQueryParametersCopyWith<$Res> + implements $OrdersApiOrdersGetQueryParametersCopyWith<$Res> { + factory _$OrdersApiOrdersGetQueryParametersCopyWith( + _OrdersApiOrdersGetQueryParameters value, + $Res Function(_OrdersApiOrdersGetQueryParameters) _then) = + __$OrdersApiOrdersGetQueryParametersCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: OrdersApiOrdersGetQueryParameters.pageTokenKey_) + String? pageToken, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.pageSizeKey_) + int pageSize, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.salePointIdKey_) + String? salePointId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.statusKey_) + OrderStatus? status, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.customerIdKey_) + String? customerId, + @JsonKey(name: OrdersApiOrdersGetQueryParameters.dateRangeKey_) + DateRange? dateRange}); + + @override + $DateRangeCopyWith<$Res>? get dateRange; +} + +/// @nodoc +class __$OrdersApiOrdersGetQueryParametersCopyWithImpl<$Res> + implements _$OrdersApiOrdersGetQueryParametersCopyWith<$Res> { + __$OrdersApiOrdersGetQueryParametersCopyWithImpl(this._self, this._then); + + final _OrdersApiOrdersGetQueryParameters _self; + final $Res Function(_OrdersApiOrdersGetQueryParameters) _then; + + /// Create a copy of OrdersApiOrdersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? pageToken = freezed, + Object? pageSize = null, + Object? salePointId = freezed, + Object? status = freezed, + Object? customerId = freezed, + Object? dateRange = freezed, + }) { + return _then(_OrdersApiOrdersGetQueryParameters( + pageToken: freezed == pageToken + ? _self.pageToken + : pageToken // ignore: cast_nullable_to_non_nullable + as String?, + pageSize: null == pageSize + ? _self.pageSize + : pageSize // ignore: cast_nullable_to_non_nullable + as int, + salePointId: freezed == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String?, + status: freezed == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as OrderStatus?, + customerId: freezed == customerId + ? _self.customerId + : customerId // ignore: cast_nullable_to_non_nullable + as String?, + dateRange: freezed == dateRange + ? _self.dateRange + : dateRange // ignore: cast_nullable_to_non_nullable + as DateRange?, + )); + } + + /// Create a copy of OrdersApiOrdersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $DateRangeCopyWith<$Res>? get dateRange { + if (_self.dateRange == null) { + return null; + } + + return $DateRangeCopyWith<$Res>(_self.dateRange!, (value) { + return _then(_self.copyWith(dateRange: value)); + }); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/orders_api_orders_get_query_parameters.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/orders_api_orders_get_query_parameters.g.dart new file mode 100644 index 00000000..01d41da0 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/orders_api_orders_get_query_parameters.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'orders_api_orders_get_query_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_OrdersApiOrdersGetQueryParameters _$OrdersApiOrdersGetQueryParametersFromJson( + Map json) => + _OrdersApiOrdersGetQueryParameters( + pageToken: json['pageToken'] as String?, + pageSize: (json['pageSize'] as num?)?.toInt() ?? 100, + salePointId: json['salePointId'] as String?, + status: json['status'] == null + ? null + : OrderStatus.fromJson(json['status'] as String), + customerId: json['customerId'] as String?, + dateRange: json['dateRange'] == null + ? null + : DateRange.fromJson(json['dateRange'] as Map), + ); + +Map _$OrdersApiOrdersGetQueryParametersToJson( + _OrdersApiOrdersGetQueryParameters instance) => + { + if (instance.pageToken case final value?) 'pageToken': value, + 'pageSize': instance.pageSize, + if (instance.salePointId case final value?) 'salePointId': value, + if (instance.status?.toJson() case final value?) 'status': value, + if (instance.customerId case final value?) 'customerId': value, + if (instance.dateRange?.toJson() case final value?) 'dateRange': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_dto.dart new file mode 100644 index 00000000..4ca02ef0 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_dto.dart @@ -0,0 +1,108 @@ +/// PriceListDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "name": { +/// "type": "string" +/// }, +/// "enabled": { +/// "type": "boolean" +/// }, +/// "is_default": { +/// "type": "boolean" +/// }, +/// "valid_from": { +/// "type": "string", +/// "format": "date-time", +/// "nullable": true +/// }, +/// "valid_to": { +/// "type": "string", +/// "format": "date-time", +/// "nullable": true +/// }, +/// "sale_points": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/PriceListSalePointDto" +/// } +/// }, +/// "policies": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/PriceListPolicyDto" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "enabled", +/// "id", +/// "is_default", +/// "name", +/// "policies", +/// "sale_points" +/// ], +/// "additionalProperties": false +/// } +library price_list_dto; + +import 'exports.dart'; +part 'price_list_dto.freezed.dart'; +part 'price_list_dto.g.dart'; // PriceListDto + +@freezed +abstract class PriceListDto with _$PriceListDto { + const PriceListDto._(); + + @jsonSerializable + const factory PriceListDto({ + /// id + @JsonKey(name: PriceListDto.idKey_) required String id, + + /// name + @JsonKey(name: PriceListDto.nameKey_) required String name, + + /// enabled + @JsonKey(name: PriceListDto.enabledKey_) required bool enabled, + + /// isDefault + @JsonKey(name: PriceListDto.isDefaultKey_) required bool isDefault, + + /// validFrom + @JsonKey(name: PriceListDto.validFromKey_) DateTime? validFrom, + + /// validTo + @JsonKey(name: PriceListDto.validToKey_) DateTime? validTo, + + /// salePoints + @JsonKey(name: PriceListDto.salePointsKey_) + required List salePoints, + + /// policies + @JsonKey(name: PriceListDto.policiesKey_) + required List policies, + }) = _PriceListDto; + + factory PriceListDto.fromJson(Map json) => + _$PriceListDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; + + static const String enabledKey_ = r'enabled'; + + static const String isDefaultKey_ = r'is_default'; + + static const String validFromKey_ = r'valid_from'; + + static const String validToKey_ = r'valid_to'; + + static const String salePointsKey_ = r'sale_points'; + + static const String policiesKey_ = r'policies'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_dto.freezed.dart new file mode 100644 index 00000000..1080052b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_dto.freezed.dart @@ -0,0 +1,571 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'price_list_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PriceListDto { + /// id + @JsonKey(name: PriceListDto.idKey_) + String get id; + + /// name + @JsonKey(name: PriceListDto.nameKey_) + String get name; + + /// enabled + @JsonKey(name: PriceListDto.enabledKey_) + bool get enabled; + + /// isDefault + @JsonKey(name: PriceListDto.isDefaultKey_) + bool get isDefault; + + /// validFrom + @JsonKey(name: PriceListDto.validFromKey_) + DateTime? get validFrom; + + /// validTo + @JsonKey(name: PriceListDto.validToKey_) + DateTime? get validTo; + + /// salePoints + @JsonKey(name: PriceListDto.salePointsKey_) + List get salePoints; + + /// policies + @JsonKey(name: PriceListDto.policiesKey_) + List get policies; + + /// Create a copy of PriceListDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PriceListDtoCopyWith get copyWith => + _$PriceListDtoCopyWithImpl( + this as PriceListDto, _$identity); + + /// Serializes this PriceListDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PriceListDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.isDefault, isDefault) || + other.isDefault == isDefault) && + (identical(other.validFrom, validFrom) || + other.validFrom == validFrom) && + (identical(other.validTo, validTo) || other.validTo == validTo) && + const DeepCollectionEquality() + .equals(other.salePoints, salePoints) && + const DeepCollectionEquality().equals(other.policies, policies)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + name, + enabled, + isDefault, + validFrom, + validTo, + const DeepCollectionEquality().hash(salePoints), + const DeepCollectionEquality().hash(policies)); + + @override + String toString() { + return 'PriceListDto(id: $id, name: $name, enabled: $enabled, isDefault: $isDefault, validFrom: $validFrom, validTo: $validTo, salePoints: $salePoints, policies: $policies)'; + } +} + +/// @nodoc +abstract mixin class $PriceListDtoCopyWith<$Res> { + factory $PriceListDtoCopyWith( + PriceListDto value, $Res Function(PriceListDto) _then) = + _$PriceListDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: PriceListDto.idKey_) String id, + @JsonKey(name: PriceListDto.nameKey_) String name, + @JsonKey(name: PriceListDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListDto.isDefaultKey_) bool isDefault, + @JsonKey(name: PriceListDto.validFromKey_) DateTime? validFrom, + @JsonKey(name: PriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: PriceListDto.salePointsKey_) + List salePoints, + @JsonKey(name: PriceListDto.policiesKey_) + List policies}); +} + +/// @nodoc +class _$PriceListDtoCopyWithImpl<$Res> implements $PriceListDtoCopyWith<$Res> { + _$PriceListDtoCopyWithImpl(this._self, this._then); + + final PriceListDto _self; + final $Res Function(PriceListDto) _then; + + /// Create a copy of PriceListDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + Object? enabled = null, + Object? isDefault = null, + Object? validFrom = freezed, + Object? validTo = freezed, + Object? salePoints = null, + Object? policies = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + isDefault: null == isDefault + ? _self.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + validFrom: freezed == validFrom + ? _self.validFrom + : validFrom // ignore: cast_nullable_to_non_nullable + as DateTime?, + validTo: freezed == validTo + ? _self.validTo + : validTo // ignore: cast_nullable_to_non_nullable + as DateTime?, + salePoints: null == salePoints + ? _self.salePoints + : salePoints // ignore: cast_nullable_to_non_nullable + as List, + policies: null == policies + ? _self.policies + : policies // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [PriceListDto]. +extension PriceListDtoPatterns on PriceListDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_PriceListDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_PriceListDto value) $default, + ) { + final _that = this; + switch (_that) { + case _PriceListDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_PriceListDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _PriceListDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: PriceListDto.idKey_) String id, + @JsonKey(name: PriceListDto.nameKey_) String name, + @JsonKey(name: PriceListDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListDto.isDefaultKey_) bool isDefault, + @JsonKey(name: PriceListDto.validFromKey_) DateTime? validFrom, + @JsonKey(name: PriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: PriceListDto.salePointsKey_) + List salePoints, + @JsonKey(name: PriceListDto.policiesKey_) + List policies)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListDto() when $default != null: + return $default(_that.id, _that.name, _that.enabled, _that.isDefault, + _that.validFrom, _that.validTo, _that.salePoints, _that.policies); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: PriceListDto.idKey_) String id, + @JsonKey(name: PriceListDto.nameKey_) String name, + @JsonKey(name: PriceListDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListDto.isDefaultKey_) bool isDefault, + @JsonKey(name: PriceListDto.validFromKey_) DateTime? validFrom, + @JsonKey(name: PriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: PriceListDto.salePointsKey_) + List salePoints, + @JsonKey(name: PriceListDto.policiesKey_) + List policies) + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListDto(): + return $default(_that.id, _that.name, _that.enabled, _that.isDefault, + _that.validFrom, _that.validTo, _that.salePoints, _that.policies); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: PriceListDto.idKey_) String id, + @JsonKey(name: PriceListDto.nameKey_) String name, + @JsonKey(name: PriceListDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListDto.isDefaultKey_) bool isDefault, + @JsonKey(name: PriceListDto.validFromKey_) DateTime? validFrom, + @JsonKey(name: PriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: PriceListDto.salePointsKey_) + List salePoints, + @JsonKey(name: PriceListDto.policiesKey_) + List policies)? + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListDto() when $default != null: + return $default(_that.id, _that.name, _that.enabled, _that.isDefault, + _that.validFrom, _that.validTo, _that.salePoints, _that.policies); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _PriceListDto extends PriceListDto { + const _PriceListDto( + {@JsonKey(name: PriceListDto.idKey_) required this.id, + @JsonKey(name: PriceListDto.nameKey_) required this.name, + @JsonKey(name: PriceListDto.enabledKey_) required this.enabled, + @JsonKey(name: PriceListDto.isDefaultKey_) required this.isDefault, + @JsonKey(name: PriceListDto.validFromKey_) this.validFrom, + @JsonKey(name: PriceListDto.validToKey_) this.validTo, + @JsonKey(name: PriceListDto.salePointsKey_) + required final List salePoints, + @JsonKey(name: PriceListDto.policiesKey_) + required final List policies}) + : _salePoints = salePoints, + _policies = policies, + super._(); + factory _PriceListDto.fromJson(Map json) => + _$PriceListDtoFromJson(json); + + /// id + @override + @JsonKey(name: PriceListDto.idKey_) + final String id; + + /// name + @override + @JsonKey(name: PriceListDto.nameKey_) + final String name; + + /// enabled + @override + @JsonKey(name: PriceListDto.enabledKey_) + final bool enabled; + + /// isDefault + @override + @JsonKey(name: PriceListDto.isDefaultKey_) + final bool isDefault; + + /// validFrom + @override + @JsonKey(name: PriceListDto.validFromKey_) + final DateTime? validFrom; + + /// validTo + @override + @JsonKey(name: PriceListDto.validToKey_) + final DateTime? validTo; + + /// salePoints + final List _salePoints; + + /// salePoints + @override + @JsonKey(name: PriceListDto.salePointsKey_) + List get salePoints { + if (_salePoints is EqualUnmodifiableListView) return _salePoints; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_salePoints); + } + + /// policies + final List _policies; + + /// policies + @override + @JsonKey(name: PriceListDto.policiesKey_) + List get policies { + if (_policies is EqualUnmodifiableListView) return _policies; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_policies); + } + + /// Create a copy of PriceListDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PriceListDtoCopyWith<_PriceListDto> get copyWith => + __$PriceListDtoCopyWithImpl<_PriceListDto>(this, _$identity); + + @override + Map toJson() { + return _$PriceListDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _PriceListDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.isDefault, isDefault) || + other.isDefault == isDefault) && + (identical(other.validFrom, validFrom) || + other.validFrom == validFrom) && + (identical(other.validTo, validTo) || other.validTo == validTo) && + const DeepCollectionEquality() + .equals(other._salePoints, _salePoints) && + const DeepCollectionEquality().equals(other._policies, _policies)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + name, + enabled, + isDefault, + validFrom, + validTo, + const DeepCollectionEquality().hash(_salePoints), + const DeepCollectionEquality().hash(_policies)); + + @override + String toString() { + return 'PriceListDto(id: $id, name: $name, enabled: $enabled, isDefault: $isDefault, validFrom: $validFrom, validTo: $validTo, salePoints: $salePoints, policies: $policies)'; + } +} + +/// @nodoc +abstract mixin class _$PriceListDtoCopyWith<$Res> + implements $PriceListDtoCopyWith<$Res> { + factory _$PriceListDtoCopyWith( + _PriceListDto value, $Res Function(_PriceListDto) _then) = + __$PriceListDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: PriceListDto.idKey_) String id, + @JsonKey(name: PriceListDto.nameKey_) String name, + @JsonKey(name: PriceListDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListDto.isDefaultKey_) bool isDefault, + @JsonKey(name: PriceListDto.validFromKey_) DateTime? validFrom, + @JsonKey(name: PriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: PriceListDto.salePointsKey_) + List salePoints, + @JsonKey(name: PriceListDto.policiesKey_) + List policies}); +} + +/// @nodoc +class __$PriceListDtoCopyWithImpl<$Res> + implements _$PriceListDtoCopyWith<$Res> { + __$PriceListDtoCopyWithImpl(this._self, this._then); + + final _PriceListDto _self; + final $Res Function(_PriceListDto) _then; + + /// Create a copy of PriceListDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? name = null, + Object? enabled = null, + Object? isDefault = null, + Object? validFrom = freezed, + Object? validTo = freezed, + Object? salePoints = null, + Object? policies = null, + }) { + return _then(_PriceListDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + isDefault: null == isDefault + ? _self.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + validFrom: freezed == validFrom + ? _self.validFrom + : validFrom // ignore: cast_nullable_to_non_nullable + as DateTime?, + validTo: freezed == validTo + ? _self.validTo + : validTo // ignore: cast_nullable_to_non_nullable + as DateTime?, + salePoints: null == salePoints + ? _self._salePoints + : salePoints // ignore: cast_nullable_to_non_nullable + as List, + policies: null == policies + ? _self._policies + : policies // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_dto.g.dart new file mode 100644 index 00000000..385c14ff --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_dto.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'price_list_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_PriceListDto _$PriceListDtoFromJson(Map json) => + _PriceListDto( + id: json['id'] as String, + name: json['name'] as String, + enabled: json['enabled'] as bool, + isDefault: json['is_default'] as bool, + validFrom: json['valid_from'] == null + ? null + : DateTime.parse(json['valid_from'] as String), + validTo: json['valid_to'] == null + ? null + : DateTime.parse(json['valid_to'] as String), + salePoints: (json['sale_points'] as List) + .map((e) => PriceListSalePointDto.fromJson(e as Map)) + .toList(), + policies: (json['policies'] as List) + .map((e) => PriceListPolicyDto.fromJson(e as Map)) + .toList(), + ); + +Map _$PriceListDtoToJson(_PriceListDto instance) => + { + 'id': instance.id, + 'name': instance.name, + 'enabled': instance.enabled, + 'is_default': instance.isDefault, + if (instance.validFrom?.toIso8601String() case final value?) + 'valid_from': value, + if (instance.validTo?.toIso8601String() case final value?) + 'valid_to': value, + 'sale_points': instance.salePoints.map((e) => e.toJson()).toList(), + 'policies': instance.policies.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_dto.dart new file mode 100644 index 00000000..14ff3f84 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_dto.dart @@ -0,0 +1,87 @@ +/// PriceListPolicyDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "policy_type": { +/// "$ref": "#/components/schemas/PriceListPolicyPolicyType" +/// }, +/// "policy_type_value": { +/// "type": "number", +/// "format": "double" +/// }, +/// "enabled": { +/// "type": "boolean" +/// }, +/// "notes": { +/// "type": "string", +/// "nullable": true +/// }, +/// "items": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/PriceListPolicyItemDto" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "enabled", +/// "id", +/// "items", +/// "policy_type", +/// "policy_type_value" +/// ], +/// "additionalProperties": false +/// } +library price_list_policy_dto; + +import 'exports.dart'; +part 'price_list_policy_dto.freezed.dart'; +part 'price_list_policy_dto.g.dart'; // PriceListPolicyDto + +@freezed +abstract class PriceListPolicyDto with _$PriceListPolicyDto { + const PriceListPolicyDto._(); + + @jsonSerializable + const factory PriceListPolicyDto({ + /// id + @JsonKey(name: PriceListPolicyDto.idKey_) required String id, + + /// policyType + @JsonKey(name: PriceListPolicyDto.policyTypeKey_) + required PriceListPolicyPolicyType policyType, + + /// policyTypeValue + @JsonKey(name: PriceListPolicyDto.policyTypeValueKey_) + required double policyTypeValue, + + /// enabled + @JsonKey(name: PriceListPolicyDto.enabledKey_) required bool enabled, + + /// notes + @JsonKey(name: PriceListPolicyDto.notesKey_) String? notes, + + /// items + @JsonKey(name: PriceListPolicyDto.itemsKey_) + required List items, + }) = _PriceListPolicyDto; + + factory PriceListPolicyDto.fromJson(Map json) => + _$PriceListPolicyDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String policyTypeKey_ = r'policy_type'; + + static const String policyTypeValueKey_ = r'policy_type_value'; + + static const String enabledKey_ = r'enabled'; + + static const String notesKey_ = r'notes'; + + static const String itemsKey_ = r'items'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_dto.freezed.dart new file mode 100644 index 00000000..b9afd214 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_dto.freezed.dart @@ -0,0 +1,498 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'price_list_policy_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PriceListPolicyDto { + /// id + @JsonKey(name: PriceListPolicyDto.idKey_) + String get id; + + /// policyType + @JsonKey(name: PriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType get policyType; + + /// policyTypeValue + @JsonKey(name: PriceListPolicyDto.policyTypeValueKey_) + double get policyTypeValue; + + /// enabled + @JsonKey(name: PriceListPolicyDto.enabledKey_) + bool get enabled; + + /// notes + @JsonKey(name: PriceListPolicyDto.notesKey_) + String? get notes; + + /// items + @JsonKey(name: PriceListPolicyDto.itemsKey_) + List get items; + + /// Create a copy of PriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PriceListPolicyDtoCopyWith get copyWith => + _$PriceListPolicyDtoCopyWithImpl( + this as PriceListPolicyDto, _$identity); + + /// Serializes this PriceListPolicyDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PriceListPolicyDto && + (identical(other.id, id) || other.id == id) && + (identical(other.policyType, policyType) || + other.policyType == policyType) && + (identical(other.policyTypeValue, policyTypeValue) || + other.policyTypeValue == policyTypeValue) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.notes, notes) || other.notes == notes) && + const DeepCollectionEquality().equals(other.items, items)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, policyType, policyTypeValue, + enabled, notes, const DeepCollectionEquality().hash(items)); + + @override + String toString() { + return 'PriceListPolicyDto(id: $id, policyType: $policyType, policyTypeValue: $policyTypeValue, enabled: $enabled, notes: $notes, items: $items)'; + } +} + +/// @nodoc +abstract mixin class $PriceListPolicyDtoCopyWith<$Res> { + factory $PriceListPolicyDtoCopyWith( + PriceListPolicyDto value, $Res Function(PriceListPolicyDto) _then) = + _$PriceListPolicyDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: PriceListPolicyDto.idKey_) String id, + @JsonKey(name: PriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType policyType, + @JsonKey(name: PriceListPolicyDto.policyTypeValueKey_) + double policyTypeValue, + @JsonKey(name: PriceListPolicyDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: PriceListPolicyDto.itemsKey_) + List items}); +} + +/// @nodoc +class _$PriceListPolicyDtoCopyWithImpl<$Res> + implements $PriceListPolicyDtoCopyWith<$Res> { + _$PriceListPolicyDtoCopyWithImpl(this._self, this._then); + + final PriceListPolicyDto _self; + final $Res Function(PriceListPolicyDto) _then; + + /// Create a copy of PriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? policyType = null, + Object? policyTypeValue = null, + Object? enabled = null, + Object? notes = freezed, + Object? items = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + policyType: null == policyType + ? _self.policyType + : policyType // ignore: cast_nullable_to_non_nullable + as PriceListPolicyPolicyType, + policyTypeValue: null == policyTypeValue + ? _self.policyTypeValue + : policyTypeValue // ignore: cast_nullable_to_non_nullable + as double, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + items: null == items + ? _self.items + : items // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [PriceListPolicyDto]. +extension PriceListPolicyDtoPatterns on PriceListPolicyDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_PriceListPolicyDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListPolicyDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_PriceListPolicyDto value) $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_PriceListPolicyDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: PriceListPolicyDto.idKey_) String id, + @JsonKey(name: PriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType policyType, + @JsonKey(name: PriceListPolicyDto.policyTypeValueKey_) + double policyTypeValue, + @JsonKey(name: PriceListPolicyDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: PriceListPolicyDto.itemsKey_) + List items)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListPolicyDto() when $default != null: + return $default(_that.id, _that.policyType, _that.policyTypeValue, + _that.enabled, _that.notes, _that.items); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: PriceListPolicyDto.idKey_) String id, + @JsonKey(name: PriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType policyType, + @JsonKey(name: PriceListPolicyDto.policyTypeValueKey_) + double policyTypeValue, + @JsonKey(name: PriceListPolicyDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: PriceListPolicyDto.itemsKey_) + List items) + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyDto(): + return $default(_that.id, _that.policyType, _that.policyTypeValue, + _that.enabled, _that.notes, _that.items); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: PriceListPolicyDto.idKey_) String id, + @JsonKey(name: PriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType policyType, + @JsonKey(name: PriceListPolicyDto.policyTypeValueKey_) + double policyTypeValue, + @JsonKey(name: PriceListPolicyDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: PriceListPolicyDto.itemsKey_) + List items)? + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyDto() when $default != null: + return $default(_that.id, _that.policyType, _that.policyTypeValue, + _that.enabled, _that.notes, _that.items); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _PriceListPolicyDto extends PriceListPolicyDto { + const _PriceListPolicyDto( + {@JsonKey(name: PriceListPolicyDto.idKey_) required this.id, + @JsonKey(name: PriceListPolicyDto.policyTypeKey_) + required this.policyType, + @JsonKey(name: PriceListPolicyDto.policyTypeValueKey_) + required this.policyTypeValue, + @JsonKey(name: PriceListPolicyDto.enabledKey_) required this.enabled, + @JsonKey(name: PriceListPolicyDto.notesKey_) this.notes, + @JsonKey(name: PriceListPolicyDto.itemsKey_) + required final List items}) + : _items = items, + super._(); + factory _PriceListPolicyDto.fromJson(Map json) => + _$PriceListPolicyDtoFromJson(json); + + /// id + @override + @JsonKey(name: PriceListPolicyDto.idKey_) + final String id; + + /// policyType + @override + @JsonKey(name: PriceListPolicyDto.policyTypeKey_) + final PriceListPolicyPolicyType policyType; + + /// policyTypeValue + @override + @JsonKey(name: PriceListPolicyDto.policyTypeValueKey_) + final double policyTypeValue; + + /// enabled + @override + @JsonKey(name: PriceListPolicyDto.enabledKey_) + final bool enabled; + + /// notes + @override + @JsonKey(name: PriceListPolicyDto.notesKey_) + final String? notes; + + /// items + final List _items; + + /// items + @override + @JsonKey(name: PriceListPolicyDto.itemsKey_) + List get items { + if (_items is EqualUnmodifiableListView) return _items; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_items); + } + + /// Create a copy of PriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PriceListPolicyDtoCopyWith<_PriceListPolicyDto> get copyWith => + __$PriceListPolicyDtoCopyWithImpl<_PriceListPolicyDto>(this, _$identity); + + @override + Map toJson() { + return _$PriceListPolicyDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _PriceListPolicyDto && + (identical(other.id, id) || other.id == id) && + (identical(other.policyType, policyType) || + other.policyType == policyType) && + (identical(other.policyTypeValue, policyTypeValue) || + other.policyTypeValue == policyTypeValue) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.notes, notes) || other.notes == notes) && + const DeepCollectionEquality().equals(other._items, _items)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, policyType, policyTypeValue, + enabled, notes, const DeepCollectionEquality().hash(_items)); + + @override + String toString() { + return 'PriceListPolicyDto(id: $id, policyType: $policyType, policyTypeValue: $policyTypeValue, enabled: $enabled, notes: $notes, items: $items)'; + } +} + +/// @nodoc +abstract mixin class _$PriceListPolicyDtoCopyWith<$Res> + implements $PriceListPolicyDtoCopyWith<$Res> { + factory _$PriceListPolicyDtoCopyWith( + _PriceListPolicyDto value, $Res Function(_PriceListPolicyDto) _then) = + __$PriceListPolicyDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: PriceListPolicyDto.idKey_) String id, + @JsonKey(name: PriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType policyType, + @JsonKey(name: PriceListPolicyDto.policyTypeValueKey_) + double policyTypeValue, + @JsonKey(name: PriceListPolicyDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: PriceListPolicyDto.itemsKey_) + List items}); +} + +/// @nodoc +class __$PriceListPolicyDtoCopyWithImpl<$Res> + implements _$PriceListPolicyDtoCopyWith<$Res> { + __$PriceListPolicyDtoCopyWithImpl(this._self, this._then); + + final _PriceListPolicyDto _self; + final $Res Function(_PriceListPolicyDto) _then; + + /// Create a copy of PriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? policyType = null, + Object? policyTypeValue = null, + Object? enabled = null, + Object? notes = freezed, + Object? items = null, + }) { + return _then(_PriceListPolicyDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + policyType: null == policyType + ? _self.policyType + : policyType // ignore: cast_nullable_to_non_nullable + as PriceListPolicyPolicyType, + policyTypeValue: null == policyTypeValue + ? _self.policyTypeValue + : policyTypeValue // ignore: cast_nullable_to_non_nullable + as double, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + items: null == items + ? _self._items + : items // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_dto.g.dart new file mode 100644 index 00000000..99f14e36 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_dto.g.dart @@ -0,0 +1,31 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'price_list_policy_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_PriceListPolicyDto _$PriceListPolicyDtoFromJson(Map json) => + _PriceListPolicyDto( + id: json['id'] as String, + policyType: + PriceListPolicyPolicyType.fromJson(json['policy_type'] as String), + policyTypeValue: (json['policy_type_value'] as num).toDouble(), + enabled: json['enabled'] as bool, + notes: json['notes'] as String?, + items: (json['items'] as List) + .map( + (e) => PriceListPolicyItemDto.fromJson(e as Map)) + .toList(), + ); + +Map _$PriceListPolicyDtoToJson(_PriceListPolicyDto instance) => + { + 'id': instance.id, + 'policy_type': instance.policyType.toJson(), + 'policy_type_value': instance.policyTypeValue, + 'enabled': instance.enabled, + if (instance.notes case final value?) 'notes': value, + 'items': instance.items.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_dto.dart new file mode 100644 index 00000000..718037da --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_dto.dart @@ -0,0 +1,60 @@ +/// PriceListPolicyItemDto +/// { +/// "properties": { +/// "product_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "product_name": { +/// "type": "string" +/// }, +/// "product_presentations": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/PriceListPolicyItemProductPresentationDto" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "product_id", +/// "product_name", +/// "product_presentations" +/// ], +/// "additionalProperties": false +/// } +library price_list_policy_item_dto; + +import 'exports.dart'; +part 'price_list_policy_item_dto.freezed.dart'; +part 'price_list_policy_item_dto.g.dart'; // PriceListPolicyItemDto + +@freezed +abstract class PriceListPolicyItemDto with _$PriceListPolicyItemDto { + const PriceListPolicyItemDto._(); + + @jsonSerializable + const factory PriceListPolicyItemDto({ + /// productId + @JsonKey(name: PriceListPolicyItemDto.productIdKey_) + required String productId, + + /// productName + @JsonKey(name: PriceListPolicyItemDto.productNameKey_) + required String productName, + + /// productPresentations + @JsonKey(name: PriceListPolicyItemDto.productPresentationsKey_) + required List + productPresentations, + }) = _PriceListPolicyItemDto; + + factory PriceListPolicyItemDto.fromJson(Map json) => + _$PriceListPolicyItemDtoFromJson(json); + + static const String productIdKey_ = r'product_id'; + + static const String productNameKey_ = r'product_name'; + + static const String productPresentationsKey_ = r'product_presentations'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_dto.freezed.dart new file mode 100644 index 00000000..82fe2fec --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_dto.freezed.dart @@ -0,0 +1,421 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'price_list_policy_item_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PriceListPolicyItemDto { + /// productId + @JsonKey(name: PriceListPolicyItemDto.productIdKey_) + String get productId; + + /// productName + @JsonKey(name: PriceListPolicyItemDto.productNameKey_) + String get productName; + + /// productPresentations + @JsonKey(name: PriceListPolicyItemDto.productPresentationsKey_) + List get productPresentations; + + /// Create a copy of PriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PriceListPolicyItemDtoCopyWith get copyWith => + _$PriceListPolicyItemDtoCopyWithImpl( + this as PriceListPolicyItemDto, _$identity); + + /// Serializes this PriceListPolicyItemDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PriceListPolicyItemDto && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.productName, productName) || + other.productName == productName) && + const DeepCollectionEquality() + .equals(other.productPresentations, productPresentations)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, productId, productName, + const DeepCollectionEquality().hash(productPresentations)); + + @override + String toString() { + return 'PriceListPolicyItemDto(productId: $productId, productName: $productName, productPresentations: $productPresentations)'; + } +} + +/// @nodoc +abstract mixin class $PriceListPolicyItemDtoCopyWith<$Res> { + factory $PriceListPolicyItemDtoCopyWith(PriceListPolicyItemDto value, + $Res Function(PriceListPolicyItemDto) _then) = + _$PriceListPolicyItemDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: PriceListPolicyItemDto.productIdKey_) String productId, + @JsonKey(name: PriceListPolicyItemDto.productNameKey_) String productName, + @JsonKey(name: PriceListPolicyItemDto.productPresentationsKey_) + List productPresentations}); +} + +/// @nodoc +class _$PriceListPolicyItemDtoCopyWithImpl<$Res> + implements $PriceListPolicyItemDtoCopyWith<$Res> { + _$PriceListPolicyItemDtoCopyWithImpl(this._self, this._then); + + final PriceListPolicyItemDto _self; + final $Res Function(PriceListPolicyItemDto) _then; + + /// Create a copy of PriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? productId = null, + Object? productName = null, + Object? productPresentations = null, + }) { + return _then(_self.copyWith( + productId: null == productId + ? _self.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + productName: null == productName + ? _self.productName + : productName // ignore: cast_nullable_to_non_nullable + as String, + productPresentations: null == productPresentations + ? _self.productPresentations + : productPresentations // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [PriceListPolicyItemDto]. +extension PriceListPolicyItemDtoPatterns on PriceListPolicyItemDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_PriceListPolicyItemDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_PriceListPolicyItemDto value) $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_PriceListPolicyItemDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: PriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey(name: PriceListPolicyItemDto.productNameKey_) + String productName, + @JsonKey(name: PriceListPolicyItemDto.productPresentationsKey_) + List + productPresentations)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemDto() when $default != null: + return $default( + _that.productId, _that.productName, _that.productPresentations); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: PriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey(name: PriceListPolicyItemDto.productNameKey_) + String productName, + @JsonKey(name: PriceListPolicyItemDto.productPresentationsKey_) + List + productPresentations) + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemDto(): + return $default( + _that.productId, _that.productName, _that.productPresentations); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: PriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey(name: PriceListPolicyItemDto.productNameKey_) + String productName, + @JsonKey(name: PriceListPolicyItemDto.productPresentationsKey_) + List + productPresentations)? + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemDto() when $default != null: + return $default( + _that.productId, _that.productName, _that.productPresentations); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _PriceListPolicyItemDto extends PriceListPolicyItemDto { + const _PriceListPolicyItemDto( + {@JsonKey(name: PriceListPolicyItemDto.productIdKey_) + required this.productId, + @JsonKey(name: PriceListPolicyItemDto.productNameKey_) + required this.productName, + @JsonKey(name: PriceListPolicyItemDto.productPresentationsKey_) + required final List + productPresentations}) + : _productPresentations = productPresentations, + super._(); + factory _PriceListPolicyItemDto.fromJson(Map json) => + _$PriceListPolicyItemDtoFromJson(json); + + /// productId + @override + @JsonKey(name: PriceListPolicyItemDto.productIdKey_) + final String productId; + + /// productName + @override + @JsonKey(name: PriceListPolicyItemDto.productNameKey_) + final String productName; + + /// productPresentations + final List _productPresentations; + + /// productPresentations + @override + @JsonKey(name: PriceListPolicyItemDto.productPresentationsKey_) + List get productPresentations { + if (_productPresentations is EqualUnmodifiableListView) + return _productPresentations; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_productPresentations); + } + + /// Create a copy of PriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PriceListPolicyItemDtoCopyWith<_PriceListPolicyItemDto> get copyWith => + __$PriceListPolicyItemDtoCopyWithImpl<_PriceListPolicyItemDto>( + this, _$identity); + + @override + Map toJson() { + return _$PriceListPolicyItemDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _PriceListPolicyItemDto && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.productName, productName) || + other.productName == productName) && + const DeepCollectionEquality() + .equals(other._productPresentations, _productPresentations)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, productId, productName, + const DeepCollectionEquality().hash(_productPresentations)); + + @override + String toString() { + return 'PriceListPolicyItemDto(productId: $productId, productName: $productName, productPresentations: $productPresentations)'; + } +} + +/// @nodoc +abstract mixin class _$PriceListPolicyItemDtoCopyWith<$Res> + implements $PriceListPolicyItemDtoCopyWith<$Res> { + factory _$PriceListPolicyItemDtoCopyWith(_PriceListPolicyItemDto value, + $Res Function(_PriceListPolicyItemDto) _then) = + __$PriceListPolicyItemDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: PriceListPolicyItemDto.productIdKey_) String productId, + @JsonKey(name: PriceListPolicyItemDto.productNameKey_) String productName, + @JsonKey(name: PriceListPolicyItemDto.productPresentationsKey_) + List productPresentations}); +} + +/// @nodoc +class __$PriceListPolicyItemDtoCopyWithImpl<$Res> + implements _$PriceListPolicyItemDtoCopyWith<$Res> { + __$PriceListPolicyItemDtoCopyWithImpl(this._self, this._then); + + final _PriceListPolicyItemDto _self; + final $Res Function(_PriceListPolicyItemDto) _then; + + /// Create a copy of PriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? productId = null, + Object? productName = null, + Object? productPresentations = null, + }) { + return _then(_PriceListPolicyItemDto( + productId: null == productId + ? _self.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + productName: null == productName + ? _self.productName + : productName // ignore: cast_nullable_to_non_nullable + as String, + productPresentations: null == productPresentations + ? _self._productPresentations + : productPresentations // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_dto.g.dart new file mode 100644 index 00000000..3dd3546b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_dto.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'price_list_policy_item_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_PriceListPolicyItemDto _$PriceListPolicyItemDtoFromJson( + Map json) => + _PriceListPolicyItemDto( + productId: json['product_id'] as String, + productName: json['product_name'] as String, + productPresentations: (json['product_presentations'] as List) + .map((e) => PriceListPolicyItemProductPresentationDto.fromJson( + e as Map)) + .toList(), + ); + +Map _$PriceListPolicyItemDtoToJson( + _PriceListPolicyItemDto instance) => + { + 'product_id': instance.productId, + 'product_name': instance.productName, + 'product_presentations': + instance.productPresentations.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_product_presentation_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_product_presentation_dto.dart new file mode 100644 index 00000000..795edbc2 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_product_presentation_dto.dart @@ -0,0 +1,54 @@ +/// PriceListPolicyItemProductPresentationDto +/// { +/// "properties": { +/// "product_presentation_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "product_presentation_name": { +/// "type": "string" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "product_presentation_id", +/// "product_presentation_name" +/// ], +/// "additionalProperties": false +/// } +library price_list_policy_item_product_presentation_dto; + +import 'exports.dart'; +part 'price_list_policy_item_product_presentation_dto.freezed.dart'; +part 'price_list_policy_item_product_presentation_dto.g.dart'; // PriceListPolicyItemProductPresentationDto + +@freezed +abstract class PriceListPolicyItemProductPresentationDto + with _$PriceListPolicyItemProductPresentationDto { + const PriceListPolicyItemProductPresentationDto._(); + + @jsonSerializable + const factory PriceListPolicyItemProductPresentationDto({ + /// productPresentationId + @JsonKey( + name: PriceListPolicyItemProductPresentationDto.productPresentationIdKey_, + ) + required String productPresentationId, + + /// productPresentationName + @JsonKey( + name: + PriceListPolicyItemProductPresentationDto.productPresentationNameKey_, + ) + required String productPresentationName, + }) = _PriceListPolicyItemProductPresentationDto; + + factory PriceListPolicyItemProductPresentationDto.fromJson( + Map json, + ) => _$PriceListPolicyItemProductPresentationDtoFromJson(json); + + static const String productPresentationIdKey_ = r'product_presentation_id'; + + static const String productPresentationNameKey_ = + r'product_presentation_name'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_product_presentation_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_product_presentation_dto.freezed.dart new file mode 100644 index 00000000..1eb297cf --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_product_presentation_dto.freezed.dart @@ -0,0 +1,421 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'price_list_policy_item_product_presentation_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PriceListPolicyItemProductPresentationDto { + /// productPresentationId + @JsonKey( + name: PriceListPolicyItemProductPresentationDto.productPresentationIdKey_) + String get productPresentationId; + + /// productPresentationName + @JsonKey( + name: + PriceListPolicyItemProductPresentationDto.productPresentationNameKey_) + String get productPresentationName; + + /// Create a copy of PriceListPolicyItemProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PriceListPolicyItemProductPresentationDtoCopyWith< + PriceListPolicyItemProductPresentationDto> + get copyWith => _$PriceListPolicyItemProductPresentationDtoCopyWithImpl< + PriceListPolicyItemProductPresentationDto>( + this as PriceListPolicyItemProductPresentationDto, _$identity); + + /// Serializes this PriceListPolicyItemProductPresentationDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PriceListPolicyItemProductPresentationDto && + (identical(other.productPresentationId, productPresentationId) || + other.productPresentationId == productPresentationId) && + (identical( + other.productPresentationName, productPresentationName) || + other.productPresentationName == productPresentationName)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, productPresentationId, productPresentationName); + + @override + String toString() { + return 'PriceListPolicyItemProductPresentationDto(productPresentationId: $productPresentationId, productPresentationName: $productPresentationName)'; + } +} + +/// @nodoc +abstract mixin class $PriceListPolicyItemProductPresentationDtoCopyWith<$Res> { + factory $PriceListPolicyItemProductPresentationDtoCopyWith( + PriceListPolicyItemProductPresentationDto value, + $Res Function(PriceListPolicyItemProductPresentationDto) _then) = + _$PriceListPolicyItemProductPresentationDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationIdKey_) + String productPresentationId, + @JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationNameKey_) + String productPresentationName}); +} + +/// @nodoc +class _$PriceListPolicyItemProductPresentationDtoCopyWithImpl<$Res> + implements $PriceListPolicyItemProductPresentationDtoCopyWith<$Res> { + _$PriceListPolicyItemProductPresentationDtoCopyWithImpl( + this._self, this._then); + + final PriceListPolicyItemProductPresentationDto _self; + final $Res Function(PriceListPolicyItemProductPresentationDto) _then; + + /// Create a copy of PriceListPolicyItemProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? productPresentationId = null, + Object? productPresentationName = null, + }) { + return _then(_self.copyWith( + productPresentationId: null == productPresentationId + ? _self.productPresentationId + : productPresentationId // ignore: cast_nullable_to_non_nullable + as String, + productPresentationName: null == productPresentationName + ? _self.productPresentationName + : productPresentationName // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [PriceListPolicyItemProductPresentationDto]. +extension PriceListPolicyItemProductPresentationDtoPatterns + on PriceListPolicyItemProductPresentationDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_PriceListPolicyItemProductPresentationDto value)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemProductPresentationDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_PriceListPolicyItemProductPresentationDto value) $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemProductPresentationDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_PriceListPolicyItemProductPresentationDto value)? + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemProductPresentationDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationIdKey_) + String productPresentationId, + @JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationNameKey_) + String productPresentationName)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemProductPresentationDto() when $default != null: + return $default( + _that.productPresentationId, _that.productPresentationName); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationIdKey_) + String productPresentationId, + @JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationNameKey_) + String productPresentationName) + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemProductPresentationDto(): + return $default( + _that.productPresentationId, _that.productPresentationName); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationIdKey_) + String productPresentationId, + @JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationNameKey_) + String productPresentationName)? + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListPolicyItemProductPresentationDto() when $default != null: + return $default( + _that.productPresentationId, _that.productPresentationName); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _PriceListPolicyItemProductPresentationDto + extends PriceListPolicyItemProductPresentationDto { + const _PriceListPolicyItemProductPresentationDto( + {@JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationIdKey_) + required this.productPresentationId, + @JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationNameKey_) + required this.productPresentationName}) + : super._(); + factory _PriceListPolicyItemProductPresentationDto.fromJson( + Map json) => + _$PriceListPolicyItemProductPresentationDtoFromJson(json); + + /// productPresentationId + @override + @JsonKey( + name: PriceListPolicyItemProductPresentationDto.productPresentationIdKey_) + final String productPresentationId; + + /// productPresentationName + @override + @JsonKey( + name: + PriceListPolicyItemProductPresentationDto.productPresentationNameKey_) + final String productPresentationName; + + /// Create a copy of PriceListPolicyItemProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PriceListPolicyItemProductPresentationDtoCopyWith< + _PriceListPolicyItemProductPresentationDto> + get copyWith => __$PriceListPolicyItemProductPresentationDtoCopyWithImpl< + _PriceListPolicyItemProductPresentationDto>(this, _$identity); + + @override + Map toJson() { + return _$PriceListPolicyItemProductPresentationDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _PriceListPolicyItemProductPresentationDto && + (identical(other.productPresentationId, productPresentationId) || + other.productPresentationId == productPresentationId) && + (identical( + other.productPresentationName, productPresentationName) || + other.productPresentationName == productPresentationName)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, productPresentationId, productPresentationName); + + @override + String toString() { + return 'PriceListPolicyItemProductPresentationDto(productPresentationId: $productPresentationId, productPresentationName: $productPresentationName)'; + } +} + +/// @nodoc +abstract mixin class _$PriceListPolicyItemProductPresentationDtoCopyWith<$Res> + implements $PriceListPolicyItemProductPresentationDtoCopyWith<$Res> { + factory _$PriceListPolicyItemProductPresentationDtoCopyWith( + _PriceListPolicyItemProductPresentationDto value, + $Res Function(_PriceListPolicyItemProductPresentationDto) _then) = + __$PriceListPolicyItemProductPresentationDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationIdKey_) + String productPresentationId, + @JsonKey( + name: PriceListPolicyItemProductPresentationDto + .productPresentationNameKey_) + String productPresentationName}); +} + +/// @nodoc +class __$PriceListPolicyItemProductPresentationDtoCopyWithImpl<$Res> + implements _$PriceListPolicyItemProductPresentationDtoCopyWith<$Res> { + __$PriceListPolicyItemProductPresentationDtoCopyWithImpl( + this._self, this._then); + + final _PriceListPolicyItemProductPresentationDto _self; + final $Res Function(_PriceListPolicyItemProductPresentationDto) _then; + + /// Create a copy of PriceListPolicyItemProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? productPresentationId = null, + Object? productPresentationName = null, + }) { + return _then(_PriceListPolicyItemProductPresentationDto( + productPresentationId: null == productPresentationId + ? _self.productPresentationId + : productPresentationId // ignore: cast_nullable_to_non_nullable + as String, + productPresentationName: null == productPresentationName + ? _self.productPresentationName + : productPresentationName // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_product_presentation_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_product_presentation_dto.g.dart new file mode 100644 index 00000000..328ae4f2 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_item_product_presentation_dto.g.dart @@ -0,0 +1,22 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'price_list_policy_item_product_presentation_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_PriceListPolicyItemProductPresentationDto + _$PriceListPolicyItemProductPresentationDtoFromJson( + Map json) => + _PriceListPolicyItemProductPresentationDto( + productPresentationId: json['product_presentation_id'] as String, + productPresentationName: json['product_presentation_name'] as String, + ); + +Map _$PriceListPolicyItemProductPresentationDtoToJson( + _PriceListPolicyItemProductPresentationDto instance) => + { + 'product_presentation_id': instance.productPresentationId, + 'product_presentation_name': instance.productPresentationName, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_policy_type.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_policy_type.dart new file mode 100644 index 00000000..367e8018 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_policy_type.dart @@ -0,0 +1,32 @@ +// PriceListPolicyPolicyType +// { +// "type": "string", +// "enum": [ +// "setMarkupPercentage", +// "adjustPercentage", +// "adjustFixed" +// ] +// } + +library price_list_policy_policy_type; + +import 'exports.dart'; +part 'price_list_policy_policy_type.g.dart'; + +@JsonEnum(alwaysCreate: true) +enum PriceListPolicyPolicyType { + @JsonValue("setMarkupPercentage") + setMarkupPercentage, + @JsonValue("adjustPercentage") + adjustPercentage, + @JsonValue("adjustFixed") + adjustFixed; + + factory PriceListPolicyPolicyType.fromJson(String json) => + PriceListPolicyPolicyType.values.firstWhere( + (e) => e.toJson() == json, + orElse: () => PriceListPolicyPolicyType.values.first, + ); + + String toJson() => _$PriceListPolicyPolicyTypeEnumMap[this]!; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_policy_type.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_policy_type.g.dart new file mode 100644 index 00000000..1ad858bd --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_policy_policy_type.g.dart @@ -0,0 +1,13 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'price_list_policy_policy_type.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +const _$PriceListPolicyPolicyTypeEnumMap = { + PriceListPolicyPolicyType.setMarkupPercentage: 'setMarkupPercentage', + PriceListPolicyPolicyType.adjustPercentage: 'adjustPercentage', + PriceListPolicyPolicyType.adjustFixed: 'adjustFixed', +}; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_sale_point_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_sale_point_dto.dart new file mode 100644 index 00000000..e3190cd8 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_sale_point_dto.dart @@ -0,0 +1,46 @@ +/// PriceListSalePointDto +/// { +/// "properties": { +/// "sale_point_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "sale_point_name": { +/// "type": "string" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "sale_point_id", +/// "sale_point_name" +/// ], +/// "additionalProperties": false +/// } +library price_list_sale_point_dto; + +import 'exports.dart'; +part 'price_list_sale_point_dto.freezed.dart'; +part 'price_list_sale_point_dto.g.dart'; // PriceListSalePointDto + +@freezed +abstract class PriceListSalePointDto with _$PriceListSalePointDto { + const PriceListSalePointDto._(); + + @jsonSerializable + const factory PriceListSalePointDto({ + /// salePointId + @JsonKey(name: PriceListSalePointDto.salePointIdKey_) + required String salePointId, + + /// salePointName + @JsonKey(name: PriceListSalePointDto.salePointNameKey_) + required String salePointName, + }) = _PriceListSalePointDto; + + factory PriceListSalePointDto.fromJson(Map json) => + _$PriceListSalePointDtoFromJson(json); + + static const String salePointIdKey_ = r'sale_point_id'; + + static const String salePointNameKey_ = r'sale_point_name'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_sale_point_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_sale_point_dto.freezed.dart new file mode 100644 index 00000000..048d90dd --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_sale_point_dto.freezed.dart @@ -0,0 +1,370 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'price_list_sale_point_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PriceListSalePointDto { + /// salePointId + @JsonKey(name: PriceListSalePointDto.salePointIdKey_) + String get salePointId; + + /// salePointName + @JsonKey(name: PriceListSalePointDto.salePointNameKey_) + String get salePointName; + + /// Create a copy of PriceListSalePointDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PriceListSalePointDtoCopyWith get copyWith => + _$PriceListSalePointDtoCopyWithImpl( + this as PriceListSalePointDto, _$identity); + + /// Serializes this PriceListSalePointDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PriceListSalePointDto && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId) && + (identical(other.salePointName, salePointName) || + other.salePointName == salePointName)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, salePointId, salePointName); + + @override + String toString() { + return 'PriceListSalePointDto(salePointId: $salePointId, salePointName: $salePointName)'; + } +} + +/// @nodoc +abstract mixin class $PriceListSalePointDtoCopyWith<$Res> { + factory $PriceListSalePointDtoCopyWith(PriceListSalePointDto value, + $Res Function(PriceListSalePointDto) _then) = + _$PriceListSalePointDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: PriceListSalePointDto.salePointIdKey_) String salePointId, + @JsonKey(name: PriceListSalePointDto.salePointNameKey_) + String salePointName}); +} + +/// @nodoc +class _$PriceListSalePointDtoCopyWithImpl<$Res> + implements $PriceListSalePointDtoCopyWith<$Res> { + _$PriceListSalePointDtoCopyWithImpl(this._self, this._then); + + final PriceListSalePointDto _self; + final $Res Function(PriceListSalePointDto) _then; + + /// Create a copy of PriceListSalePointDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? salePointId = null, + Object? salePointName = null, + }) { + return _then(_self.copyWith( + salePointId: null == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String, + salePointName: null == salePointName + ? _self.salePointName + : salePointName // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [PriceListSalePointDto]. +extension PriceListSalePointDtoPatterns on PriceListSalePointDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_PriceListSalePointDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListSalePointDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_PriceListSalePointDto value) $default, + ) { + final _that = this; + switch (_that) { + case _PriceListSalePointDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_PriceListSalePointDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _PriceListSalePointDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: PriceListSalePointDto.salePointIdKey_) + String salePointId, + @JsonKey(name: PriceListSalePointDto.salePointNameKey_) + String salePointName)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListSalePointDto() when $default != null: + return $default(_that.salePointId, _that.salePointName); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: PriceListSalePointDto.salePointIdKey_) + String salePointId, + @JsonKey(name: PriceListSalePointDto.salePointNameKey_) + String salePointName) + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListSalePointDto(): + return $default(_that.salePointId, _that.salePointName); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: PriceListSalePointDto.salePointIdKey_) + String salePointId, + @JsonKey(name: PriceListSalePointDto.salePointNameKey_) + String salePointName)? + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListSalePointDto() when $default != null: + return $default(_that.salePointId, _that.salePointName); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _PriceListSalePointDto extends PriceListSalePointDto { + const _PriceListSalePointDto( + {@JsonKey(name: PriceListSalePointDto.salePointIdKey_) + required this.salePointId, + @JsonKey(name: PriceListSalePointDto.salePointNameKey_) + required this.salePointName}) + : super._(); + factory _PriceListSalePointDto.fromJson(Map json) => + _$PriceListSalePointDtoFromJson(json); + + /// salePointId + @override + @JsonKey(name: PriceListSalePointDto.salePointIdKey_) + final String salePointId; + + /// salePointName + @override + @JsonKey(name: PriceListSalePointDto.salePointNameKey_) + final String salePointName; + + /// Create a copy of PriceListSalePointDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PriceListSalePointDtoCopyWith<_PriceListSalePointDto> get copyWith => + __$PriceListSalePointDtoCopyWithImpl<_PriceListSalePointDto>( + this, _$identity); + + @override + Map toJson() { + return _$PriceListSalePointDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _PriceListSalePointDto && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId) && + (identical(other.salePointName, salePointName) || + other.salePointName == salePointName)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, salePointId, salePointName); + + @override + String toString() { + return 'PriceListSalePointDto(salePointId: $salePointId, salePointName: $salePointName)'; + } +} + +/// @nodoc +abstract mixin class _$PriceListSalePointDtoCopyWith<$Res> + implements $PriceListSalePointDtoCopyWith<$Res> { + factory _$PriceListSalePointDtoCopyWith(_PriceListSalePointDto value, + $Res Function(_PriceListSalePointDto) _then) = + __$PriceListSalePointDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: PriceListSalePointDto.salePointIdKey_) String salePointId, + @JsonKey(name: PriceListSalePointDto.salePointNameKey_) + String salePointName}); +} + +/// @nodoc +class __$PriceListSalePointDtoCopyWithImpl<$Res> + implements _$PriceListSalePointDtoCopyWith<$Res> { + __$PriceListSalePointDtoCopyWithImpl(this._self, this._then); + + final _PriceListSalePointDto _self; + final $Res Function(_PriceListSalePointDto) _then; + + /// Create a copy of PriceListSalePointDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? salePointId = null, + Object? salePointName = null, + }) { + return _then(_PriceListSalePointDto( + salePointId: null == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String, + salePointName: null == salePointName + ? _self.salePointName + : salePointName // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_sale_point_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_sale_point_dto.g.dart new file mode 100644 index 00000000..2e4a6f6a --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_sale_point_dto.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'price_list_sale_point_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_PriceListSalePointDto _$PriceListSalePointDtoFromJson( + Map json) => + _PriceListSalePointDto( + salePointId: json['sale_point_id'] as String, + salePointName: json['sale_point_name'] as String, + ); + +Map _$PriceListSalePointDtoToJson( + _PriceListSalePointDto instance) => + { + 'sale_point_id': instance.salePointId, + 'sale_point_name': instance.salePointName, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_summary_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_summary_dto.dart new file mode 100644 index 00000000..d446fe06 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_summary_dto.dart @@ -0,0 +1,104 @@ +/// PriceListSummaryDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "name": { +/// "type": "string" +/// }, +/// "enabled": { +/// "type": "boolean" +/// }, +/// "valid_from": { +/// "type": "string", +/// "format": "date-time", +/// "nullable": true +/// }, +/// "valid_to": { +/// "type": "string", +/// "format": "date-time", +/// "nullable": true +/// }, +/// "is_default": { +/// "type": "boolean" +/// }, +/// "sale_point_count": { +/// "type": "integer", +/// "format": "int32" +/// }, +/// "policy_count": { +/// "type": "integer", +/// "format": "int32" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "enabled", +/// "id", +/// "is_default", +/// "name", +/// "policy_count", +/// "sale_point_count" +/// ], +/// "additionalProperties": false +/// } +library price_list_summary_dto; + +import 'exports.dart'; +part 'price_list_summary_dto.freezed.dart'; +part 'price_list_summary_dto.g.dart'; // PriceListSummaryDto + +@freezed +abstract class PriceListSummaryDto with _$PriceListSummaryDto { + const PriceListSummaryDto._(); + + @jsonSerializable + const factory PriceListSummaryDto({ + /// id + @JsonKey(name: PriceListSummaryDto.idKey_) required String id, + + /// name + @JsonKey(name: PriceListSummaryDto.nameKey_) required String name, + + /// enabled + @JsonKey(name: PriceListSummaryDto.enabledKey_) required bool enabled, + + /// validFrom + @JsonKey(name: PriceListSummaryDto.validFromKey_) DateTime? validFrom, + + /// validTo + @JsonKey(name: PriceListSummaryDto.validToKey_) DateTime? validTo, + + /// isDefault + @JsonKey(name: PriceListSummaryDto.isDefaultKey_) required bool isDefault, + + /// salePointCount + @JsonKey(name: PriceListSummaryDto.salePointCountKey_) + required int salePointCount, + + /// policyCount + @JsonKey(name: PriceListSummaryDto.policyCountKey_) + required int policyCount, + }) = _PriceListSummaryDto; + + factory PriceListSummaryDto.fromJson(Map json) => + _$PriceListSummaryDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; + + static const String enabledKey_ = r'enabled'; + + static const String validFromKey_ = r'valid_from'; + + static const String validToKey_ = r'valid_to'; + + static const String isDefaultKey_ = r'is_default'; + + static const String salePointCountKey_ = r'sale_point_count'; + + static const String policyCountKey_ = r'policy_count'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_summary_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_summary_dto.freezed.dart new file mode 100644 index 00000000..499f7cad --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_summary_dto.freezed.dart @@ -0,0 +1,562 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'price_list_summary_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PriceListSummaryDto { + /// id + @JsonKey(name: PriceListSummaryDto.idKey_) + String get id; + + /// name + @JsonKey(name: PriceListSummaryDto.nameKey_) + String get name; + + /// enabled + @JsonKey(name: PriceListSummaryDto.enabledKey_) + bool get enabled; + + /// validFrom + @JsonKey(name: PriceListSummaryDto.validFromKey_) + DateTime? get validFrom; + + /// validTo + @JsonKey(name: PriceListSummaryDto.validToKey_) + DateTime? get validTo; + + /// isDefault + @JsonKey(name: PriceListSummaryDto.isDefaultKey_) + bool get isDefault; + + /// salePointCount + @JsonKey(name: PriceListSummaryDto.salePointCountKey_) + int get salePointCount; + + /// policyCount + @JsonKey(name: PriceListSummaryDto.policyCountKey_) + int get policyCount; + + /// Create a copy of PriceListSummaryDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PriceListSummaryDtoCopyWith get copyWith => + _$PriceListSummaryDtoCopyWithImpl( + this as PriceListSummaryDto, _$identity); + + /// Serializes this PriceListSummaryDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PriceListSummaryDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.validFrom, validFrom) || + other.validFrom == validFrom) && + (identical(other.validTo, validTo) || other.validTo == validTo) && + (identical(other.isDefault, isDefault) || + other.isDefault == isDefault) && + (identical(other.salePointCount, salePointCount) || + other.salePointCount == salePointCount) && + (identical(other.policyCount, policyCount) || + other.policyCount == policyCount)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, enabled, validFrom, + validTo, isDefault, salePointCount, policyCount); + + @override + String toString() { + return 'PriceListSummaryDto(id: $id, name: $name, enabled: $enabled, validFrom: $validFrom, validTo: $validTo, isDefault: $isDefault, salePointCount: $salePointCount, policyCount: $policyCount)'; + } +} + +/// @nodoc +abstract mixin class $PriceListSummaryDtoCopyWith<$Res> { + factory $PriceListSummaryDtoCopyWith( + PriceListSummaryDto value, $Res Function(PriceListSummaryDto) _then) = + _$PriceListSummaryDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: PriceListSummaryDto.idKey_) String id, + @JsonKey(name: PriceListSummaryDto.nameKey_) String name, + @JsonKey(name: PriceListSummaryDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListSummaryDto.validFromKey_) DateTime? validFrom, + @JsonKey(name: PriceListSummaryDto.validToKey_) DateTime? validTo, + @JsonKey(name: PriceListSummaryDto.isDefaultKey_) bool isDefault, + @JsonKey(name: PriceListSummaryDto.salePointCountKey_) int salePointCount, + @JsonKey(name: PriceListSummaryDto.policyCountKey_) int policyCount}); +} + +/// @nodoc +class _$PriceListSummaryDtoCopyWithImpl<$Res> + implements $PriceListSummaryDtoCopyWith<$Res> { + _$PriceListSummaryDtoCopyWithImpl(this._self, this._then); + + final PriceListSummaryDto _self; + final $Res Function(PriceListSummaryDto) _then; + + /// Create a copy of PriceListSummaryDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + Object? enabled = null, + Object? validFrom = freezed, + Object? validTo = freezed, + Object? isDefault = null, + Object? salePointCount = null, + Object? policyCount = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + validFrom: freezed == validFrom + ? _self.validFrom + : validFrom // ignore: cast_nullable_to_non_nullable + as DateTime?, + validTo: freezed == validTo + ? _self.validTo + : validTo // ignore: cast_nullable_to_non_nullable + as DateTime?, + isDefault: null == isDefault + ? _self.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + salePointCount: null == salePointCount + ? _self.salePointCount + : salePointCount // ignore: cast_nullable_to_non_nullable + as int, + policyCount: null == policyCount + ? _self.policyCount + : policyCount // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// Adds pattern-matching-related methods to [PriceListSummaryDto]. +extension PriceListSummaryDtoPatterns on PriceListSummaryDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_PriceListSummaryDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListSummaryDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_PriceListSummaryDto value) $default, + ) { + final _that = this; + switch (_that) { + case _PriceListSummaryDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_PriceListSummaryDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _PriceListSummaryDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: PriceListSummaryDto.idKey_) String id, + @JsonKey(name: PriceListSummaryDto.nameKey_) String name, + @JsonKey(name: PriceListSummaryDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListSummaryDto.validFromKey_) + DateTime? validFrom, + @JsonKey(name: PriceListSummaryDto.validToKey_) DateTime? validTo, + @JsonKey(name: PriceListSummaryDto.isDefaultKey_) bool isDefault, + @JsonKey(name: PriceListSummaryDto.salePointCountKey_) + int salePointCount, + @JsonKey(name: PriceListSummaryDto.policyCountKey_) + int policyCount)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListSummaryDto() when $default != null: + return $default( + _that.id, + _that.name, + _that.enabled, + _that.validFrom, + _that.validTo, + _that.isDefault, + _that.salePointCount, + _that.policyCount); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: PriceListSummaryDto.idKey_) String id, + @JsonKey(name: PriceListSummaryDto.nameKey_) String name, + @JsonKey(name: PriceListSummaryDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListSummaryDto.validFromKey_) + DateTime? validFrom, + @JsonKey(name: PriceListSummaryDto.validToKey_) DateTime? validTo, + @JsonKey(name: PriceListSummaryDto.isDefaultKey_) bool isDefault, + @JsonKey(name: PriceListSummaryDto.salePointCountKey_) + int salePointCount, + @JsonKey(name: PriceListSummaryDto.policyCountKey_) int policyCount) + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListSummaryDto(): + return $default( + _that.id, + _that.name, + _that.enabled, + _that.validFrom, + _that.validTo, + _that.isDefault, + _that.salePointCount, + _that.policyCount); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: PriceListSummaryDto.idKey_) String id, + @JsonKey(name: PriceListSummaryDto.nameKey_) String name, + @JsonKey(name: PriceListSummaryDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListSummaryDto.validFromKey_) + DateTime? validFrom, + @JsonKey(name: PriceListSummaryDto.validToKey_) DateTime? validTo, + @JsonKey(name: PriceListSummaryDto.isDefaultKey_) bool isDefault, + @JsonKey(name: PriceListSummaryDto.salePointCountKey_) + int salePointCount, + @JsonKey(name: PriceListSummaryDto.policyCountKey_) + int policyCount)? + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListSummaryDto() when $default != null: + return $default( + _that.id, + _that.name, + _that.enabled, + _that.validFrom, + _that.validTo, + _that.isDefault, + _that.salePointCount, + _that.policyCount); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _PriceListSummaryDto extends PriceListSummaryDto { + const _PriceListSummaryDto( + {@JsonKey(name: PriceListSummaryDto.idKey_) required this.id, + @JsonKey(name: PriceListSummaryDto.nameKey_) required this.name, + @JsonKey(name: PriceListSummaryDto.enabledKey_) required this.enabled, + @JsonKey(name: PriceListSummaryDto.validFromKey_) this.validFrom, + @JsonKey(name: PriceListSummaryDto.validToKey_) this.validTo, + @JsonKey(name: PriceListSummaryDto.isDefaultKey_) required this.isDefault, + @JsonKey(name: PriceListSummaryDto.salePointCountKey_) + required this.salePointCount, + @JsonKey(name: PriceListSummaryDto.policyCountKey_) + required this.policyCount}) + : super._(); + factory _PriceListSummaryDto.fromJson(Map json) => + _$PriceListSummaryDtoFromJson(json); + + /// id + @override + @JsonKey(name: PriceListSummaryDto.idKey_) + final String id; + + /// name + @override + @JsonKey(name: PriceListSummaryDto.nameKey_) + final String name; + + /// enabled + @override + @JsonKey(name: PriceListSummaryDto.enabledKey_) + final bool enabled; + + /// validFrom + @override + @JsonKey(name: PriceListSummaryDto.validFromKey_) + final DateTime? validFrom; + + /// validTo + @override + @JsonKey(name: PriceListSummaryDto.validToKey_) + final DateTime? validTo; + + /// isDefault + @override + @JsonKey(name: PriceListSummaryDto.isDefaultKey_) + final bool isDefault; + + /// salePointCount + @override + @JsonKey(name: PriceListSummaryDto.salePointCountKey_) + final int salePointCount; + + /// policyCount + @override + @JsonKey(name: PriceListSummaryDto.policyCountKey_) + final int policyCount; + + /// Create a copy of PriceListSummaryDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PriceListSummaryDtoCopyWith<_PriceListSummaryDto> get copyWith => + __$PriceListSummaryDtoCopyWithImpl<_PriceListSummaryDto>( + this, _$identity); + + @override + Map toJson() { + return _$PriceListSummaryDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _PriceListSummaryDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.validFrom, validFrom) || + other.validFrom == validFrom) && + (identical(other.validTo, validTo) || other.validTo == validTo) && + (identical(other.isDefault, isDefault) || + other.isDefault == isDefault) && + (identical(other.salePointCount, salePointCount) || + other.salePointCount == salePointCount) && + (identical(other.policyCount, policyCount) || + other.policyCount == policyCount)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, enabled, validFrom, + validTo, isDefault, salePointCount, policyCount); + + @override + String toString() { + return 'PriceListSummaryDto(id: $id, name: $name, enabled: $enabled, validFrom: $validFrom, validTo: $validTo, isDefault: $isDefault, salePointCount: $salePointCount, policyCount: $policyCount)'; + } +} + +/// @nodoc +abstract mixin class _$PriceListSummaryDtoCopyWith<$Res> + implements $PriceListSummaryDtoCopyWith<$Res> { + factory _$PriceListSummaryDtoCopyWith(_PriceListSummaryDto value, + $Res Function(_PriceListSummaryDto) _then) = + __$PriceListSummaryDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: PriceListSummaryDto.idKey_) String id, + @JsonKey(name: PriceListSummaryDto.nameKey_) String name, + @JsonKey(name: PriceListSummaryDto.enabledKey_) bool enabled, + @JsonKey(name: PriceListSummaryDto.validFromKey_) DateTime? validFrom, + @JsonKey(name: PriceListSummaryDto.validToKey_) DateTime? validTo, + @JsonKey(name: PriceListSummaryDto.isDefaultKey_) bool isDefault, + @JsonKey(name: PriceListSummaryDto.salePointCountKey_) int salePointCount, + @JsonKey(name: PriceListSummaryDto.policyCountKey_) int policyCount}); +} + +/// @nodoc +class __$PriceListSummaryDtoCopyWithImpl<$Res> + implements _$PriceListSummaryDtoCopyWith<$Res> { + __$PriceListSummaryDtoCopyWithImpl(this._self, this._then); + + final _PriceListSummaryDto _self; + final $Res Function(_PriceListSummaryDto) _then; + + /// Create a copy of PriceListSummaryDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? name = null, + Object? enabled = null, + Object? validFrom = freezed, + Object? validTo = freezed, + Object? isDefault = null, + Object? salePointCount = null, + Object? policyCount = null, + }) { + return _then(_PriceListSummaryDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + enabled: null == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool, + validFrom: freezed == validFrom + ? _self.validFrom + : validFrom // ignore: cast_nullable_to_non_nullable + as DateTime?, + validTo: freezed == validTo + ? _self.validTo + : validTo // ignore: cast_nullable_to_non_nullable + as DateTime?, + isDefault: null == isDefault + ? _self.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + salePointCount: null == salePointCount + ? _self.salePointCount + : salePointCount // ignore: cast_nullable_to_non_nullable + as int, + policyCount: null == policyCount + ? _self.policyCount + : policyCount // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_list_summary_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_summary_dto.g.dart new file mode 100644 index 00000000..18190539 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_list_summary_dto.g.dart @@ -0,0 +1,38 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'price_list_summary_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_PriceListSummaryDto _$PriceListSummaryDtoFromJson(Map json) => + _PriceListSummaryDto( + id: json['id'] as String, + name: json['name'] as String, + enabled: json['enabled'] as bool, + validFrom: json['valid_from'] == null + ? null + : DateTime.parse(json['valid_from'] as String), + validTo: json['valid_to'] == null + ? null + : DateTime.parse(json['valid_to'] as String), + isDefault: json['is_default'] as bool, + salePointCount: (json['sale_point_count'] as num).toInt(), + policyCount: (json['policy_count'] as num).toInt(), + ); + +Map _$PriceListSummaryDtoToJson( + _PriceListSummaryDto instance) => + { + 'id': instance.id, + 'name': instance.name, + 'enabled': instance.enabled, + if (instance.validFrom?.toIso8601String() case final value?) + 'valid_from': value, + if (instance.validTo?.toIso8601String() case final value?) + 'valid_to': value, + 'is_default': instance.isDefault, + 'sale_point_count': instance.salePointCount, + 'policy_count': instance.policyCount, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_lists_api_price_lists_get_query_parameters.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_lists_api_price_lists_get_query_parameters.dart new file mode 100644 index 00000000..71699d15 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_lists_api_price_lists_get_query_parameters.dart @@ -0,0 +1,46 @@ +/// PriceListsApiPriceListsGetQueryParameters +/// { +/// "properties": { +/// "enabled": { +/// "type": "boolean", +/// "nullable": true +/// }, +/// "salePointId": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "required": [] +/// } +library price_lists_api_price_lists_get_query_parameters; + +import 'exports.dart'; +part 'price_lists_api_price_lists_get_query_parameters.freezed.dart'; +part 'price_lists_api_price_lists_get_query_parameters.g.dart'; // PriceListsApiPriceListsGetQueryParameters + +@freezed +abstract class PriceListsApiPriceListsGetQueryParameters + with _$PriceListsApiPriceListsGetQueryParameters { + const PriceListsApiPriceListsGetQueryParameters._(); + + @jsonSerializable + const factory PriceListsApiPriceListsGetQueryParameters({ + /// enabled + @JsonKey(name: PriceListsApiPriceListsGetQueryParameters.enabledKey_) + bool? enabled, + + /// salePointId + @JsonKey(name: PriceListsApiPriceListsGetQueryParameters.salePointIdKey_) + String? salePointId, + }) = _PriceListsApiPriceListsGetQueryParameters; + + factory PriceListsApiPriceListsGetQueryParameters.fromJson( + Map json, + ) => _$PriceListsApiPriceListsGetQueryParametersFromJson(json); + + static const String enabledKey_ = r'enabled'; + + static const String salePointIdKey_ = r'salePointId'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_lists_api_price_lists_get_query_parameters.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_lists_api_price_lists_get_query_parameters.freezed.dart new file mode 100644 index 00000000..e1ad763f --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_lists_api_price_lists_get_query_parameters.freezed.dart @@ -0,0 +1,388 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'price_lists_api_price_lists_get_query_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$PriceListsApiPriceListsGetQueryParameters { + /// enabled + @JsonKey(name: PriceListsApiPriceListsGetQueryParameters.enabledKey_) + bool? get enabled; + + /// salePointId + @JsonKey(name: PriceListsApiPriceListsGetQueryParameters.salePointIdKey_) + String? get salePointId; + + /// Create a copy of PriceListsApiPriceListsGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PriceListsApiPriceListsGetQueryParametersCopyWith< + PriceListsApiPriceListsGetQueryParameters> + get copyWith => _$PriceListsApiPriceListsGetQueryParametersCopyWithImpl< + PriceListsApiPriceListsGetQueryParameters>( + this as PriceListsApiPriceListsGetQueryParameters, _$identity); + + /// Serializes this PriceListsApiPriceListsGetQueryParameters to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PriceListsApiPriceListsGetQueryParameters && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, enabled, salePointId); + + @override + String toString() { + return 'PriceListsApiPriceListsGetQueryParameters(enabled: $enabled, salePointId: $salePointId)'; + } +} + +/// @nodoc +abstract mixin class $PriceListsApiPriceListsGetQueryParametersCopyWith<$Res> { + factory $PriceListsApiPriceListsGetQueryParametersCopyWith( + PriceListsApiPriceListsGetQueryParameters value, + $Res Function(PriceListsApiPriceListsGetQueryParameters) _then) = + _$PriceListsApiPriceListsGetQueryParametersCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: PriceListsApiPriceListsGetQueryParameters.enabledKey_) + bool? enabled, + @JsonKey(name: PriceListsApiPriceListsGetQueryParameters.salePointIdKey_) + String? salePointId}); +} + +/// @nodoc +class _$PriceListsApiPriceListsGetQueryParametersCopyWithImpl<$Res> + implements $PriceListsApiPriceListsGetQueryParametersCopyWith<$Res> { + _$PriceListsApiPriceListsGetQueryParametersCopyWithImpl( + this._self, this._then); + + final PriceListsApiPriceListsGetQueryParameters _self; + final $Res Function(PriceListsApiPriceListsGetQueryParameters) _then; + + /// Create a copy of PriceListsApiPriceListsGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = freezed, + Object? salePointId = freezed, + }) { + return _then(_self.copyWith( + enabled: freezed == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + salePointId: freezed == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// Adds pattern-matching-related methods to [PriceListsApiPriceListsGetQueryParameters]. +extension PriceListsApiPriceListsGetQueryParametersPatterns + on PriceListsApiPriceListsGetQueryParameters { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_PriceListsApiPriceListsGetQueryParameters value)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListsApiPriceListsGetQueryParameters() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_PriceListsApiPriceListsGetQueryParameters value) $default, + ) { + final _that = this; + switch (_that) { + case _PriceListsApiPriceListsGetQueryParameters(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_PriceListsApiPriceListsGetQueryParameters value)? + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListsApiPriceListsGetQueryParameters() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey( + name: PriceListsApiPriceListsGetQueryParameters.enabledKey_) + bool? enabled, + @JsonKey( + name: PriceListsApiPriceListsGetQueryParameters.salePointIdKey_) + String? salePointId)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PriceListsApiPriceListsGetQueryParameters() when $default != null: + return $default(_that.enabled, _that.salePointId); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey( + name: PriceListsApiPriceListsGetQueryParameters.enabledKey_) + bool? enabled, + @JsonKey( + name: PriceListsApiPriceListsGetQueryParameters.salePointIdKey_) + String? salePointId) + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListsApiPriceListsGetQueryParameters(): + return $default(_that.enabled, _that.salePointId); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey( + name: PriceListsApiPriceListsGetQueryParameters.enabledKey_) + bool? enabled, + @JsonKey( + name: PriceListsApiPriceListsGetQueryParameters.salePointIdKey_) + String? salePointId)? + $default, + ) { + final _that = this; + switch (_that) { + case _PriceListsApiPriceListsGetQueryParameters() when $default != null: + return $default(_that.enabled, _that.salePointId); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _PriceListsApiPriceListsGetQueryParameters + extends PriceListsApiPriceListsGetQueryParameters { + const _PriceListsApiPriceListsGetQueryParameters( + {@JsonKey(name: PriceListsApiPriceListsGetQueryParameters.enabledKey_) + this.enabled, + @JsonKey(name: PriceListsApiPriceListsGetQueryParameters.salePointIdKey_) + this.salePointId}) + : super._(); + factory _PriceListsApiPriceListsGetQueryParameters.fromJson( + Map json) => + _$PriceListsApiPriceListsGetQueryParametersFromJson(json); + + /// enabled + @override + @JsonKey(name: PriceListsApiPriceListsGetQueryParameters.enabledKey_) + final bool? enabled; + + /// salePointId + @override + @JsonKey(name: PriceListsApiPriceListsGetQueryParameters.salePointIdKey_) + final String? salePointId; + + /// Create a copy of PriceListsApiPriceListsGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PriceListsApiPriceListsGetQueryParametersCopyWith< + _PriceListsApiPriceListsGetQueryParameters> + get copyWith => __$PriceListsApiPriceListsGetQueryParametersCopyWithImpl< + _PriceListsApiPriceListsGetQueryParameters>(this, _$identity); + + @override + Map toJson() { + return _$PriceListsApiPriceListsGetQueryParametersToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _PriceListsApiPriceListsGetQueryParameters && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.salePointId, salePointId) || + other.salePointId == salePointId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, enabled, salePointId); + + @override + String toString() { + return 'PriceListsApiPriceListsGetQueryParameters(enabled: $enabled, salePointId: $salePointId)'; + } +} + +/// @nodoc +abstract mixin class _$PriceListsApiPriceListsGetQueryParametersCopyWith<$Res> + implements $PriceListsApiPriceListsGetQueryParametersCopyWith<$Res> { + factory _$PriceListsApiPriceListsGetQueryParametersCopyWith( + _PriceListsApiPriceListsGetQueryParameters value, + $Res Function(_PriceListsApiPriceListsGetQueryParameters) _then) = + __$PriceListsApiPriceListsGetQueryParametersCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: PriceListsApiPriceListsGetQueryParameters.enabledKey_) + bool? enabled, + @JsonKey(name: PriceListsApiPriceListsGetQueryParameters.salePointIdKey_) + String? salePointId}); +} + +/// @nodoc +class __$PriceListsApiPriceListsGetQueryParametersCopyWithImpl<$Res> + implements _$PriceListsApiPriceListsGetQueryParametersCopyWith<$Res> { + __$PriceListsApiPriceListsGetQueryParametersCopyWithImpl( + this._self, this._then); + + final _PriceListsApiPriceListsGetQueryParameters _self; + final $Res Function(_PriceListsApiPriceListsGetQueryParameters) _then; + + /// Create a copy of PriceListsApiPriceListsGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? enabled = freezed, + Object? salePointId = freezed, + }) { + return _then(_PriceListsApiPriceListsGetQueryParameters( + enabled: freezed == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + salePointId: freezed == salePointId + ? _self.salePointId + : salePointId // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/price_lists_api_price_lists_get_query_parameters.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/price_lists_api_price_lists_get_query_parameters.g.dart new file mode 100644 index 00000000..d6083b13 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/price_lists_api_price_lists_get_query_parameters.g.dart @@ -0,0 +1,22 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'price_lists_api_price_lists_get_query_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_PriceListsApiPriceListsGetQueryParameters + _$PriceListsApiPriceListsGetQueryParametersFromJson( + Map json) => + _PriceListsApiPriceListsGetQueryParameters( + enabled: json['enabled'] as bool?, + salePointId: json['salePointId'] as String?, + ); + +Map _$PriceListsApiPriceListsGetQueryParametersToJson( + _PriceListsApiPriceListsGetQueryParameters instance) => + { + if (instance.enabled case final value?) 'enabled': value, + if (instance.salePointId case final value?) 'salePointId': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/problem_details.dart b/packages/swagger_to_dart/example/lib/src/gen/models/problem_details.dart new file mode 100644 index 00000000..1a3cd984 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/problem_details.dart @@ -0,0 +1,68 @@ +/// ProblemDetails +/// { +/// "properties": { +/// "type": { +/// "type": "string", +/// "nullable": true +/// }, +/// "title": { +/// "type": "string", +/// "nullable": true +/// }, +/// "status": { +/// "type": "integer", +/// "format": "int32", +/// "nullable": true +/// }, +/// "detail": { +/// "type": "string", +/// "nullable": true +/// }, +/// "instance": { +/// "type": "string", +/// "nullable": true +/// } +/// }, +/// "type": "object" +/// } +library problem_details; + +import 'exports.dart'; +part 'problem_details.freezed.dart'; +part 'problem_details.g.dart'; // ProblemDetails + +@freezed +abstract class ProblemDetails with _$ProblemDetails { + const ProblemDetails._(); + + @jsonSerializable + const factory ProblemDetails({ + /// type + @JsonKey(name: ProblemDetails.typeKey_) String? type, + + /// title + @JsonKey(name: ProblemDetails.titleKey_) String? title, + + /// status + @JsonKey(name: ProblemDetails.statusKey_) int? status, + + /// detail + @JsonKey(name: ProblemDetails.detailKey_) String? detail, + + /// instance + @JsonKey(name: ProblemDetails.instanceKey_) String? instance, + }) = _ProblemDetails; + + factory ProblemDetails.fromJson(Map json) => + _$ProblemDetailsFromJson(json); + + static const String typeKey_ = r'type'; + + static const String titleKey_ = r'title'; + + static const String statusKey_ = r'status'; + + static const String detailKey_ = r'detail'; + + static const String instanceKey_ = r'instance'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/problem_details.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/problem_details.freezed.dart new file mode 100644 index 00000000..ae251edc --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/problem_details.freezed.dart @@ -0,0 +1,443 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'problem_details.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ProblemDetails { + /// type + @JsonKey(name: ProblemDetails.typeKey_) + String? get type; + + /// title + @JsonKey(name: ProblemDetails.titleKey_) + String? get title; + + /// status + @JsonKey(name: ProblemDetails.statusKey_) + int? get status; + + /// detail + @JsonKey(name: ProblemDetails.detailKey_) + String? get detail; + + /// instance + @JsonKey(name: ProblemDetails.instanceKey_) + String? get instance; + + /// Create a copy of ProblemDetails + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ProblemDetailsCopyWith get copyWith => + _$ProblemDetailsCopyWithImpl( + this as ProblemDetails, _$identity); + + /// Serializes this ProblemDetails to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ProblemDetails && + (identical(other.type, type) || other.type == type) && + (identical(other.title, title) || other.title == title) && + (identical(other.status, status) || other.status == status) && + (identical(other.detail, detail) || other.detail == detail) && + (identical(other.instance, instance) || + other.instance == instance)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, type, title, status, detail, instance); + + @override + String toString() { + return 'ProblemDetails(type: $type, title: $title, status: $status, detail: $detail, instance: $instance)'; + } +} + +/// @nodoc +abstract mixin class $ProblemDetailsCopyWith<$Res> { + factory $ProblemDetailsCopyWith( + ProblemDetails value, $Res Function(ProblemDetails) _then) = + _$ProblemDetailsCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: ProblemDetails.typeKey_) String? type, + @JsonKey(name: ProblemDetails.titleKey_) String? title, + @JsonKey(name: ProblemDetails.statusKey_) int? status, + @JsonKey(name: ProblemDetails.detailKey_) String? detail, + @JsonKey(name: ProblemDetails.instanceKey_) String? instance}); +} + +/// @nodoc +class _$ProblemDetailsCopyWithImpl<$Res> + implements $ProblemDetailsCopyWith<$Res> { + _$ProblemDetailsCopyWithImpl(this._self, this._then); + + final ProblemDetails _self; + final $Res Function(ProblemDetails) _then; + + /// Create a copy of ProblemDetails + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = freezed, + Object? title = freezed, + Object? status = freezed, + Object? detail = freezed, + Object? instance = freezed, + }) { + return _then(_self.copyWith( + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + title: freezed == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + status: freezed == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as int?, + detail: freezed == detail + ? _self.detail + : detail // ignore: cast_nullable_to_non_nullable + as String?, + instance: freezed == instance + ? _self.instance + : instance // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// Adds pattern-matching-related methods to [ProblemDetails]. +extension ProblemDetailsPatterns on ProblemDetails { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_ProblemDetails value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProblemDetails() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_ProblemDetails value) $default, + ) { + final _that = this; + switch (_that) { + case _ProblemDetails(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_ProblemDetails value)? $default, + ) { + final _that = this; + switch (_that) { + case _ProblemDetails() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: ProblemDetails.typeKey_) String? type, + @JsonKey(name: ProblemDetails.titleKey_) String? title, + @JsonKey(name: ProblemDetails.statusKey_) int? status, + @JsonKey(name: ProblemDetails.detailKey_) String? detail, + @JsonKey(name: ProblemDetails.instanceKey_) String? instance)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProblemDetails() when $default != null: + return $default(_that.type, _that.title, _that.status, _that.detail, + _that.instance); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: ProblemDetails.typeKey_) String? type, + @JsonKey(name: ProblemDetails.titleKey_) String? title, + @JsonKey(name: ProblemDetails.statusKey_) int? status, + @JsonKey(name: ProblemDetails.detailKey_) String? detail, + @JsonKey(name: ProblemDetails.instanceKey_) String? instance) + $default, + ) { + final _that = this; + switch (_that) { + case _ProblemDetails(): + return $default(_that.type, _that.title, _that.status, _that.detail, + _that.instance); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: ProblemDetails.typeKey_) String? type, + @JsonKey(name: ProblemDetails.titleKey_) String? title, + @JsonKey(name: ProblemDetails.statusKey_) int? status, + @JsonKey(name: ProblemDetails.detailKey_) String? detail, + @JsonKey(name: ProblemDetails.instanceKey_) String? instance)? + $default, + ) { + final _that = this; + switch (_that) { + case _ProblemDetails() when $default != null: + return $default(_that.type, _that.title, _that.status, _that.detail, + _that.instance); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _ProblemDetails extends ProblemDetails { + const _ProblemDetails( + {@JsonKey(name: ProblemDetails.typeKey_) this.type, + @JsonKey(name: ProblemDetails.titleKey_) this.title, + @JsonKey(name: ProblemDetails.statusKey_) this.status, + @JsonKey(name: ProblemDetails.detailKey_) this.detail, + @JsonKey(name: ProblemDetails.instanceKey_) this.instance}) + : super._(); + factory _ProblemDetails.fromJson(Map json) => + _$ProblemDetailsFromJson(json); + + /// type + @override + @JsonKey(name: ProblemDetails.typeKey_) + final String? type; + + /// title + @override + @JsonKey(name: ProblemDetails.titleKey_) + final String? title; + + /// status + @override + @JsonKey(name: ProblemDetails.statusKey_) + final int? status; + + /// detail + @override + @JsonKey(name: ProblemDetails.detailKey_) + final String? detail; + + /// instance + @override + @JsonKey(name: ProblemDetails.instanceKey_) + final String? instance; + + /// Create a copy of ProblemDetails + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ProblemDetailsCopyWith<_ProblemDetails> get copyWith => + __$ProblemDetailsCopyWithImpl<_ProblemDetails>(this, _$identity); + + @override + Map toJson() { + return _$ProblemDetailsToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _ProblemDetails && + (identical(other.type, type) || other.type == type) && + (identical(other.title, title) || other.title == title) && + (identical(other.status, status) || other.status == status) && + (identical(other.detail, detail) || other.detail == detail) && + (identical(other.instance, instance) || + other.instance == instance)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, type, title, status, detail, instance); + + @override + String toString() { + return 'ProblemDetails(type: $type, title: $title, status: $status, detail: $detail, instance: $instance)'; + } +} + +/// @nodoc +abstract mixin class _$ProblemDetailsCopyWith<$Res> + implements $ProblemDetailsCopyWith<$Res> { + factory _$ProblemDetailsCopyWith( + _ProblemDetails value, $Res Function(_ProblemDetails) _then) = + __$ProblemDetailsCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: ProblemDetails.typeKey_) String? type, + @JsonKey(name: ProblemDetails.titleKey_) String? title, + @JsonKey(name: ProblemDetails.statusKey_) int? status, + @JsonKey(name: ProblemDetails.detailKey_) String? detail, + @JsonKey(name: ProblemDetails.instanceKey_) String? instance}); +} + +/// @nodoc +class __$ProblemDetailsCopyWithImpl<$Res> + implements _$ProblemDetailsCopyWith<$Res> { + __$ProblemDetailsCopyWithImpl(this._self, this._then); + + final _ProblemDetails _self; + final $Res Function(_ProblemDetails) _then; + + /// Create a copy of ProblemDetails + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? type = freezed, + Object? title = freezed, + Object? status = freezed, + Object? detail = freezed, + Object? instance = freezed, + }) { + return _then(_ProblemDetails( + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + title: freezed == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + status: freezed == status + ? _self.status + : status // ignore: cast_nullable_to_non_nullable + as int?, + detail: freezed == detail + ? _self.detail + : detail // ignore: cast_nullable_to_non_nullable + as String?, + instance: freezed == instance + ? _self.instance + : instance // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/problem_details.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/problem_details.g.dart new file mode 100644 index 00000000..8e0ce0fa --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/problem_details.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'problem_details.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_ProblemDetails _$ProblemDetailsFromJson(Map json) => + _ProblemDetails( + type: json['type'] as String?, + title: json['title'] as String?, + status: (json['status'] as num?)?.toInt(), + detail: json['detail'] as String?, + instance: json['instance'] as String?, + ); + +Map _$ProblemDetailsToJson(_ProblemDetails instance) => + { + if (instance.type case final value?) 'type': value, + if (instance.title case final value?) 'title': value, + if (instance.status case final value?) 'status': value, + if (instance.detail case final value?) 'detail': value, + if (instance.instance case final value?) 'instance': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_category_ref.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_category_ref.dart new file mode 100644 index 00000000..1463f072 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_category_ref.dart @@ -0,0 +1,44 @@ +/// ProductCategoryRef +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "name": { +/// "type": "string" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "id", +/// "name" +/// ], +/// "additionalProperties": false +/// } +library product_category_ref; + +import 'exports.dart'; +part 'product_category_ref.freezed.dart'; +part 'product_category_ref.g.dart'; // ProductCategoryRef + +@freezed +abstract class ProductCategoryRef with _$ProductCategoryRef { + const ProductCategoryRef._(); + + @jsonSerializable + const factory ProductCategoryRef({ + /// id + @JsonKey(name: ProductCategoryRef.idKey_) required String id, + + /// name + @JsonKey(name: ProductCategoryRef.nameKey_) required String name, + }) = _ProductCategoryRef; + + factory ProductCategoryRef.fromJson(Map json) => + _$ProductCategoryRefFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_category_ref.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_category_ref.freezed.dart new file mode 100644 index 00000000..a6520437 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_category_ref.freezed.dart @@ -0,0 +1,352 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'product_category_ref.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ProductCategoryRef { + /// id + @JsonKey(name: ProductCategoryRef.idKey_) + String get id; + + /// name + @JsonKey(name: ProductCategoryRef.nameKey_) + String get name; + + /// Create a copy of ProductCategoryRef + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ProductCategoryRefCopyWith get copyWith => + _$ProductCategoryRefCopyWithImpl( + this as ProductCategoryRef, _$identity); + + /// Serializes this ProductCategoryRef to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ProductCategoryRef && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name); + + @override + String toString() { + return 'ProductCategoryRef(id: $id, name: $name)'; + } +} + +/// @nodoc +abstract mixin class $ProductCategoryRefCopyWith<$Res> { + factory $ProductCategoryRefCopyWith( + ProductCategoryRef value, $Res Function(ProductCategoryRef) _then) = + _$ProductCategoryRefCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: ProductCategoryRef.idKey_) String id, + @JsonKey(name: ProductCategoryRef.nameKey_) String name}); +} + +/// @nodoc +class _$ProductCategoryRefCopyWithImpl<$Res> + implements $ProductCategoryRefCopyWith<$Res> { + _$ProductCategoryRefCopyWithImpl(this._self, this._then); + + final ProductCategoryRef _self; + final $Res Function(ProductCategoryRef) _then; + + /// Create a copy of ProductCategoryRef + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [ProductCategoryRef]. +extension ProductCategoryRefPatterns on ProductCategoryRef { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_ProductCategoryRef value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductCategoryRef() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_ProductCategoryRef value) $default, + ) { + final _that = this; + switch (_that) { + case _ProductCategoryRef(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_ProductCategoryRef value)? $default, + ) { + final _that = this; + switch (_that) { + case _ProductCategoryRef() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(@JsonKey(name: ProductCategoryRef.idKey_) String id, + @JsonKey(name: ProductCategoryRef.nameKey_) String name)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductCategoryRef() when $default != null: + return $default(_that.id, _that.name); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(@JsonKey(name: ProductCategoryRef.idKey_) String id, + @JsonKey(name: ProductCategoryRef.nameKey_) String name) + $default, + ) { + final _that = this; + switch (_that) { + case _ProductCategoryRef(): + return $default(_that.id, _that.name); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(@JsonKey(name: ProductCategoryRef.idKey_) String id, + @JsonKey(name: ProductCategoryRef.nameKey_) String name)? + $default, + ) { + final _that = this; + switch (_that) { + case _ProductCategoryRef() when $default != null: + return $default(_that.id, _that.name); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _ProductCategoryRef extends ProductCategoryRef { + const _ProductCategoryRef( + {@JsonKey(name: ProductCategoryRef.idKey_) required this.id, + @JsonKey(name: ProductCategoryRef.nameKey_) required this.name}) + : super._(); + factory _ProductCategoryRef.fromJson(Map json) => + _$ProductCategoryRefFromJson(json); + + /// id + @override + @JsonKey(name: ProductCategoryRef.idKey_) + final String id; + + /// name + @override + @JsonKey(name: ProductCategoryRef.nameKey_) + final String name; + + /// Create a copy of ProductCategoryRef + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ProductCategoryRefCopyWith<_ProductCategoryRef> get copyWith => + __$ProductCategoryRefCopyWithImpl<_ProductCategoryRef>(this, _$identity); + + @override + Map toJson() { + return _$ProductCategoryRefToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _ProductCategoryRef && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name); + + @override + String toString() { + return 'ProductCategoryRef(id: $id, name: $name)'; + } +} + +/// @nodoc +abstract mixin class _$ProductCategoryRefCopyWith<$Res> + implements $ProductCategoryRefCopyWith<$Res> { + factory _$ProductCategoryRefCopyWith( + _ProductCategoryRef value, $Res Function(_ProductCategoryRef) _then) = + __$ProductCategoryRefCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: ProductCategoryRef.idKey_) String id, + @JsonKey(name: ProductCategoryRef.nameKey_) String name}); +} + +/// @nodoc +class __$ProductCategoryRefCopyWithImpl<$Res> + implements _$ProductCategoryRefCopyWith<$Res> { + __$ProductCategoryRefCopyWithImpl(this._self, this._then); + + final _ProductCategoryRef _self; + final $Res Function(_ProductCategoryRef) _then; + + /// Create a copy of ProductCategoryRef + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? name = null, + }) { + return _then(_ProductCategoryRef( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_category_ref.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_category_ref.g.dart new file mode 100644 index 00000000..c5284532 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_category_ref.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'product_category_ref.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_ProductCategoryRef _$ProductCategoryRefFromJson(Map json) => + _ProductCategoryRef( + id: json['id'] as String, + name: json['name'] as String, + ); + +Map _$ProductCategoryRefToJson(_ProductCategoryRef instance) => + { + 'id': instance.id, + 'name': instance.name, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto.dart new file mode 100644 index 00000000..b322730c --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto.dart @@ -0,0 +1,188 @@ +/// ProductDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "category_path": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/ProductCategoryRef" +/// } +/// }, +/// "name": { +/// "type": "string" +/// }, +/// "description": { +/// "type": "string", +/// "nullable": true +/// }, +/// "barcode": { +/// "type": "string", +/// "nullable": true +/// }, +/// "unitary_purchase_price": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "markup_percentage": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "unitary_sale_price": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "has_variants": { +/// "type": "boolean" +/// }, +/// "use_boolean_stock": { +/// "type": "boolean" +/// }, +/// "has_stock": { +/// "type": "boolean" +/// }, +/// "stock": { +/// "type": "integer", +/// "format": "int32", +/// "nullable": true +/// }, +/// "base_uom": { +/// "$ref": "#/components/schemas/BaseUomKind" +/// }, +/// "allow_generic": { +/// "type": "boolean" +/// }, +/// "variants": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/ProductVariantDto" +/// } +/// }, +/// "presentations": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/ProductPresentationDto" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "allow_generic", +/// "base_uom", +/// "category_path", +/// "has_stock", +/// "has_variants", +/// "id", +/// "name", +/// "presentations", +/// "use_boolean_stock", +/// "variants" +/// ], +/// "additionalProperties": false +/// } +library product_dto; + +import 'exports.dart'; +part 'product_dto.freezed.dart'; +part 'product_dto.g.dart'; // ProductDto + +@freezed +abstract class ProductDto with _$ProductDto { + const ProductDto._(); + + @jsonSerializable + const factory ProductDto({ + /// id + @JsonKey(name: ProductDto.idKey_) required String id, + + /// categoryPath + @JsonKey(name: ProductDto.categoryPathKey_) + required List categoryPath, + + /// name + @JsonKey(name: ProductDto.nameKey_) required String name, + + /// description + @JsonKey(name: ProductDto.descriptionKey_) String? description, + + /// barcode + @JsonKey(name: ProductDto.barcodeKey_) String? barcode, + + /// unitaryPurchasePrice + @JsonKey(name: ProductDto.unitaryPurchasePriceKey_) + double? unitaryPurchasePrice, + + /// markupPercentage + @JsonKey(name: ProductDto.markupPercentageKey_) double? markupPercentage, + + /// unitarySalePrice + @JsonKey(name: ProductDto.unitarySalePriceKey_) double? unitarySalePrice, + + /// hasVariants + @JsonKey(name: ProductDto.hasVariantsKey_) required bool hasVariants, + + /// useBooleanStock + @JsonKey(name: ProductDto.useBooleanStockKey_) + required bool useBooleanStock, + + /// hasStock + @JsonKey(name: ProductDto.hasStockKey_) required bool hasStock, + + /// stock + @JsonKey(name: ProductDto.stockKey_) int? stock, + + /// baseUom + @JsonKey(name: ProductDto.baseUomKey_) required BaseUomKind baseUom, + + /// allowGeneric + @JsonKey(name: ProductDto.allowGenericKey_) required bool allowGeneric, + + /// variants + @JsonKey(name: ProductDto.variantsKey_) + required List variants, + + /// presentations + @JsonKey(name: ProductDto.presentationsKey_) + required List presentations, + }) = _ProductDto; + + factory ProductDto.fromJson(Map json) => + _$ProductDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String categoryPathKey_ = r'category_path'; + + static const String nameKey_ = r'name'; + + static const String descriptionKey_ = r'description'; + + static const String barcodeKey_ = r'barcode'; + + static const String unitaryPurchasePriceKey_ = r'unitary_purchase_price'; + + static const String markupPercentageKey_ = r'markup_percentage'; + + static const String unitarySalePriceKey_ = r'unitary_sale_price'; + + static const String hasVariantsKey_ = r'has_variants'; + + static const String useBooleanStockKey_ = r'use_boolean_stock'; + + static const String hasStockKey_ = r'has_stock'; + + static const String stockKey_ = r'stock'; + + static const String baseUomKey_ = r'base_uom'; + + static const String allowGenericKey_ = r'allow_generic'; + + static const String variantsKey_ = r'variants'; + + static const String presentationsKey_ = r'presentations'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto.freezed.dart new file mode 100644 index 00000000..30c86cae --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto.freezed.dart @@ -0,0 +1,885 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'product_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ProductDto { + /// id + @JsonKey(name: ProductDto.idKey_) + String get id; + + /// categoryPath + @JsonKey(name: ProductDto.categoryPathKey_) + List get categoryPath; + + /// name + @JsonKey(name: ProductDto.nameKey_) + String get name; + + /// description + @JsonKey(name: ProductDto.descriptionKey_) + String? get description; + + /// barcode + @JsonKey(name: ProductDto.barcodeKey_) + String? get barcode; + + /// unitaryPurchasePrice + @JsonKey(name: ProductDto.unitaryPurchasePriceKey_) + double? get unitaryPurchasePrice; + + /// markupPercentage + @JsonKey(name: ProductDto.markupPercentageKey_) + double? get markupPercentage; + + /// unitarySalePrice + @JsonKey(name: ProductDto.unitarySalePriceKey_) + double? get unitarySalePrice; + + /// hasVariants + @JsonKey(name: ProductDto.hasVariantsKey_) + bool get hasVariants; + + /// useBooleanStock + @JsonKey(name: ProductDto.useBooleanStockKey_) + bool get useBooleanStock; + + /// hasStock + @JsonKey(name: ProductDto.hasStockKey_) + bool get hasStock; + + /// stock + @JsonKey(name: ProductDto.stockKey_) + int? get stock; + + /// baseUom + @JsonKey(name: ProductDto.baseUomKey_) + BaseUomKind get baseUom; + + /// allowGeneric + @JsonKey(name: ProductDto.allowGenericKey_) + bool get allowGeneric; + + /// variants + @JsonKey(name: ProductDto.variantsKey_) + List get variants; + + /// presentations + @JsonKey(name: ProductDto.presentationsKey_) + List get presentations; + + /// Create a copy of ProductDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ProductDtoCopyWith get copyWith => + _$ProductDtoCopyWithImpl(this as ProductDto, _$identity); + + /// Serializes this ProductDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ProductDto && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality() + .equals(other.categoryPath, categoryPath) && + (identical(other.name, name) || other.name == name) && + (identical(other.description, description) || + other.description == description) && + (identical(other.barcode, barcode) || other.barcode == barcode) && + (identical(other.unitaryPurchasePrice, unitaryPurchasePrice) || + other.unitaryPurchasePrice == unitaryPurchasePrice) && + (identical(other.markupPercentage, markupPercentage) || + other.markupPercentage == markupPercentage) && + (identical(other.unitarySalePrice, unitarySalePrice) || + other.unitarySalePrice == unitarySalePrice) && + (identical(other.hasVariants, hasVariants) || + other.hasVariants == hasVariants) && + (identical(other.useBooleanStock, useBooleanStock) || + other.useBooleanStock == useBooleanStock) && + (identical(other.hasStock, hasStock) || + other.hasStock == hasStock) && + (identical(other.stock, stock) || other.stock == stock) && + (identical(other.baseUom, baseUom) || other.baseUom == baseUom) && + (identical(other.allowGeneric, allowGeneric) || + other.allowGeneric == allowGeneric) && + const DeepCollectionEquality().equals(other.variants, variants) && + const DeepCollectionEquality() + .equals(other.presentations, presentations)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + const DeepCollectionEquality().hash(categoryPath), + name, + description, + barcode, + unitaryPurchasePrice, + markupPercentage, + unitarySalePrice, + hasVariants, + useBooleanStock, + hasStock, + stock, + baseUom, + allowGeneric, + const DeepCollectionEquality().hash(variants), + const DeepCollectionEquality().hash(presentations)); + + @override + String toString() { + return 'ProductDto(id: $id, categoryPath: $categoryPath, name: $name, description: $description, barcode: $barcode, unitaryPurchasePrice: $unitaryPurchasePrice, markupPercentage: $markupPercentage, unitarySalePrice: $unitarySalePrice, hasVariants: $hasVariants, useBooleanStock: $useBooleanStock, hasStock: $hasStock, stock: $stock, baseUom: $baseUom, allowGeneric: $allowGeneric, variants: $variants, presentations: $presentations)'; + } +} + +/// @nodoc +abstract mixin class $ProductDtoCopyWith<$Res> { + factory $ProductDtoCopyWith( + ProductDto value, $Res Function(ProductDto) _then) = + _$ProductDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: ProductDto.idKey_) String id, + @JsonKey(name: ProductDto.categoryPathKey_) + List categoryPath, + @JsonKey(name: ProductDto.nameKey_) String name, + @JsonKey(name: ProductDto.descriptionKey_) String? description, + @JsonKey(name: ProductDto.barcodeKey_) String? barcode, + @JsonKey(name: ProductDto.unitaryPurchasePriceKey_) + double? unitaryPurchasePrice, + @JsonKey(name: ProductDto.markupPercentageKey_) double? markupPercentage, + @JsonKey(name: ProductDto.unitarySalePriceKey_) double? unitarySalePrice, + @JsonKey(name: ProductDto.hasVariantsKey_) bool hasVariants, + @JsonKey(name: ProductDto.useBooleanStockKey_) bool useBooleanStock, + @JsonKey(name: ProductDto.hasStockKey_) bool hasStock, + @JsonKey(name: ProductDto.stockKey_) int? stock, + @JsonKey(name: ProductDto.baseUomKey_) BaseUomKind baseUom, + @JsonKey(name: ProductDto.allowGenericKey_) bool allowGeneric, + @JsonKey(name: ProductDto.variantsKey_) List variants, + @JsonKey(name: ProductDto.presentationsKey_) + List presentations}); +} + +/// @nodoc +class _$ProductDtoCopyWithImpl<$Res> implements $ProductDtoCopyWith<$Res> { + _$ProductDtoCopyWithImpl(this._self, this._then); + + final ProductDto _self; + final $Res Function(ProductDto) _then; + + /// Create a copy of ProductDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? categoryPath = null, + Object? name = null, + Object? description = freezed, + Object? barcode = freezed, + Object? unitaryPurchasePrice = freezed, + Object? markupPercentage = freezed, + Object? unitarySalePrice = freezed, + Object? hasVariants = null, + Object? useBooleanStock = null, + Object? hasStock = null, + Object? stock = freezed, + Object? baseUom = null, + Object? allowGeneric = null, + Object? variants = null, + Object? presentations = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + categoryPath: null == categoryPath + ? _self.categoryPath + : categoryPath // ignore: cast_nullable_to_non_nullable + as List, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + barcode: freezed == barcode + ? _self.barcode + : barcode // ignore: cast_nullable_to_non_nullable + as String?, + unitaryPurchasePrice: freezed == unitaryPurchasePrice + ? _self.unitaryPurchasePrice + : unitaryPurchasePrice // ignore: cast_nullable_to_non_nullable + as double?, + markupPercentage: freezed == markupPercentage + ? _self.markupPercentage + : markupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + unitarySalePrice: freezed == unitarySalePrice + ? _self.unitarySalePrice + : unitarySalePrice // ignore: cast_nullable_to_non_nullable + as double?, + hasVariants: null == hasVariants + ? _self.hasVariants + : hasVariants // ignore: cast_nullable_to_non_nullable + as bool, + useBooleanStock: null == useBooleanStock + ? _self.useBooleanStock + : useBooleanStock // ignore: cast_nullable_to_non_nullable + as bool, + hasStock: null == hasStock + ? _self.hasStock + : hasStock // ignore: cast_nullable_to_non_nullable + as bool, + stock: freezed == stock + ? _self.stock + : stock // ignore: cast_nullable_to_non_nullable + as int?, + baseUom: null == baseUom + ? _self.baseUom + : baseUom // ignore: cast_nullable_to_non_nullable + as BaseUomKind, + allowGeneric: null == allowGeneric + ? _self.allowGeneric + : allowGeneric // ignore: cast_nullable_to_non_nullable + as bool, + variants: null == variants + ? _self.variants + : variants // ignore: cast_nullable_to_non_nullable + as List, + presentations: null == presentations + ? _self.presentations + : presentations // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [ProductDto]. +extension ProductDtoPatterns on ProductDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_ProductDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_ProductDto value) $default, + ) { + final _that = this; + switch (_that) { + case _ProductDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_ProductDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _ProductDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: ProductDto.idKey_) String id, + @JsonKey(name: ProductDto.categoryPathKey_) + List categoryPath, + @JsonKey(name: ProductDto.nameKey_) String name, + @JsonKey(name: ProductDto.descriptionKey_) String? description, + @JsonKey(name: ProductDto.barcodeKey_) String? barcode, + @JsonKey(name: ProductDto.unitaryPurchasePriceKey_) + double? unitaryPurchasePrice, + @JsonKey(name: ProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: ProductDto.unitarySalePriceKey_) + double? unitarySalePrice, + @JsonKey(name: ProductDto.hasVariantsKey_) bool hasVariants, + @JsonKey(name: ProductDto.useBooleanStockKey_) bool useBooleanStock, + @JsonKey(name: ProductDto.hasStockKey_) bool hasStock, + @JsonKey(name: ProductDto.stockKey_) int? stock, + @JsonKey(name: ProductDto.baseUomKey_) BaseUomKind baseUom, + @JsonKey(name: ProductDto.allowGenericKey_) bool allowGeneric, + @JsonKey(name: ProductDto.variantsKey_) + List variants, + @JsonKey(name: ProductDto.presentationsKey_) + List presentations)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductDto() when $default != null: + return $default( + _that.id, + _that.categoryPath, + _that.name, + _that.description, + _that.barcode, + _that.unitaryPurchasePrice, + _that.markupPercentage, + _that.unitarySalePrice, + _that.hasVariants, + _that.useBooleanStock, + _that.hasStock, + _that.stock, + _that.baseUom, + _that.allowGeneric, + _that.variants, + _that.presentations); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: ProductDto.idKey_) String id, + @JsonKey(name: ProductDto.categoryPathKey_) + List categoryPath, + @JsonKey(name: ProductDto.nameKey_) String name, + @JsonKey(name: ProductDto.descriptionKey_) String? description, + @JsonKey(name: ProductDto.barcodeKey_) String? barcode, + @JsonKey(name: ProductDto.unitaryPurchasePriceKey_) + double? unitaryPurchasePrice, + @JsonKey(name: ProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: ProductDto.unitarySalePriceKey_) + double? unitarySalePrice, + @JsonKey(name: ProductDto.hasVariantsKey_) bool hasVariants, + @JsonKey(name: ProductDto.useBooleanStockKey_) bool useBooleanStock, + @JsonKey(name: ProductDto.hasStockKey_) bool hasStock, + @JsonKey(name: ProductDto.stockKey_) int? stock, + @JsonKey(name: ProductDto.baseUomKey_) BaseUomKind baseUom, + @JsonKey(name: ProductDto.allowGenericKey_) bool allowGeneric, + @JsonKey(name: ProductDto.variantsKey_) + List variants, + @JsonKey(name: ProductDto.presentationsKey_) + List presentations) + $default, + ) { + final _that = this; + switch (_that) { + case _ProductDto(): + return $default( + _that.id, + _that.categoryPath, + _that.name, + _that.description, + _that.barcode, + _that.unitaryPurchasePrice, + _that.markupPercentage, + _that.unitarySalePrice, + _that.hasVariants, + _that.useBooleanStock, + _that.hasStock, + _that.stock, + _that.baseUom, + _that.allowGeneric, + _that.variants, + _that.presentations); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: ProductDto.idKey_) String id, + @JsonKey(name: ProductDto.categoryPathKey_) + List categoryPath, + @JsonKey(name: ProductDto.nameKey_) String name, + @JsonKey(name: ProductDto.descriptionKey_) String? description, + @JsonKey(name: ProductDto.barcodeKey_) String? barcode, + @JsonKey(name: ProductDto.unitaryPurchasePriceKey_) + double? unitaryPurchasePrice, + @JsonKey(name: ProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: ProductDto.unitarySalePriceKey_) + double? unitarySalePrice, + @JsonKey(name: ProductDto.hasVariantsKey_) bool hasVariants, + @JsonKey(name: ProductDto.useBooleanStockKey_) bool useBooleanStock, + @JsonKey(name: ProductDto.hasStockKey_) bool hasStock, + @JsonKey(name: ProductDto.stockKey_) int? stock, + @JsonKey(name: ProductDto.baseUomKey_) BaseUomKind baseUom, + @JsonKey(name: ProductDto.allowGenericKey_) bool allowGeneric, + @JsonKey(name: ProductDto.variantsKey_) + List variants, + @JsonKey(name: ProductDto.presentationsKey_) + List presentations)? + $default, + ) { + final _that = this; + switch (_that) { + case _ProductDto() when $default != null: + return $default( + _that.id, + _that.categoryPath, + _that.name, + _that.description, + _that.barcode, + _that.unitaryPurchasePrice, + _that.markupPercentage, + _that.unitarySalePrice, + _that.hasVariants, + _that.useBooleanStock, + _that.hasStock, + _that.stock, + _that.baseUom, + _that.allowGeneric, + _that.variants, + _that.presentations); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _ProductDto extends ProductDto { + const _ProductDto( + {@JsonKey(name: ProductDto.idKey_) required this.id, + @JsonKey(name: ProductDto.categoryPathKey_) + required final List categoryPath, + @JsonKey(name: ProductDto.nameKey_) required this.name, + @JsonKey(name: ProductDto.descriptionKey_) this.description, + @JsonKey(name: ProductDto.barcodeKey_) this.barcode, + @JsonKey(name: ProductDto.unitaryPurchasePriceKey_) + this.unitaryPurchasePrice, + @JsonKey(name: ProductDto.markupPercentageKey_) this.markupPercentage, + @JsonKey(name: ProductDto.unitarySalePriceKey_) this.unitarySalePrice, + @JsonKey(name: ProductDto.hasVariantsKey_) required this.hasVariants, + @JsonKey(name: ProductDto.useBooleanStockKey_) + required this.useBooleanStock, + @JsonKey(name: ProductDto.hasStockKey_) required this.hasStock, + @JsonKey(name: ProductDto.stockKey_) this.stock, + @JsonKey(name: ProductDto.baseUomKey_) required this.baseUom, + @JsonKey(name: ProductDto.allowGenericKey_) required this.allowGeneric, + @JsonKey(name: ProductDto.variantsKey_) + required final List variants, + @JsonKey(name: ProductDto.presentationsKey_) + required final List presentations}) + : _categoryPath = categoryPath, + _variants = variants, + _presentations = presentations, + super._(); + factory _ProductDto.fromJson(Map json) => + _$ProductDtoFromJson(json); + + /// id + @override + @JsonKey(name: ProductDto.idKey_) + final String id; + + /// categoryPath + final List _categoryPath; + + /// categoryPath + @override + @JsonKey(name: ProductDto.categoryPathKey_) + List get categoryPath { + if (_categoryPath is EqualUnmodifiableListView) return _categoryPath; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_categoryPath); + } + + /// name + @override + @JsonKey(name: ProductDto.nameKey_) + final String name; + + /// description + @override + @JsonKey(name: ProductDto.descriptionKey_) + final String? description; + + /// barcode + @override + @JsonKey(name: ProductDto.barcodeKey_) + final String? barcode; + + /// unitaryPurchasePrice + @override + @JsonKey(name: ProductDto.unitaryPurchasePriceKey_) + final double? unitaryPurchasePrice; + + /// markupPercentage + @override + @JsonKey(name: ProductDto.markupPercentageKey_) + final double? markupPercentage; + + /// unitarySalePrice + @override + @JsonKey(name: ProductDto.unitarySalePriceKey_) + final double? unitarySalePrice; + + /// hasVariants + @override + @JsonKey(name: ProductDto.hasVariantsKey_) + final bool hasVariants; + + /// useBooleanStock + @override + @JsonKey(name: ProductDto.useBooleanStockKey_) + final bool useBooleanStock; + + /// hasStock + @override + @JsonKey(name: ProductDto.hasStockKey_) + final bool hasStock; + + /// stock + @override + @JsonKey(name: ProductDto.stockKey_) + final int? stock; + + /// baseUom + @override + @JsonKey(name: ProductDto.baseUomKey_) + final BaseUomKind baseUom; + + /// allowGeneric + @override + @JsonKey(name: ProductDto.allowGenericKey_) + final bool allowGeneric; + + /// variants + final List _variants; + + /// variants + @override + @JsonKey(name: ProductDto.variantsKey_) + List get variants { + if (_variants is EqualUnmodifiableListView) return _variants; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_variants); + } + + /// presentations + final List _presentations; + + /// presentations + @override + @JsonKey(name: ProductDto.presentationsKey_) + List get presentations { + if (_presentations is EqualUnmodifiableListView) return _presentations; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_presentations); + } + + /// Create a copy of ProductDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ProductDtoCopyWith<_ProductDto> get copyWith => + __$ProductDtoCopyWithImpl<_ProductDto>(this, _$identity); + + @override + Map toJson() { + return _$ProductDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _ProductDto && + (identical(other.id, id) || other.id == id) && + const DeepCollectionEquality() + .equals(other._categoryPath, _categoryPath) && + (identical(other.name, name) || other.name == name) && + (identical(other.description, description) || + other.description == description) && + (identical(other.barcode, barcode) || other.barcode == barcode) && + (identical(other.unitaryPurchasePrice, unitaryPurchasePrice) || + other.unitaryPurchasePrice == unitaryPurchasePrice) && + (identical(other.markupPercentage, markupPercentage) || + other.markupPercentage == markupPercentage) && + (identical(other.unitarySalePrice, unitarySalePrice) || + other.unitarySalePrice == unitarySalePrice) && + (identical(other.hasVariants, hasVariants) || + other.hasVariants == hasVariants) && + (identical(other.useBooleanStock, useBooleanStock) || + other.useBooleanStock == useBooleanStock) && + (identical(other.hasStock, hasStock) || + other.hasStock == hasStock) && + (identical(other.stock, stock) || other.stock == stock) && + (identical(other.baseUom, baseUom) || other.baseUom == baseUom) && + (identical(other.allowGeneric, allowGeneric) || + other.allowGeneric == allowGeneric) && + const DeepCollectionEquality().equals(other._variants, _variants) && + const DeepCollectionEquality() + .equals(other._presentations, _presentations)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + const DeepCollectionEquality().hash(_categoryPath), + name, + description, + barcode, + unitaryPurchasePrice, + markupPercentage, + unitarySalePrice, + hasVariants, + useBooleanStock, + hasStock, + stock, + baseUom, + allowGeneric, + const DeepCollectionEquality().hash(_variants), + const DeepCollectionEquality().hash(_presentations)); + + @override + String toString() { + return 'ProductDto(id: $id, categoryPath: $categoryPath, name: $name, description: $description, barcode: $barcode, unitaryPurchasePrice: $unitaryPurchasePrice, markupPercentage: $markupPercentage, unitarySalePrice: $unitarySalePrice, hasVariants: $hasVariants, useBooleanStock: $useBooleanStock, hasStock: $hasStock, stock: $stock, baseUom: $baseUom, allowGeneric: $allowGeneric, variants: $variants, presentations: $presentations)'; + } +} + +/// @nodoc +abstract mixin class _$ProductDtoCopyWith<$Res> + implements $ProductDtoCopyWith<$Res> { + factory _$ProductDtoCopyWith( + _ProductDto value, $Res Function(_ProductDto) _then) = + __$ProductDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: ProductDto.idKey_) String id, + @JsonKey(name: ProductDto.categoryPathKey_) + List categoryPath, + @JsonKey(name: ProductDto.nameKey_) String name, + @JsonKey(name: ProductDto.descriptionKey_) String? description, + @JsonKey(name: ProductDto.barcodeKey_) String? barcode, + @JsonKey(name: ProductDto.unitaryPurchasePriceKey_) + double? unitaryPurchasePrice, + @JsonKey(name: ProductDto.markupPercentageKey_) double? markupPercentage, + @JsonKey(name: ProductDto.unitarySalePriceKey_) double? unitarySalePrice, + @JsonKey(name: ProductDto.hasVariantsKey_) bool hasVariants, + @JsonKey(name: ProductDto.useBooleanStockKey_) bool useBooleanStock, + @JsonKey(name: ProductDto.hasStockKey_) bool hasStock, + @JsonKey(name: ProductDto.stockKey_) int? stock, + @JsonKey(name: ProductDto.baseUomKey_) BaseUomKind baseUom, + @JsonKey(name: ProductDto.allowGenericKey_) bool allowGeneric, + @JsonKey(name: ProductDto.variantsKey_) List variants, + @JsonKey(name: ProductDto.presentationsKey_) + List presentations}); +} + +/// @nodoc +class __$ProductDtoCopyWithImpl<$Res> implements _$ProductDtoCopyWith<$Res> { + __$ProductDtoCopyWithImpl(this._self, this._then); + + final _ProductDto _self; + final $Res Function(_ProductDto) _then; + + /// Create a copy of ProductDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? categoryPath = null, + Object? name = null, + Object? description = freezed, + Object? barcode = freezed, + Object? unitaryPurchasePrice = freezed, + Object? markupPercentage = freezed, + Object? unitarySalePrice = freezed, + Object? hasVariants = null, + Object? useBooleanStock = null, + Object? hasStock = null, + Object? stock = freezed, + Object? baseUom = null, + Object? allowGeneric = null, + Object? variants = null, + Object? presentations = null, + }) { + return _then(_ProductDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + categoryPath: null == categoryPath + ? _self._categoryPath + : categoryPath // ignore: cast_nullable_to_non_nullable + as List, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + barcode: freezed == barcode + ? _self.barcode + : barcode // ignore: cast_nullable_to_non_nullable + as String?, + unitaryPurchasePrice: freezed == unitaryPurchasePrice + ? _self.unitaryPurchasePrice + : unitaryPurchasePrice // ignore: cast_nullable_to_non_nullable + as double?, + markupPercentage: freezed == markupPercentage + ? _self.markupPercentage + : markupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + unitarySalePrice: freezed == unitarySalePrice + ? _self.unitarySalePrice + : unitarySalePrice // ignore: cast_nullable_to_non_nullable + as double?, + hasVariants: null == hasVariants + ? _self.hasVariants + : hasVariants // ignore: cast_nullable_to_non_nullable + as bool, + useBooleanStock: null == useBooleanStock + ? _self.useBooleanStock + : useBooleanStock // ignore: cast_nullable_to_non_nullable + as bool, + hasStock: null == hasStock + ? _self.hasStock + : hasStock // ignore: cast_nullable_to_non_nullable + as bool, + stock: freezed == stock + ? _self.stock + : stock // ignore: cast_nullable_to_non_nullable + as int?, + baseUom: null == baseUom + ? _self.baseUom + : baseUom // ignore: cast_nullable_to_non_nullable + as BaseUomKind, + allowGeneric: null == allowGeneric + ? _self.allowGeneric + : allowGeneric // ignore: cast_nullable_to_non_nullable + as bool, + variants: null == variants + ? _self._variants + : variants // ignore: cast_nullable_to_non_nullable + as List, + presentations: null == presentations + ? _self._presentations + : presentations // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto.g.dart new file mode 100644 index 00000000..34ade2b9 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto.g.dart @@ -0,0 +1,57 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'product_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_ProductDto _$ProductDtoFromJson(Map json) => _ProductDto( + id: json['id'] as String, + categoryPath: (json['category_path'] as List) + .map((e) => ProductCategoryRef.fromJson(e as Map)) + .toList(), + name: json['name'] as String, + description: json['description'] as String?, + barcode: json['barcode'] as String?, + unitaryPurchasePrice: + (json['unitary_purchase_price'] as num?)?.toDouble(), + markupPercentage: (json['markup_percentage'] as num?)?.toDouble(), + unitarySalePrice: (json['unitary_sale_price'] as num?)?.toDouble(), + hasVariants: json['has_variants'] as bool, + useBooleanStock: json['use_boolean_stock'] as bool, + hasStock: json['has_stock'] as bool, + stock: (json['stock'] as num?)?.toInt(), + baseUom: BaseUomKind.fromJson(json['base_uom'] as String), + allowGeneric: json['allow_generic'] as bool, + variants: (json['variants'] as List) + .map((e) => ProductVariantDto.fromJson(e as Map)) + .toList(), + presentations: (json['presentations'] as List) + .map( + (e) => ProductPresentationDto.fromJson(e as Map)) + .toList(), + ); + +Map _$ProductDtoToJson(_ProductDto instance) => + { + 'id': instance.id, + 'category_path': instance.categoryPath.map((e) => e.toJson()).toList(), + 'name': instance.name, + if (instance.description case final value?) 'description': value, + if (instance.barcode case final value?) 'barcode': value, + if (instance.unitaryPurchasePrice case final value?) + 'unitary_purchase_price': value, + if (instance.markupPercentage case final value?) + 'markup_percentage': value, + if (instance.unitarySalePrice case final value?) + 'unitary_sale_price': value, + 'has_variants': instance.hasVariants, + 'use_boolean_stock': instance.useBooleanStock, + 'has_stock': instance.hasStock, + if (instance.stock case final value?) 'stock': value, + 'base_uom': instance.baseUom.toJson(), + 'allow_generic': instance.allowGeneric, + 'variants': instance.variants.map((e) => e.toJson()).toList(), + 'presentations': instance.presentations.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_dto_paged_result.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto_paged_result.dart new file mode 100644 index 00000000..3f8521ab --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto_paged_result.dart @@ -0,0 +1,48 @@ +/// ProductDtoPagedResult +/// { +/// "properties": { +/// "items": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/ProductDto" +/// } +/// }, +/// "next_page_token": { +/// "type": "string", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "items" +/// ], +/// "additionalProperties": false +/// } +library product_dto_paged_result; + +import 'exports.dart'; +part 'product_dto_paged_result.freezed.dart'; +part 'product_dto_paged_result.g.dart'; // ProductDtoPagedResult + +@freezed +abstract class ProductDtoPagedResult with _$ProductDtoPagedResult { + const ProductDtoPagedResult._(); + + @jsonSerializable + const factory ProductDtoPagedResult({ + /// items + @JsonKey(name: ProductDtoPagedResult.itemsKey_) + required List items, + + /// nextPageToken + @JsonKey(name: ProductDtoPagedResult.nextPageTokenKey_) + String? nextPageToken, + }) = _ProductDtoPagedResult; + + factory ProductDtoPagedResult.fromJson(Map json) => + _$ProductDtoPagedResultFromJson(json); + + static const String itemsKey_ = r'items'; + + static const String nextPageTokenKey_ = r'next_page_token'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_dto_paged_result.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto_paged_result.freezed.dart new file mode 100644 index 00000000..07cf1027 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto_paged_result.freezed.dart @@ -0,0 +1,378 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'product_dto_paged_result.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ProductDtoPagedResult { + /// items + @JsonKey(name: ProductDtoPagedResult.itemsKey_) + List get items; + + /// nextPageToken + @JsonKey(name: ProductDtoPagedResult.nextPageTokenKey_) + String? get nextPageToken; + + /// Create a copy of ProductDtoPagedResult + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ProductDtoPagedResultCopyWith get copyWith => + _$ProductDtoPagedResultCopyWithImpl( + this as ProductDtoPagedResult, _$identity); + + /// Serializes this ProductDtoPagedResult to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ProductDtoPagedResult && + const DeepCollectionEquality().equals(other.items, items) && + (identical(other.nextPageToken, nextPageToken) || + other.nextPageToken == nextPageToken)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(items), nextPageToken); + + @override + String toString() { + return 'ProductDtoPagedResult(items: $items, nextPageToken: $nextPageToken)'; + } +} + +/// @nodoc +abstract mixin class $ProductDtoPagedResultCopyWith<$Res> { + factory $ProductDtoPagedResultCopyWith(ProductDtoPagedResult value, + $Res Function(ProductDtoPagedResult) _then) = + _$ProductDtoPagedResultCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: ProductDtoPagedResult.itemsKey_) List items, + @JsonKey(name: ProductDtoPagedResult.nextPageTokenKey_) + String? nextPageToken}); +} + +/// @nodoc +class _$ProductDtoPagedResultCopyWithImpl<$Res> + implements $ProductDtoPagedResultCopyWith<$Res> { + _$ProductDtoPagedResultCopyWithImpl(this._self, this._then); + + final ProductDtoPagedResult _self; + final $Res Function(ProductDtoPagedResult) _then; + + /// Create a copy of ProductDtoPagedResult + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? items = null, + Object? nextPageToken = freezed, + }) { + return _then(_self.copyWith( + items: null == items + ? _self.items + : items // ignore: cast_nullable_to_non_nullable + as List, + nextPageToken: freezed == nextPageToken + ? _self.nextPageToken + : nextPageToken // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// Adds pattern-matching-related methods to [ProductDtoPagedResult]. +extension ProductDtoPagedResultPatterns on ProductDtoPagedResult { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_ProductDtoPagedResult value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductDtoPagedResult() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_ProductDtoPagedResult value) $default, + ) { + final _that = this; + switch (_that) { + case _ProductDtoPagedResult(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_ProductDtoPagedResult value)? $default, + ) { + final _that = this; + switch (_that) { + case _ProductDtoPagedResult() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: ProductDtoPagedResult.itemsKey_) + List items, + @JsonKey(name: ProductDtoPagedResult.nextPageTokenKey_) + String? nextPageToken)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductDtoPagedResult() when $default != null: + return $default(_that.items, _that.nextPageToken); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: ProductDtoPagedResult.itemsKey_) + List items, + @JsonKey(name: ProductDtoPagedResult.nextPageTokenKey_) + String? nextPageToken) + $default, + ) { + final _that = this; + switch (_that) { + case _ProductDtoPagedResult(): + return $default(_that.items, _that.nextPageToken); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: ProductDtoPagedResult.itemsKey_) + List items, + @JsonKey(name: ProductDtoPagedResult.nextPageTokenKey_) + String? nextPageToken)? + $default, + ) { + final _that = this; + switch (_that) { + case _ProductDtoPagedResult() when $default != null: + return $default(_that.items, _that.nextPageToken); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _ProductDtoPagedResult extends ProductDtoPagedResult { + const _ProductDtoPagedResult( + {@JsonKey(name: ProductDtoPagedResult.itemsKey_) + required final List items, + @JsonKey(name: ProductDtoPagedResult.nextPageTokenKey_) + this.nextPageToken}) + : _items = items, + super._(); + factory _ProductDtoPagedResult.fromJson(Map json) => + _$ProductDtoPagedResultFromJson(json); + + /// items + final List _items; + + /// items + @override + @JsonKey(name: ProductDtoPagedResult.itemsKey_) + List get items { + if (_items is EqualUnmodifiableListView) return _items; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_items); + } + + /// nextPageToken + @override + @JsonKey(name: ProductDtoPagedResult.nextPageTokenKey_) + final String? nextPageToken; + + /// Create a copy of ProductDtoPagedResult + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ProductDtoPagedResultCopyWith<_ProductDtoPagedResult> get copyWith => + __$ProductDtoPagedResultCopyWithImpl<_ProductDtoPagedResult>( + this, _$identity); + + @override + Map toJson() { + return _$ProductDtoPagedResultToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _ProductDtoPagedResult && + const DeepCollectionEquality().equals(other._items, _items) && + (identical(other.nextPageToken, nextPageToken) || + other.nextPageToken == nextPageToken)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_items), nextPageToken); + + @override + String toString() { + return 'ProductDtoPagedResult(items: $items, nextPageToken: $nextPageToken)'; + } +} + +/// @nodoc +abstract mixin class _$ProductDtoPagedResultCopyWith<$Res> + implements $ProductDtoPagedResultCopyWith<$Res> { + factory _$ProductDtoPagedResultCopyWith(_ProductDtoPagedResult value, + $Res Function(_ProductDtoPagedResult) _then) = + __$ProductDtoPagedResultCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: ProductDtoPagedResult.itemsKey_) List items, + @JsonKey(name: ProductDtoPagedResult.nextPageTokenKey_) + String? nextPageToken}); +} + +/// @nodoc +class __$ProductDtoPagedResultCopyWithImpl<$Res> + implements _$ProductDtoPagedResultCopyWith<$Res> { + __$ProductDtoPagedResultCopyWithImpl(this._self, this._then); + + final _ProductDtoPagedResult _self; + final $Res Function(_ProductDtoPagedResult) _then; + + /// Create a copy of ProductDtoPagedResult + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? items = null, + Object? nextPageToken = freezed, + }) { + return _then(_ProductDtoPagedResult( + items: null == items + ? _self._items + : items // ignore: cast_nullable_to_non_nullable + as List, + nextPageToken: freezed == nextPageToken + ? _self.nextPageToken + : nextPageToken // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_dto_paged_result.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto_paged_result.g.dart new file mode 100644 index 00000000..ee3033fd --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_dto_paged_result.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'product_dto_paged_result.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_ProductDtoPagedResult _$ProductDtoPagedResultFromJson( + Map json) => + _ProductDtoPagedResult( + items: (json['items'] as List) + .map((e) => ProductDto.fromJson(e as Map)) + .toList(), + nextPageToken: json['next_page_token'] as String?, + ); + +Map _$ProductDtoPagedResultToJson( + _ProductDtoPagedResult instance) => + { + 'items': instance.items.map((e) => e.toJson()).toList(), + if (instance.nextPageToken case final value?) 'next_page_token': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_presentation_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_presentation_dto.dart new file mode 100644 index 00000000..abc8907b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_presentation_dto.dart @@ -0,0 +1,75 @@ +/// ProductPresentationDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "name": { +/// "type": "string" +/// }, +/// "quantity_multiplier": { +/// "type": "integer", +/// "format": "int32" +/// }, +/// "is_default": { +/// "type": "boolean" +/// }, +/// "sale_price": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "id", +/// "is_default", +/// "name", +/// "quantity_multiplier" +/// ], +/// "additionalProperties": false +/// } +library product_presentation_dto; + +import 'exports.dart'; +part 'product_presentation_dto.freezed.dart'; +part 'product_presentation_dto.g.dart'; // ProductPresentationDto + +@freezed +abstract class ProductPresentationDto with _$ProductPresentationDto { + const ProductPresentationDto._(); + + @jsonSerializable + const factory ProductPresentationDto({ + /// id + @JsonKey(name: ProductPresentationDto.idKey_) required String id, + + /// name + @JsonKey(name: ProductPresentationDto.nameKey_) required String name, + + /// quantityMultiplier + @JsonKey(name: ProductPresentationDto.quantityMultiplierKey_) + required int quantityMultiplier, + + /// isDefault + @JsonKey(name: ProductPresentationDto.isDefaultKey_) + required bool isDefault, + + /// salePrice + @JsonKey(name: ProductPresentationDto.salePriceKey_) double? salePrice, + }) = _ProductPresentationDto; + + factory ProductPresentationDto.fromJson(Map json) => + _$ProductPresentationDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; + + static const String quantityMultiplierKey_ = r'quantity_multiplier'; + + static const String isDefaultKey_ = r'is_default'; + + static const String salePriceKey_ = r'sale_price'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_presentation_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_presentation_dto.freezed.dart new file mode 100644 index 00000000..b6a91bb0 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_presentation_dto.freezed.dart @@ -0,0 +1,458 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'product_presentation_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ProductPresentationDto { + /// id + @JsonKey(name: ProductPresentationDto.idKey_) + String get id; + + /// name + @JsonKey(name: ProductPresentationDto.nameKey_) + String get name; + + /// quantityMultiplier + @JsonKey(name: ProductPresentationDto.quantityMultiplierKey_) + int get quantityMultiplier; + + /// isDefault + @JsonKey(name: ProductPresentationDto.isDefaultKey_) + bool get isDefault; + + /// salePrice + @JsonKey(name: ProductPresentationDto.salePriceKey_) + double? get salePrice; + + /// Create a copy of ProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ProductPresentationDtoCopyWith get copyWith => + _$ProductPresentationDtoCopyWithImpl( + this as ProductPresentationDto, _$identity); + + /// Serializes this ProductPresentationDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ProductPresentationDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.quantityMultiplier, quantityMultiplier) || + other.quantityMultiplier == quantityMultiplier) && + (identical(other.isDefault, isDefault) || + other.isDefault == isDefault) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, id, name, quantityMultiplier, isDefault, salePrice); + + @override + String toString() { + return 'ProductPresentationDto(id: $id, name: $name, quantityMultiplier: $quantityMultiplier, isDefault: $isDefault, salePrice: $salePrice)'; + } +} + +/// @nodoc +abstract mixin class $ProductPresentationDtoCopyWith<$Res> { + factory $ProductPresentationDtoCopyWith(ProductPresentationDto value, + $Res Function(ProductPresentationDto) _then) = + _$ProductPresentationDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: ProductPresentationDto.idKey_) String id, + @JsonKey(name: ProductPresentationDto.nameKey_) String name, + @JsonKey(name: ProductPresentationDto.quantityMultiplierKey_) + int quantityMultiplier, + @JsonKey(name: ProductPresentationDto.isDefaultKey_) bool isDefault, + @JsonKey(name: ProductPresentationDto.salePriceKey_) double? salePrice}); +} + +/// @nodoc +class _$ProductPresentationDtoCopyWithImpl<$Res> + implements $ProductPresentationDtoCopyWith<$Res> { + _$ProductPresentationDtoCopyWithImpl(this._self, this._then); + + final ProductPresentationDto _self; + final $Res Function(ProductPresentationDto) _then; + + /// Create a copy of ProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + Object? quantityMultiplier = null, + Object? isDefault = null, + Object? salePrice = freezed, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + quantityMultiplier: null == quantityMultiplier + ? _self.quantityMultiplier + : quantityMultiplier // ignore: cast_nullable_to_non_nullable + as int, + isDefault: null == isDefault + ? _self.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + )); + } +} + +/// Adds pattern-matching-related methods to [ProductPresentationDto]. +extension ProductPresentationDtoPatterns on ProductPresentationDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_ProductPresentationDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductPresentationDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_ProductPresentationDto value) $default, + ) { + final _that = this; + switch (_that) { + case _ProductPresentationDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_ProductPresentationDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _ProductPresentationDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: ProductPresentationDto.idKey_) String id, + @JsonKey(name: ProductPresentationDto.nameKey_) String name, + @JsonKey(name: ProductPresentationDto.quantityMultiplierKey_) + int quantityMultiplier, + @JsonKey(name: ProductPresentationDto.isDefaultKey_) bool isDefault, + @JsonKey(name: ProductPresentationDto.salePriceKey_) + double? salePrice)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductPresentationDto() when $default != null: + return $default(_that.id, _that.name, _that.quantityMultiplier, + _that.isDefault, _that.salePrice); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: ProductPresentationDto.idKey_) String id, + @JsonKey(name: ProductPresentationDto.nameKey_) String name, + @JsonKey(name: ProductPresentationDto.quantityMultiplierKey_) + int quantityMultiplier, + @JsonKey(name: ProductPresentationDto.isDefaultKey_) bool isDefault, + @JsonKey(name: ProductPresentationDto.salePriceKey_) + double? salePrice) + $default, + ) { + final _that = this; + switch (_that) { + case _ProductPresentationDto(): + return $default(_that.id, _that.name, _that.quantityMultiplier, + _that.isDefault, _that.salePrice); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: ProductPresentationDto.idKey_) String id, + @JsonKey(name: ProductPresentationDto.nameKey_) String name, + @JsonKey(name: ProductPresentationDto.quantityMultiplierKey_) + int quantityMultiplier, + @JsonKey(name: ProductPresentationDto.isDefaultKey_) bool isDefault, + @JsonKey(name: ProductPresentationDto.salePriceKey_) + double? salePrice)? + $default, + ) { + final _that = this; + switch (_that) { + case _ProductPresentationDto() when $default != null: + return $default(_that.id, _that.name, _that.quantityMultiplier, + _that.isDefault, _that.salePrice); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _ProductPresentationDto extends ProductPresentationDto { + const _ProductPresentationDto( + {@JsonKey(name: ProductPresentationDto.idKey_) required this.id, + @JsonKey(name: ProductPresentationDto.nameKey_) required this.name, + @JsonKey(name: ProductPresentationDto.quantityMultiplierKey_) + required this.quantityMultiplier, + @JsonKey(name: ProductPresentationDto.isDefaultKey_) + required this.isDefault, + @JsonKey(name: ProductPresentationDto.salePriceKey_) this.salePrice}) + : super._(); + factory _ProductPresentationDto.fromJson(Map json) => + _$ProductPresentationDtoFromJson(json); + + /// id + @override + @JsonKey(name: ProductPresentationDto.idKey_) + final String id; + + /// name + @override + @JsonKey(name: ProductPresentationDto.nameKey_) + final String name; + + /// quantityMultiplier + @override + @JsonKey(name: ProductPresentationDto.quantityMultiplierKey_) + final int quantityMultiplier; + + /// isDefault + @override + @JsonKey(name: ProductPresentationDto.isDefaultKey_) + final bool isDefault; + + /// salePrice + @override + @JsonKey(name: ProductPresentationDto.salePriceKey_) + final double? salePrice; + + /// Create a copy of ProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ProductPresentationDtoCopyWith<_ProductPresentationDto> get copyWith => + __$ProductPresentationDtoCopyWithImpl<_ProductPresentationDto>( + this, _$identity); + + @override + Map toJson() { + return _$ProductPresentationDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _ProductPresentationDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.quantityMultiplier, quantityMultiplier) || + other.quantityMultiplier == quantityMultiplier) && + (identical(other.isDefault, isDefault) || + other.isDefault == isDefault) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, id, name, quantityMultiplier, isDefault, salePrice); + + @override + String toString() { + return 'ProductPresentationDto(id: $id, name: $name, quantityMultiplier: $quantityMultiplier, isDefault: $isDefault, salePrice: $salePrice)'; + } +} + +/// @nodoc +abstract mixin class _$ProductPresentationDtoCopyWith<$Res> + implements $ProductPresentationDtoCopyWith<$Res> { + factory _$ProductPresentationDtoCopyWith(_ProductPresentationDto value, + $Res Function(_ProductPresentationDto) _then) = + __$ProductPresentationDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: ProductPresentationDto.idKey_) String id, + @JsonKey(name: ProductPresentationDto.nameKey_) String name, + @JsonKey(name: ProductPresentationDto.quantityMultiplierKey_) + int quantityMultiplier, + @JsonKey(name: ProductPresentationDto.isDefaultKey_) bool isDefault, + @JsonKey(name: ProductPresentationDto.salePriceKey_) double? salePrice}); +} + +/// @nodoc +class __$ProductPresentationDtoCopyWithImpl<$Res> + implements _$ProductPresentationDtoCopyWith<$Res> { + __$ProductPresentationDtoCopyWithImpl(this._self, this._then); + + final _ProductPresentationDto _self; + final $Res Function(_ProductPresentationDto) _then; + + /// Create a copy of ProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? name = null, + Object? quantityMultiplier = null, + Object? isDefault = null, + Object? salePrice = freezed, + }) { + return _then(_ProductPresentationDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + quantityMultiplier: null == quantityMultiplier + ? _self.quantityMultiplier + : quantityMultiplier // ignore: cast_nullable_to_non_nullable + as int, + isDefault: null == isDefault + ? _self.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_presentation_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_presentation_dto.g.dart new file mode 100644 index 00000000..b08e7bb7 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_presentation_dto.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'product_presentation_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_ProductPresentationDto _$ProductPresentationDtoFromJson( + Map json) => + _ProductPresentationDto( + id: json['id'] as String, + name: json['name'] as String, + quantityMultiplier: (json['quantity_multiplier'] as num).toInt(), + isDefault: json['is_default'] as bool, + salePrice: (json['sale_price'] as num?)?.toDouble(), + ); + +Map _$ProductPresentationDtoToJson( + _ProductPresentationDto instance) => + { + 'id': instance.id, + 'name': instance.name, + 'quantity_multiplier': instance.quantityMultiplier, + 'is_default': instance.isDefault, + if (instance.salePrice case final value?) 'sale_price': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_variant_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_variant_dto.dart new file mode 100644 index 00000000..d3ef5f95 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_variant_dto.dart @@ -0,0 +1,44 @@ +/// ProductVariantDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "name": { +/// "type": "string" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "id", +/// "name" +/// ], +/// "additionalProperties": false +/// } +library product_variant_dto; + +import 'exports.dart'; +part 'product_variant_dto.freezed.dart'; +part 'product_variant_dto.g.dart'; // ProductVariantDto + +@freezed +abstract class ProductVariantDto with _$ProductVariantDto { + const ProductVariantDto._(); + + @jsonSerializable + const factory ProductVariantDto({ + /// id + @JsonKey(name: ProductVariantDto.idKey_) required String id, + + /// name + @JsonKey(name: ProductVariantDto.nameKey_) required String name, + }) = _ProductVariantDto; + + factory ProductVariantDto.fromJson(Map json) => + _$ProductVariantDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_variant_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_variant_dto.freezed.dart new file mode 100644 index 00000000..4c1d4077 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_variant_dto.freezed.dart @@ -0,0 +1,352 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'product_variant_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ProductVariantDto { + /// id + @JsonKey(name: ProductVariantDto.idKey_) + String get id; + + /// name + @JsonKey(name: ProductVariantDto.nameKey_) + String get name; + + /// Create a copy of ProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ProductVariantDtoCopyWith get copyWith => + _$ProductVariantDtoCopyWithImpl( + this as ProductVariantDto, _$identity); + + /// Serializes this ProductVariantDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ProductVariantDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name); + + @override + String toString() { + return 'ProductVariantDto(id: $id, name: $name)'; + } +} + +/// @nodoc +abstract mixin class $ProductVariantDtoCopyWith<$Res> { + factory $ProductVariantDtoCopyWith( + ProductVariantDto value, $Res Function(ProductVariantDto) _then) = + _$ProductVariantDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: ProductVariantDto.idKey_) String id, + @JsonKey(name: ProductVariantDto.nameKey_) String name}); +} + +/// @nodoc +class _$ProductVariantDtoCopyWithImpl<$Res> + implements $ProductVariantDtoCopyWith<$Res> { + _$ProductVariantDtoCopyWithImpl(this._self, this._then); + + final ProductVariantDto _self; + final $Res Function(ProductVariantDto) _then; + + /// Create a copy of ProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [ProductVariantDto]. +extension ProductVariantDtoPatterns on ProductVariantDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_ProductVariantDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductVariantDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_ProductVariantDto value) $default, + ) { + final _that = this; + switch (_that) { + case _ProductVariantDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_ProductVariantDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _ProductVariantDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(@JsonKey(name: ProductVariantDto.idKey_) String id, + @JsonKey(name: ProductVariantDto.nameKey_) String name)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductVariantDto() when $default != null: + return $default(_that.id, _that.name); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(@JsonKey(name: ProductVariantDto.idKey_) String id, + @JsonKey(name: ProductVariantDto.nameKey_) String name) + $default, + ) { + final _that = this; + switch (_that) { + case _ProductVariantDto(): + return $default(_that.id, _that.name); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(@JsonKey(name: ProductVariantDto.idKey_) String id, + @JsonKey(name: ProductVariantDto.nameKey_) String name)? + $default, + ) { + final _that = this; + switch (_that) { + case _ProductVariantDto() when $default != null: + return $default(_that.id, _that.name); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _ProductVariantDto extends ProductVariantDto { + const _ProductVariantDto( + {@JsonKey(name: ProductVariantDto.idKey_) required this.id, + @JsonKey(name: ProductVariantDto.nameKey_) required this.name}) + : super._(); + factory _ProductVariantDto.fromJson(Map json) => + _$ProductVariantDtoFromJson(json); + + /// id + @override + @JsonKey(name: ProductVariantDto.idKey_) + final String id; + + /// name + @override + @JsonKey(name: ProductVariantDto.nameKey_) + final String name; + + /// Create a copy of ProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ProductVariantDtoCopyWith<_ProductVariantDto> get copyWith => + __$ProductVariantDtoCopyWithImpl<_ProductVariantDto>(this, _$identity); + + @override + Map toJson() { + return _$ProductVariantDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _ProductVariantDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name); + + @override + String toString() { + return 'ProductVariantDto(id: $id, name: $name)'; + } +} + +/// @nodoc +abstract mixin class _$ProductVariantDtoCopyWith<$Res> + implements $ProductVariantDtoCopyWith<$Res> { + factory _$ProductVariantDtoCopyWith( + _ProductVariantDto value, $Res Function(_ProductVariantDto) _then) = + __$ProductVariantDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: ProductVariantDto.idKey_) String id, + @JsonKey(name: ProductVariantDto.nameKey_) String name}); +} + +/// @nodoc +class __$ProductVariantDtoCopyWithImpl<$Res> + implements _$ProductVariantDtoCopyWith<$Res> { + __$ProductVariantDtoCopyWithImpl(this._self, this._then); + + final _ProductVariantDto _self; + final $Res Function(_ProductVariantDto) _then; + + /// Create a copy of ProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? name = null, + }) { + return _then(_ProductVariantDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/product_variant_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/product_variant_dto.g.dart new file mode 100644 index 00000000..f5996949 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/product_variant_dto.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'product_variant_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_ProductVariantDto _$ProductVariantDtoFromJson(Map json) => + _ProductVariantDto( + id: json['id'] as String, + name: json['name'] as String, + ); + +Map _$ProductVariantDtoToJson(_ProductVariantDto instance) => + { + 'id': instance.id, + 'name': instance.name, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/products_api_products_get_query_parameters.dart b/packages/swagger_to_dart/example/lib/src/gen/models/products_api_products_get_query_parameters.dart new file mode 100644 index 00000000..30b3c6df --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/products_api_products_get_query_parameters.dart @@ -0,0 +1,90 @@ +/// ProductsApiProductsGetQueryParameters +/// { +/// "properties": { +/// "pageToken": { +/// "type": "string", +/// "nullable": true +/// }, +/// "pageSize": { +/// "type": "integer", +/// "format": "int32", +/// "default": 100 +/// }, +/// "categoryId": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "search": { +/// "type": "string", +/// "nullable": true +/// }, +/// "priceListId": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "replacePrices": { +/// "type": "boolean", +/// "default": false +/// } +/// }, +/// "type": "object", +/// "required": [] +/// } +library products_api_products_get_query_parameters; + +import 'exports.dart'; +part 'products_api_products_get_query_parameters.freezed.dart'; +part 'products_api_products_get_query_parameters.g.dart'; // ProductsApiProductsGetQueryParameters + +@freezed +abstract class ProductsApiProductsGetQueryParameters + with _$ProductsApiProductsGetQueryParameters { + const ProductsApiProductsGetQueryParameters._(); + + @jsonSerializable + const factory ProductsApiProductsGetQueryParameters({ + /// pageToken + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageTokenKey_) + String? pageToken, + + /// pageSize + @Default(100) + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageSizeKey_) + int pageSize, + + /// categoryId + @JsonKey(name: ProductsApiProductsGetQueryParameters.categoryIdKey_) + String? categoryId, + + /// search + @JsonKey(name: ProductsApiProductsGetQueryParameters.searchKey_) + String? search, + + /// priceListId + @JsonKey(name: ProductsApiProductsGetQueryParameters.priceListIdKey_) + String? priceListId, + + /// replacePrices + @Default(false) + @JsonKey(name: ProductsApiProductsGetQueryParameters.replacePricesKey_) + bool replacePrices, + }) = _ProductsApiProductsGetQueryParameters; + + factory ProductsApiProductsGetQueryParameters.fromJson( + Map json, + ) => _$ProductsApiProductsGetQueryParametersFromJson(json); + + static const String pageTokenKey_ = r'pageToken'; + + static const String pageSizeKey_ = r'pageSize'; + + static const String categoryIdKey_ = r'categoryId'; + + static const String searchKey_ = r'search'; + + static const String priceListIdKey_ = r'priceListId'; + + static const String replacePricesKey_ = r'replacePrices'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/products_api_products_get_query_parameters.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/products_api_products_get_query_parameters.freezed.dart new file mode 100644 index 00000000..42f3b128 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/products_api_products_get_query_parameters.freezed.dart @@ -0,0 +1,529 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'products_api_products_get_query_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$ProductsApiProductsGetQueryParameters { + /// pageToken + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageTokenKey_) + String? get pageToken; + + /// pageSize + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageSizeKey_) + int get pageSize; + + /// categoryId + @JsonKey(name: ProductsApiProductsGetQueryParameters.categoryIdKey_) + String? get categoryId; + + /// search + @JsonKey(name: ProductsApiProductsGetQueryParameters.searchKey_) + String? get search; + + /// priceListId + @JsonKey(name: ProductsApiProductsGetQueryParameters.priceListIdKey_) + String? get priceListId; + + /// replacePrices + @JsonKey(name: ProductsApiProductsGetQueryParameters.replacePricesKey_) + bool get replacePrices; + + /// Create a copy of ProductsApiProductsGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ProductsApiProductsGetQueryParametersCopyWith< + ProductsApiProductsGetQueryParameters> + get copyWith => _$ProductsApiProductsGetQueryParametersCopyWithImpl< + ProductsApiProductsGetQueryParameters>( + this as ProductsApiProductsGetQueryParameters, _$identity); + + /// Serializes this ProductsApiProductsGetQueryParameters to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is ProductsApiProductsGetQueryParameters && + (identical(other.pageToken, pageToken) || + other.pageToken == pageToken) && + (identical(other.pageSize, pageSize) || + other.pageSize == pageSize) && + (identical(other.categoryId, categoryId) || + other.categoryId == categoryId) && + (identical(other.search, search) || other.search == search) && + (identical(other.priceListId, priceListId) || + other.priceListId == priceListId) && + (identical(other.replacePrices, replacePrices) || + other.replacePrices == replacePrices)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, pageToken, pageSize, categoryId, + search, priceListId, replacePrices); + + @override + String toString() { + return 'ProductsApiProductsGetQueryParameters(pageToken: $pageToken, pageSize: $pageSize, categoryId: $categoryId, search: $search, priceListId: $priceListId, replacePrices: $replacePrices)'; + } +} + +/// @nodoc +abstract mixin class $ProductsApiProductsGetQueryParametersCopyWith<$Res> { + factory $ProductsApiProductsGetQueryParametersCopyWith( + ProductsApiProductsGetQueryParameters value, + $Res Function(ProductsApiProductsGetQueryParameters) _then) = + _$ProductsApiProductsGetQueryParametersCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: ProductsApiProductsGetQueryParameters.pageTokenKey_) + String? pageToken, + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageSizeKey_) + int pageSize, + @JsonKey(name: ProductsApiProductsGetQueryParameters.categoryIdKey_) + String? categoryId, + @JsonKey(name: ProductsApiProductsGetQueryParameters.searchKey_) + String? search, + @JsonKey(name: ProductsApiProductsGetQueryParameters.priceListIdKey_) + String? priceListId, + @JsonKey(name: ProductsApiProductsGetQueryParameters.replacePricesKey_) + bool replacePrices}); +} + +/// @nodoc +class _$ProductsApiProductsGetQueryParametersCopyWithImpl<$Res> + implements $ProductsApiProductsGetQueryParametersCopyWith<$Res> { + _$ProductsApiProductsGetQueryParametersCopyWithImpl(this._self, this._then); + + final ProductsApiProductsGetQueryParameters _self; + final $Res Function(ProductsApiProductsGetQueryParameters) _then; + + /// Create a copy of ProductsApiProductsGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? pageToken = freezed, + Object? pageSize = null, + Object? categoryId = freezed, + Object? search = freezed, + Object? priceListId = freezed, + Object? replacePrices = null, + }) { + return _then(_self.copyWith( + pageToken: freezed == pageToken + ? _self.pageToken + : pageToken // ignore: cast_nullable_to_non_nullable + as String?, + pageSize: null == pageSize + ? _self.pageSize + : pageSize // ignore: cast_nullable_to_non_nullable + as int, + categoryId: freezed == categoryId + ? _self.categoryId + : categoryId // ignore: cast_nullable_to_non_nullable + as String?, + search: freezed == search + ? _self.search + : search // ignore: cast_nullable_to_non_nullable + as String?, + priceListId: freezed == priceListId + ? _self.priceListId + : priceListId // ignore: cast_nullable_to_non_nullable + as String?, + replacePrices: null == replacePrices + ? _self.replacePrices + : replacePrices // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// Adds pattern-matching-related methods to [ProductsApiProductsGetQueryParameters]. +extension ProductsApiProductsGetQueryParametersPatterns + on ProductsApiProductsGetQueryParameters { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_ProductsApiProductsGetQueryParameters value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductsApiProductsGetQueryParameters() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_ProductsApiProductsGetQueryParameters value) $default, + ) { + final _that = this; + switch (_that) { + case _ProductsApiProductsGetQueryParameters(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_ProductsApiProductsGetQueryParameters value)? $default, + ) { + final _that = this; + switch (_that) { + case _ProductsApiProductsGetQueryParameters() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageTokenKey_) + String? pageToken, + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageSizeKey_) + int pageSize, + @JsonKey(name: ProductsApiProductsGetQueryParameters.categoryIdKey_) + String? categoryId, + @JsonKey(name: ProductsApiProductsGetQueryParameters.searchKey_) + String? search, + @JsonKey( + name: ProductsApiProductsGetQueryParameters.priceListIdKey_) + String? priceListId, + @JsonKey( + name: ProductsApiProductsGetQueryParameters.replacePricesKey_) + bool replacePrices)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ProductsApiProductsGetQueryParameters() when $default != null: + return $default(_that.pageToken, _that.pageSize, _that.categoryId, + _that.search, _that.priceListId, _that.replacePrices); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageTokenKey_) + String? pageToken, + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageSizeKey_) + int pageSize, + @JsonKey(name: ProductsApiProductsGetQueryParameters.categoryIdKey_) + String? categoryId, + @JsonKey(name: ProductsApiProductsGetQueryParameters.searchKey_) + String? search, + @JsonKey( + name: ProductsApiProductsGetQueryParameters.priceListIdKey_) + String? priceListId, + @JsonKey( + name: ProductsApiProductsGetQueryParameters.replacePricesKey_) + bool replacePrices) + $default, + ) { + final _that = this; + switch (_that) { + case _ProductsApiProductsGetQueryParameters(): + return $default(_that.pageToken, _that.pageSize, _that.categoryId, + _that.search, _that.priceListId, _that.replacePrices); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageTokenKey_) + String? pageToken, + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageSizeKey_) + int pageSize, + @JsonKey(name: ProductsApiProductsGetQueryParameters.categoryIdKey_) + String? categoryId, + @JsonKey(name: ProductsApiProductsGetQueryParameters.searchKey_) + String? search, + @JsonKey( + name: ProductsApiProductsGetQueryParameters.priceListIdKey_) + String? priceListId, + @JsonKey( + name: ProductsApiProductsGetQueryParameters.replacePricesKey_) + bool replacePrices)? + $default, + ) { + final _that = this; + switch (_that) { + case _ProductsApiProductsGetQueryParameters() when $default != null: + return $default(_that.pageToken, _that.pageSize, _that.categoryId, + _that.search, _that.priceListId, _that.replacePrices); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _ProductsApiProductsGetQueryParameters + extends ProductsApiProductsGetQueryParameters { + const _ProductsApiProductsGetQueryParameters( + {@JsonKey(name: ProductsApiProductsGetQueryParameters.pageTokenKey_) + this.pageToken, + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageSizeKey_) + this.pageSize = 100, + @JsonKey(name: ProductsApiProductsGetQueryParameters.categoryIdKey_) + this.categoryId, + @JsonKey(name: ProductsApiProductsGetQueryParameters.searchKey_) + this.search, + @JsonKey(name: ProductsApiProductsGetQueryParameters.priceListIdKey_) + this.priceListId, + @JsonKey(name: ProductsApiProductsGetQueryParameters.replacePricesKey_) + this.replacePrices = false}) + : super._(); + factory _ProductsApiProductsGetQueryParameters.fromJson( + Map json) => + _$ProductsApiProductsGetQueryParametersFromJson(json); + + /// pageToken + @override + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageTokenKey_) + final String? pageToken; + + /// pageSize + @override + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageSizeKey_) + final int pageSize; + + /// categoryId + @override + @JsonKey(name: ProductsApiProductsGetQueryParameters.categoryIdKey_) + final String? categoryId; + + /// search + @override + @JsonKey(name: ProductsApiProductsGetQueryParameters.searchKey_) + final String? search; + + /// priceListId + @override + @JsonKey(name: ProductsApiProductsGetQueryParameters.priceListIdKey_) + final String? priceListId; + + /// replacePrices + @override + @JsonKey(name: ProductsApiProductsGetQueryParameters.replacePricesKey_) + final bool replacePrices; + + /// Create a copy of ProductsApiProductsGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ProductsApiProductsGetQueryParametersCopyWith< + _ProductsApiProductsGetQueryParameters> + get copyWith => __$ProductsApiProductsGetQueryParametersCopyWithImpl< + _ProductsApiProductsGetQueryParameters>(this, _$identity); + + @override + Map toJson() { + return _$ProductsApiProductsGetQueryParametersToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _ProductsApiProductsGetQueryParameters && + (identical(other.pageToken, pageToken) || + other.pageToken == pageToken) && + (identical(other.pageSize, pageSize) || + other.pageSize == pageSize) && + (identical(other.categoryId, categoryId) || + other.categoryId == categoryId) && + (identical(other.search, search) || other.search == search) && + (identical(other.priceListId, priceListId) || + other.priceListId == priceListId) && + (identical(other.replacePrices, replacePrices) || + other.replacePrices == replacePrices)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, pageToken, pageSize, categoryId, + search, priceListId, replacePrices); + + @override + String toString() { + return 'ProductsApiProductsGetQueryParameters(pageToken: $pageToken, pageSize: $pageSize, categoryId: $categoryId, search: $search, priceListId: $priceListId, replacePrices: $replacePrices)'; + } +} + +/// @nodoc +abstract mixin class _$ProductsApiProductsGetQueryParametersCopyWith<$Res> + implements $ProductsApiProductsGetQueryParametersCopyWith<$Res> { + factory _$ProductsApiProductsGetQueryParametersCopyWith( + _ProductsApiProductsGetQueryParameters value, + $Res Function(_ProductsApiProductsGetQueryParameters) _then) = + __$ProductsApiProductsGetQueryParametersCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: ProductsApiProductsGetQueryParameters.pageTokenKey_) + String? pageToken, + @JsonKey(name: ProductsApiProductsGetQueryParameters.pageSizeKey_) + int pageSize, + @JsonKey(name: ProductsApiProductsGetQueryParameters.categoryIdKey_) + String? categoryId, + @JsonKey(name: ProductsApiProductsGetQueryParameters.searchKey_) + String? search, + @JsonKey(name: ProductsApiProductsGetQueryParameters.priceListIdKey_) + String? priceListId, + @JsonKey(name: ProductsApiProductsGetQueryParameters.replacePricesKey_) + bool replacePrices}); +} + +/// @nodoc +class __$ProductsApiProductsGetQueryParametersCopyWithImpl<$Res> + implements _$ProductsApiProductsGetQueryParametersCopyWith<$Res> { + __$ProductsApiProductsGetQueryParametersCopyWithImpl(this._self, this._then); + + final _ProductsApiProductsGetQueryParameters _self; + final $Res Function(_ProductsApiProductsGetQueryParameters) _then; + + /// Create a copy of ProductsApiProductsGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? pageToken = freezed, + Object? pageSize = null, + Object? categoryId = freezed, + Object? search = freezed, + Object? priceListId = freezed, + Object? replacePrices = null, + }) { + return _then(_ProductsApiProductsGetQueryParameters( + pageToken: freezed == pageToken + ? _self.pageToken + : pageToken // ignore: cast_nullable_to_non_nullable + as String?, + pageSize: null == pageSize + ? _self.pageSize + : pageSize // ignore: cast_nullable_to_non_nullable + as int, + categoryId: freezed == categoryId + ? _self.categoryId + : categoryId // ignore: cast_nullable_to_non_nullable + as String?, + search: freezed == search + ? _self.search + : search // ignore: cast_nullable_to_non_nullable + as String?, + priceListId: freezed == priceListId + ? _self.priceListId + : priceListId // ignore: cast_nullable_to_non_nullable + as String?, + replacePrices: null == replacePrices + ? _self.replacePrices + : replacePrices // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/products_api_products_get_query_parameters.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/products_api_products_get_query_parameters.g.dart new file mode 100644 index 00000000..4d94a280 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/products_api_products_get_query_parameters.g.dart @@ -0,0 +1,30 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'products_api_products_get_query_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_ProductsApiProductsGetQueryParameters + _$ProductsApiProductsGetQueryParametersFromJson( + Map json) => + _ProductsApiProductsGetQueryParameters( + pageToken: json['pageToken'] as String?, + pageSize: (json['pageSize'] as num?)?.toInt() ?? 100, + categoryId: json['categoryId'] as String?, + search: json['search'] as String?, + priceListId: json['priceListId'] as String?, + replacePrices: json['replacePrices'] as bool? ?? false, + ); + +Map _$ProductsApiProductsGetQueryParametersToJson( + _ProductsApiProductsGetQueryParameters instance) => + { + if (instance.pageToken case final value?) 'pageToken': value, + 'pageSize': instance.pageSize, + if (instance.categoryId case final value?) 'categoryId': value, + if (instance.search case final value?) 'search': value, + if (instance.priceListId case final value?) 'priceListId': value, + 'replacePrices': instance.replacePrices, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/role.dart b/packages/swagger_to_dart/example/lib/src/gen/models/role.dart new file mode 100644 index 00000000..1cd4ad72 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/role.dart @@ -0,0 +1,28 @@ +// Role +// { +// "type": "string", +// "enum": [ +// "admin", +// "userAdministrator" +// ] +// } + +library role; + +import 'exports.dart'; +part 'role.g.dart'; + +@JsonEnum(alwaysCreate: true) +enum Role { + @JsonValue("admin") + admin, + @JsonValue("userAdministrator") + userAdministrator; + + factory Role.fromJson(String json) => Role.values.firstWhere( + (e) => e.toJson() == json, + orElse: () => Role.values.first, + ); + + String toJson() => _$RoleEnumMap[this]!; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/role.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/role.g.dart new file mode 100644 index 00000000..925a809d --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/role.g.dart @@ -0,0 +1,12 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'role.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +const _$RoleEnumMap = { + Role.admin: 'admin', + Role.userAdministrator: 'userAdministrator', +}; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_dto.dart new file mode 100644 index 00000000..716050ee --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_dto.dart @@ -0,0 +1,75 @@ +/// SalePointDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "name": { +/// "type": "string" +/// }, +/// "number": { +/// "type": "integer", +/// "format": "int32" +/// }, +/// "is_default": { +/// "type": "boolean" +/// }, +/// "users": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/UserRef" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "id", +/// "is_default", +/// "name", +/// "number", +/// "users" +/// ], +/// "additionalProperties": false +/// } +library sale_point_dto; + +import 'exports.dart'; +part 'sale_point_dto.freezed.dart'; +part 'sale_point_dto.g.dart'; // SalePointDto + +@freezed +abstract class SalePointDto with _$SalePointDto { + const SalePointDto._(); + + @jsonSerializable + const factory SalePointDto({ + /// id + @JsonKey(name: SalePointDto.idKey_) required String id, + + /// name + @JsonKey(name: SalePointDto.nameKey_) required String name, + + /// number + @JsonKey(name: SalePointDto.numberKey_) required int number, + + /// isDefault + @JsonKey(name: SalePointDto.isDefaultKey_) required bool isDefault, + + /// users + @JsonKey(name: SalePointDto.usersKey_) required List users, + }) = _SalePointDto; + + factory SalePointDto.fromJson(Map json) => + _$SalePointDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; + + static const String numberKey_ = r'number'; + + static const String isDefaultKey_ = r'is_default'; + + static const String usersKey_ = r'users'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_dto.freezed.dart new file mode 100644 index 00000000..7569c38e --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_dto.freezed.dart @@ -0,0 +1,451 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'sale_point_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SalePointDto { + /// id + @JsonKey(name: SalePointDto.idKey_) + String get id; + + /// name + @JsonKey(name: SalePointDto.nameKey_) + String get name; + + /// number + @JsonKey(name: SalePointDto.numberKey_) + int get number; + + /// isDefault + @JsonKey(name: SalePointDto.isDefaultKey_) + bool get isDefault; + + /// users + @JsonKey(name: SalePointDto.usersKey_) + List get users; + + /// Create a copy of SalePointDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SalePointDtoCopyWith get copyWith => + _$SalePointDtoCopyWithImpl( + this as SalePointDto, _$identity); + + /// Serializes this SalePointDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SalePointDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.number, number) || other.number == number) && + (identical(other.isDefault, isDefault) || + other.isDefault == isDefault) && + const DeepCollectionEquality().equals(other.users, users)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, number, isDefault, + const DeepCollectionEquality().hash(users)); + + @override + String toString() { + return 'SalePointDto(id: $id, name: $name, number: $number, isDefault: $isDefault, users: $users)'; + } +} + +/// @nodoc +abstract mixin class $SalePointDtoCopyWith<$Res> { + factory $SalePointDtoCopyWith( + SalePointDto value, $Res Function(SalePointDto) _then) = + _$SalePointDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: SalePointDto.idKey_) String id, + @JsonKey(name: SalePointDto.nameKey_) String name, + @JsonKey(name: SalePointDto.numberKey_) int number, + @JsonKey(name: SalePointDto.isDefaultKey_) bool isDefault, + @JsonKey(name: SalePointDto.usersKey_) List users}); +} + +/// @nodoc +class _$SalePointDtoCopyWithImpl<$Res> implements $SalePointDtoCopyWith<$Res> { + _$SalePointDtoCopyWithImpl(this._self, this._then); + + final SalePointDto _self; + final $Res Function(SalePointDto) _then; + + /// Create a copy of SalePointDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + Object? number = null, + Object? isDefault = null, + Object? users = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + number: null == number + ? _self.number + : number // ignore: cast_nullable_to_non_nullable + as int, + isDefault: null == isDefault + ? _self.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + users: null == users + ? _self.users + : users // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [SalePointDto]. +extension SalePointDtoPatterns on SalePointDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_SalePointDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _SalePointDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_SalePointDto value) $default, + ) { + final _that = this; + switch (_that) { + case _SalePointDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_SalePointDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _SalePointDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: SalePointDto.idKey_) String id, + @JsonKey(name: SalePointDto.nameKey_) String name, + @JsonKey(name: SalePointDto.numberKey_) int number, + @JsonKey(name: SalePointDto.isDefaultKey_) bool isDefault, + @JsonKey(name: SalePointDto.usersKey_) List users)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _SalePointDto() when $default != null: + return $default( + _that.id, _that.name, _that.number, _that.isDefault, _that.users); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: SalePointDto.idKey_) String id, + @JsonKey(name: SalePointDto.nameKey_) String name, + @JsonKey(name: SalePointDto.numberKey_) int number, + @JsonKey(name: SalePointDto.isDefaultKey_) bool isDefault, + @JsonKey(name: SalePointDto.usersKey_) List users) + $default, + ) { + final _that = this; + switch (_that) { + case _SalePointDto(): + return $default( + _that.id, _that.name, _that.number, _that.isDefault, _that.users); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: SalePointDto.idKey_) String id, + @JsonKey(name: SalePointDto.nameKey_) String name, + @JsonKey(name: SalePointDto.numberKey_) int number, + @JsonKey(name: SalePointDto.isDefaultKey_) bool isDefault, + @JsonKey(name: SalePointDto.usersKey_) List users)? + $default, + ) { + final _that = this; + switch (_that) { + case _SalePointDto() when $default != null: + return $default( + _that.id, _that.name, _that.number, _that.isDefault, _that.users); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _SalePointDto extends SalePointDto { + const _SalePointDto( + {@JsonKey(name: SalePointDto.idKey_) required this.id, + @JsonKey(name: SalePointDto.nameKey_) required this.name, + @JsonKey(name: SalePointDto.numberKey_) required this.number, + @JsonKey(name: SalePointDto.isDefaultKey_) required this.isDefault, + @JsonKey(name: SalePointDto.usersKey_) + required final List users}) + : _users = users, + super._(); + factory _SalePointDto.fromJson(Map json) => + _$SalePointDtoFromJson(json); + + /// id + @override + @JsonKey(name: SalePointDto.idKey_) + final String id; + + /// name + @override + @JsonKey(name: SalePointDto.nameKey_) + final String name; + + /// number + @override + @JsonKey(name: SalePointDto.numberKey_) + final int number; + + /// isDefault + @override + @JsonKey(name: SalePointDto.isDefaultKey_) + final bool isDefault; + + /// users + final List _users; + + /// users + @override + @JsonKey(name: SalePointDto.usersKey_) + List get users { + if (_users is EqualUnmodifiableListView) return _users; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_users); + } + + /// Create a copy of SalePointDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$SalePointDtoCopyWith<_SalePointDto> get copyWith => + __$SalePointDtoCopyWithImpl<_SalePointDto>(this, _$identity); + + @override + Map toJson() { + return _$SalePointDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _SalePointDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.number, number) || other.number == number) && + (identical(other.isDefault, isDefault) || + other.isDefault == isDefault) && + const DeepCollectionEquality().equals(other._users, _users)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, number, isDefault, + const DeepCollectionEquality().hash(_users)); + + @override + String toString() { + return 'SalePointDto(id: $id, name: $name, number: $number, isDefault: $isDefault, users: $users)'; + } +} + +/// @nodoc +abstract mixin class _$SalePointDtoCopyWith<$Res> + implements $SalePointDtoCopyWith<$Res> { + factory _$SalePointDtoCopyWith( + _SalePointDto value, $Res Function(_SalePointDto) _then) = + __$SalePointDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: SalePointDto.idKey_) String id, + @JsonKey(name: SalePointDto.nameKey_) String name, + @JsonKey(name: SalePointDto.numberKey_) int number, + @JsonKey(name: SalePointDto.isDefaultKey_) bool isDefault, + @JsonKey(name: SalePointDto.usersKey_) List users}); +} + +/// @nodoc +class __$SalePointDtoCopyWithImpl<$Res> + implements _$SalePointDtoCopyWith<$Res> { + __$SalePointDtoCopyWithImpl(this._self, this._then); + + final _SalePointDto _self; + final $Res Function(_SalePointDto) _then; + + /// Create a copy of SalePointDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? name = null, + Object? number = null, + Object? isDefault = null, + Object? users = null, + }) { + return _then(_SalePointDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + number: null == number + ? _self.number + : number // ignore: cast_nullable_to_non_nullable + as int, + isDefault: null == isDefault + ? _self.isDefault + : isDefault // ignore: cast_nullable_to_non_nullable + as bool, + users: null == users + ? _self._users + : users // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_dto.g.dart new file mode 100644 index 00000000..413a29fb --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_dto.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'sale_point_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_SalePointDto _$SalePointDtoFromJson(Map json) => + _SalePointDto( + id: json['id'] as String, + name: json['name'] as String, + number: (json['number'] as num).toInt(), + isDefault: json['is_default'] as bool, + users: (json['users'] as List) + .map((e) => UserRef.fromJson(e as Map)) + .toList(), + ); + +Map _$SalePointDtoToJson(_SalePointDto instance) => + { + 'id': instance.id, + 'name': instance.name, + 'number': instance.number, + 'is_default': instance.isDefault, + 'users': instance.users.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_ref.dart b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_ref.dart new file mode 100644 index 00000000..08d01ee8 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_ref.dart @@ -0,0 +1,44 @@ +/// SalePointRef +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "name": { +/// "type": "string" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "id", +/// "name" +/// ], +/// "additionalProperties": false +/// } +library sale_point_ref; + +import 'exports.dart'; +part 'sale_point_ref.freezed.dart'; +part 'sale_point_ref.g.dart'; // SalePointRef + +@freezed +abstract class SalePointRef with _$SalePointRef { + const SalePointRef._(); + + @jsonSerializable + const factory SalePointRef({ + /// id + @JsonKey(name: SalePointRef.idKey_) required String id, + + /// name + @JsonKey(name: SalePointRef.nameKey_) required String name, + }) = _SalePointRef; + + factory SalePointRef.fromJson(Map json) => + _$SalePointRefFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_ref.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_ref.freezed.dart new file mode 100644 index 00000000..b7f3e8ce --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_ref.freezed.dart @@ -0,0 +1,351 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'sale_point_ref.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SalePointRef { + /// id + @JsonKey(name: SalePointRef.idKey_) + String get id; + + /// name + @JsonKey(name: SalePointRef.nameKey_) + String get name; + + /// Create a copy of SalePointRef + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SalePointRefCopyWith get copyWith => + _$SalePointRefCopyWithImpl( + this as SalePointRef, _$identity); + + /// Serializes this SalePointRef to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SalePointRef && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name); + + @override + String toString() { + return 'SalePointRef(id: $id, name: $name)'; + } +} + +/// @nodoc +abstract mixin class $SalePointRefCopyWith<$Res> { + factory $SalePointRefCopyWith( + SalePointRef value, $Res Function(SalePointRef) _then) = + _$SalePointRefCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: SalePointRef.idKey_) String id, + @JsonKey(name: SalePointRef.nameKey_) String name}); +} + +/// @nodoc +class _$SalePointRefCopyWithImpl<$Res> implements $SalePointRefCopyWith<$Res> { + _$SalePointRefCopyWithImpl(this._self, this._then); + + final SalePointRef _self; + final $Res Function(SalePointRef) _then; + + /// Create a copy of SalePointRef + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [SalePointRef]. +extension SalePointRefPatterns on SalePointRef { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_SalePointRef value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _SalePointRef() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_SalePointRef value) $default, + ) { + final _that = this; + switch (_that) { + case _SalePointRef(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_SalePointRef value)? $default, + ) { + final _that = this; + switch (_that) { + case _SalePointRef() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(@JsonKey(name: SalePointRef.idKey_) String id, + @JsonKey(name: SalePointRef.nameKey_) String name)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _SalePointRef() when $default != null: + return $default(_that.id, _that.name); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(@JsonKey(name: SalePointRef.idKey_) String id, + @JsonKey(name: SalePointRef.nameKey_) String name) + $default, + ) { + final _that = this; + switch (_that) { + case _SalePointRef(): + return $default(_that.id, _that.name); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(@JsonKey(name: SalePointRef.idKey_) String id, + @JsonKey(name: SalePointRef.nameKey_) String name)? + $default, + ) { + final _that = this; + switch (_that) { + case _SalePointRef() when $default != null: + return $default(_that.id, _that.name); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _SalePointRef extends SalePointRef { + const _SalePointRef( + {@JsonKey(name: SalePointRef.idKey_) required this.id, + @JsonKey(name: SalePointRef.nameKey_) required this.name}) + : super._(); + factory _SalePointRef.fromJson(Map json) => + _$SalePointRefFromJson(json); + + /// id + @override + @JsonKey(name: SalePointRef.idKey_) + final String id; + + /// name + @override + @JsonKey(name: SalePointRef.nameKey_) + final String name; + + /// Create a copy of SalePointRef + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$SalePointRefCopyWith<_SalePointRef> get copyWith => + __$SalePointRefCopyWithImpl<_SalePointRef>(this, _$identity); + + @override + Map toJson() { + return _$SalePointRefToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _SalePointRef && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name); + + @override + String toString() { + return 'SalePointRef(id: $id, name: $name)'; + } +} + +/// @nodoc +abstract mixin class _$SalePointRefCopyWith<$Res> + implements $SalePointRefCopyWith<$Res> { + factory _$SalePointRefCopyWith( + _SalePointRef value, $Res Function(_SalePointRef) _then) = + __$SalePointRefCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: SalePointRef.idKey_) String id, + @JsonKey(name: SalePointRef.nameKey_) String name}); +} + +/// @nodoc +class __$SalePointRefCopyWithImpl<$Res> + implements _$SalePointRefCopyWith<$Res> { + __$SalePointRefCopyWithImpl(this._self, this._then); + + final _SalePointRef _self; + final $Res Function(_SalePointRef) _then; + + /// Create a copy of SalePointRef + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? name = null, + }) { + return _then(_SalePointRef( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_ref.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_ref.g.dart new file mode 100644 index 00000000..0721fafd --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/sale_point_ref.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'sale_point_ref.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_SalePointRef _$SalePointRefFromJson(Map json) => + _SalePointRef( + id: json['id'] as String, + name: json['name'] as String, + ); + +Map _$SalePointRefToJson(_SalePointRef instance) => + { + 'id': instance.id, + 'name': instance.name, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/sync_api_sync_pull_get_query_parameters.dart b/packages/swagger_to_dart/example/lib/src/gen/models/sync_api_sync_pull_get_query_parameters.dart new file mode 100644 index 00000000..f0f00e65 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/sync_api_sync_pull_get_query_parameters.dart @@ -0,0 +1,47 @@ +/// SyncApiSyncPullGetQueryParameters +/// { +/// "properties": { +/// "lastId": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "pageSize": { +/// "type": "integer", +/// "format": "int32", +/// "default": 1000 +/// } +/// }, +/// "type": "object", +/// "required": [] +/// } +library sync_api_sync_pull_get_query_parameters; + +import 'exports.dart'; +part 'sync_api_sync_pull_get_query_parameters.freezed.dart'; +part 'sync_api_sync_pull_get_query_parameters.g.dart'; // SyncApiSyncPullGetQueryParameters + +@freezed +abstract class SyncApiSyncPullGetQueryParameters + with _$SyncApiSyncPullGetQueryParameters { + const SyncApiSyncPullGetQueryParameters._(); + + @jsonSerializable + const factory SyncApiSyncPullGetQueryParameters({ + /// lastId + @JsonKey(name: SyncApiSyncPullGetQueryParameters.lastIdKey_) String? lastId, + + /// pageSize + @Default(1000) + @JsonKey(name: SyncApiSyncPullGetQueryParameters.pageSizeKey_) + int pageSize, + }) = _SyncApiSyncPullGetQueryParameters; + + factory SyncApiSyncPullGetQueryParameters.fromJson( + Map json, + ) => _$SyncApiSyncPullGetQueryParametersFromJson(json); + + static const String lastIdKey_ = r'lastId'; + + static const String pageSizeKey_ = r'pageSize'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/sync_api_sync_pull_get_query_parameters.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/sync_api_sync_pull_get_query_parameters.freezed.dart new file mode 100644 index 00000000..445fbef6 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/sync_api_sync_pull_get_query_parameters.freezed.dart @@ -0,0 +1,376 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'sync_api_sync_pull_get_query_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$SyncApiSyncPullGetQueryParameters { + /// lastId + @JsonKey(name: SyncApiSyncPullGetQueryParameters.lastIdKey_) + String? get lastId; + + /// pageSize + @JsonKey(name: SyncApiSyncPullGetQueryParameters.pageSizeKey_) + int get pageSize; + + /// Create a copy of SyncApiSyncPullGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SyncApiSyncPullGetQueryParametersCopyWith + get copyWith => _$SyncApiSyncPullGetQueryParametersCopyWithImpl< + SyncApiSyncPullGetQueryParameters>( + this as SyncApiSyncPullGetQueryParameters, _$identity); + + /// Serializes this SyncApiSyncPullGetQueryParameters to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is SyncApiSyncPullGetQueryParameters && + (identical(other.lastId, lastId) || other.lastId == lastId) && + (identical(other.pageSize, pageSize) || + other.pageSize == pageSize)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, lastId, pageSize); + + @override + String toString() { + return 'SyncApiSyncPullGetQueryParameters(lastId: $lastId, pageSize: $pageSize)'; + } +} + +/// @nodoc +abstract mixin class $SyncApiSyncPullGetQueryParametersCopyWith<$Res> { + factory $SyncApiSyncPullGetQueryParametersCopyWith( + SyncApiSyncPullGetQueryParameters value, + $Res Function(SyncApiSyncPullGetQueryParameters) _then) = + _$SyncApiSyncPullGetQueryParametersCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: SyncApiSyncPullGetQueryParameters.lastIdKey_) + String? lastId, + @JsonKey(name: SyncApiSyncPullGetQueryParameters.pageSizeKey_) + int pageSize}); +} + +/// @nodoc +class _$SyncApiSyncPullGetQueryParametersCopyWithImpl<$Res> + implements $SyncApiSyncPullGetQueryParametersCopyWith<$Res> { + _$SyncApiSyncPullGetQueryParametersCopyWithImpl(this._self, this._then); + + final SyncApiSyncPullGetQueryParameters _self; + final $Res Function(SyncApiSyncPullGetQueryParameters) _then; + + /// Create a copy of SyncApiSyncPullGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? lastId = freezed, + Object? pageSize = null, + }) { + return _then(_self.copyWith( + lastId: freezed == lastId + ? _self.lastId + : lastId // ignore: cast_nullable_to_non_nullable + as String?, + pageSize: null == pageSize + ? _self.pageSize + : pageSize // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// Adds pattern-matching-related methods to [SyncApiSyncPullGetQueryParameters]. +extension SyncApiSyncPullGetQueryParametersPatterns + on SyncApiSyncPullGetQueryParameters { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_SyncApiSyncPullGetQueryParameters value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _SyncApiSyncPullGetQueryParameters() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_SyncApiSyncPullGetQueryParameters value) $default, + ) { + final _that = this; + switch (_that) { + case _SyncApiSyncPullGetQueryParameters(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_SyncApiSyncPullGetQueryParameters value)? $default, + ) { + final _that = this; + switch (_that) { + case _SyncApiSyncPullGetQueryParameters() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: SyncApiSyncPullGetQueryParameters.lastIdKey_) + String? lastId, + @JsonKey(name: SyncApiSyncPullGetQueryParameters.pageSizeKey_) + int pageSize)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _SyncApiSyncPullGetQueryParameters() when $default != null: + return $default(_that.lastId, _that.pageSize); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: SyncApiSyncPullGetQueryParameters.lastIdKey_) + String? lastId, + @JsonKey(name: SyncApiSyncPullGetQueryParameters.pageSizeKey_) + int pageSize) + $default, + ) { + final _that = this; + switch (_that) { + case _SyncApiSyncPullGetQueryParameters(): + return $default(_that.lastId, _that.pageSize); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: SyncApiSyncPullGetQueryParameters.lastIdKey_) + String? lastId, + @JsonKey(name: SyncApiSyncPullGetQueryParameters.pageSizeKey_) + int pageSize)? + $default, + ) { + final _that = this; + switch (_that) { + case _SyncApiSyncPullGetQueryParameters() when $default != null: + return $default(_that.lastId, _that.pageSize); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _SyncApiSyncPullGetQueryParameters + extends SyncApiSyncPullGetQueryParameters { + const _SyncApiSyncPullGetQueryParameters( + {@JsonKey(name: SyncApiSyncPullGetQueryParameters.lastIdKey_) this.lastId, + @JsonKey(name: SyncApiSyncPullGetQueryParameters.pageSizeKey_) + this.pageSize = 1000}) + : super._(); + factory _SyncApiSyncPullGetQueryParameters.fromJson( + Map json) => + _$SyncApiSyncPullGetQueryParametersFromJson(json); + + /// lastId + @override + @JsonKey(name: SyncApiSyncPullGetQueryParameters.lastIdKey_) + final String? lastId; + + /// pageSize + @override + @JsonKey(name: SyncApiSyncPullGetQueryParameters.pageSizeKey_) + final int pageSize; + + /// Create a copy of SyncApiSyncPullGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$SyncApiSyncPullGetQueryParametersCopyWith< + _SyncApiSyncPullGetQueryParameters> + get copyWith => __$SyncApiSyncPullGetQueryParametersCopyWithImpl< + _SyncApiSyncPullGetQueryParameters>(this, _$identity); + + @override + Map toJson() { + return _$SyncApiSyncPullGetQueryParametersToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _SyncApiSyncPullGetQueryParameters && + (identical(other.lastId, lastId) || other.lastId == lastId) && + (identical(other.pageSize, pageSize) || + other.pageSize == pageSize)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, lastId, pageSize); + + @override + String toString() { + return 'SyncApiSyncPullGetQueryParameters(lastId: $lastId, pageSize: $pageSize)'; + } +} + +/// @nodoc +abstract mixin class _$SyncApiSyncPullGetQueryParametersCopyWith<$Res> + implements $SyncApiSyncPullGetQueryParametersCopyWith<$Res> { + factory _$SyncApiSyncPullGetQueryParametersCopyWith( + _SyncApiSyncPullGetQueryParameters value, + $Res Function(_SyncApiSyncPullGetQueryParameters) _then) = + __$SyncApiSyncPullGetQueryParametersCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: SyncApiSyncPullGetQueryParameters.lastIdKey_) + String? lastId, + @JsonKey(name: SyncApiSyncPullGetQueryParameters.pageSizeKey_) + int pageSize}); +} + +/// @nodoc +class __$SyncApiSyncPullGetQueryParametersCopyWithImpl<$Res> + implements _$SyncApiSyncPullGetQueryParametersCopyWith<$Res> { + __$SyncApiSyncPullGetQueryParametersCopyWithImpl(this._self, this._then); + + final _SyncApiSyncPullGetQueryParameters _self; + final $Res Function(_SyncApiSyncPullGetQueryParameters) _then; + + /// Create a copy of SyncApiSyncPullGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? lastId = freezed, + Object? pageSize = null, + }) { + return _then(_SyncApiSyncPullGetQueryParameters( + lastId: freezed == lastId + ? _self.lastId + : lastId // ignore: cast_nullable_to_non_nullable + as String?, + pageSize: null == pageSize + ? _self.pageSize + : pageSize // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/sync_api_sync_pull_get_query_parameters.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/sync_api_sync_pull_get_query_parameters.g.dart new file mode 100644 index 00000000..40bb5e89 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/sync_api_sync_pull_get_query_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'sync_api_sync_pull_get_query_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_SyncApiSyncPullGetQueryParameters _$SyncApiSyncPullGetQueryParametersFromJson( + Map json) => + _SyncApiSyncPullGetQueryParameters( + lastId: json['lastId'] as String?, + pageSize: (json['pageSize'] as num?)?.toInt() ?? 1000, + ); + +Map _$SyncApiSyncPullGetQueryParametersToJson( + _SyncApiSyncPullGetQueryParameters instance) => + { + if (instance.lastId case final value?) 'lastId': value, + 'pageSize': instance.pageSize, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_category_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_category_dto.dart new file mode 100644 index 00000000..4457c45a --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_category_dto.dart @@ -0,0 +1,54 @@ +/// UpdateCategoryDto +/// { +/// "properties": { +/// "name": { +/// "type": "string", +/// "nullable": true +/// }, +/// "parent_id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "default_markup_percentage": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "additionalProperties": false +/// } +library update_category_dto; + +import 'exports.dart'; +part 'update_category_dto.freezed.dart'; +part 'update_category_dto.g.dart'; // UpdateCategoryDto + +@freezed +abstract class UpdateCategoryDto with _$UpdateCategoryDto { + const UpdateCategoryDto._(); + + @jsonSerializable + const factory UpdateCategoryDto({ + /// name + @JsonKey(name: UpdateCategoryDto.nameKey_) String? name, + + /// parentId + @JsonKey(name: UpdateCategoryDto.parentIdKey_) String? parentId, + + /// defaultMarkupPercentage + @JsonKey(name: UpdateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage, + }) = _UpdateCategoryDto; + + factory UpdateCategoryDto.fromJson(Map json) => + _$UpdateCategoryDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String parentIdKey_ = r'parent_id'; + + static const String defaultMarkupPercentageKey_ = + r'default_markup_percentage'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_category_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_category_dto.freezed.dart new file mode 100644 index 00000000..d39916e3 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_category_dto.freezed.dart @@ -0,0 +1,399 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_category_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateCategoryDto { + /// name + @JsonKey(name: UpdateCategoryDto.nameKey_) + String? get name; + + /// parentId + @JsonKey(name: UpdateCategoryDto.parentIdKey_) + String? get parentId; + + /// defaultMarkupPercentage + @JsonKey(name: UpdateCategoryDto.defaultMarkupPercentageKey_) + double? get defaultMarkupPercentage; + + /// Create a copy of UpdateCategoryDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateCategoryDtoCopyWith get copyWith => + _$UpdateCategoryDtoCopyWithImpl( + this as UpdateCategoryDto, _$identity); + + /// Serializes this UpdateCategoryDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateCategoryDto && + (identical(other.name, name) || other.name == name) && + (identical(other.parentId, parentId) || + other.parentId == parentId) && + (identical( + other.defaultMarkupPercentage, defaultMarkupPercentage) || + other.defaultMarkupPercentage == defaultMarkupPercentage)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, parentId, defaultMarkupPercentage); + + @override + String toString() { + return 'UpdateCategoryDto(name: $name, parentId: $parentId, defaultMarkupPercentage: $defaultMarkupPercentage)'; + } +} + +/// @nodoc +abstract mixin class $UpdateCategoryDtoCopyWith<$Res> { + factory $UpdateCategoryDtoCopyWith( + UpdateCategoryDto value, $Res Function(UpdateCategoryDto) _then) = + _$UpdateCategoryDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdateCategoryDto.nameKey_) String? name, + @JsonKey(name: UpdateCategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: UpdateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage}); +} + +/// @nodoc +class _$UpdateCategoryDtoCopyWithImpl<$Res> + implements $UpdateCategoryDtoCopyWith<$Res> { + _$UpdateCategoryDtoCopyWithImpl(this._self, this._then); + + final UpdateCategoryDto _self; + final $Res Function(UpdateCategoryDto) _then; + + /// Create a copy of UpdateCategoryDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = freezed, + Object? parentId = freezed, + Object? defaultMarkupPercentage = freezed, + }) { + return _then(_self.copyWith( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + defaultMarkupPercentage: freezed == defaultMarkupPercentage + ? _self.defaultMarkupPercentage + : defaultMarkupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdateCategoryDto]. +extension UpdateCategoryDtoPatterns on UpdateCategoryDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdateCategoryDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateCategoryDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdateCategoryDto value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdateCategoryDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdateCategoryDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdateCategoryDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UpdateCategoryDto.nameKey_) String? name, + @JsonKey(name: UpdateCategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: UpdateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateCategoryDto() when $default != null: + return $default( + _that.name, _that.parentId, _that.defaultMarkupPercentage); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UpdateCategoryDto.nameKey_) String? name, + @JsonKey(name: UpdateCategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: UpdateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateCategoryDto(): + return $default( + _that.name, _that.parentId, _that.defaultMarkupPercentage); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UpdateCategoryDto.nameKey_) String? name, + @JsonKey(name: UpdateCategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: UpdateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateCategoryDto() when $default != null: + return $default( + _that.name, _that.parentId, _that.defaultMarkupPercentage); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdateCategoryDto extends UpdateCategoryDto { + const _UpdateCategoryDto( + {@JsonKey(name: UpdateCategoryDto.nameKey_) this.name, + @JsonKey(name: UpdateCategoryDto.parentIdKey_) this.parentId, + @JsonKey(name: UpdateCategoryDto.defaultMarkupPercentageKey_) + this.defaultMarkupPercentage}) + : super._(); + factory _UpdateCategoryDto.fromJson(Map json) => + _$UpdateCategoryDtoFromJson(json); + + /// name + @override + @JsonKey(name: UpdateCategoryDto.nameKey_) + final String? name; + + /// parentId + @override + @JsonKey(name: UpdateCategoryDto.parentIdKey_) + final String? parentId; + + /// defaultMarkupPercentage + @override + @JsonKey(name: UpdateCategoryDto.defaultMarkupPercentageKey_) + final double? defaultMarkupPercentage; + + /// Create a copy of UpdateCategoryDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdateCategoryDtoCopyWith<_UpdateCategoryDto> get copyWith => + __$UpdateCategoryDtoCopyWithImpl<_UpdateCategoryDto>(this, _$identity); + + @override + Map toJson() { + return _$UpdateCategoryDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdateCategoryDto && + (identical(other.name, name) || other.name == name) && + (identical(other.parentId, parentId) || + other.parentId == parentId) && + (identical( + other.defaultMarkupPercentage, defaultMarkupPercentage) || + other.defaultMarkupPercentage == defaultMarkupPercentage)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, parentId, defaultMarkupPercentage); + + @override + String toString() { + return 'UpdateCategoryDto(name: $name, parentId: $parentId, defaultMarkupPercentage: $defaultMarkupPercentage)'; + } +} + +/// @nodoc +abstract mixin class _$UpdateCategoryDtoCopyWith<$Res> + implements $UpdateCategoryDtoCopyWith<$Res> { + factory _$UpdateCategoryDtoCopyWith( + _UpdateCategoryDto value, $Res Function(_UpdateCategoryDto) _then) = + __$UpdateCategoryDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdateCategoryDto.nameKey_) String? name, + @JsonKey(name: UpdateCategoryDto.parentIdKey_) String? parentId, + @JsonKey(name: UpdateCategoryDto.defaultMarkupPercentageKey_) + double? defaultMarkupPercentage}); +} + +/// @nodoc +class __$UpdateCategoryDtoCopyWithImpl<$Res> + implements _$UpdateCategoryDtoCopyWith<$Res> { + __$UpdateCategoryDtoCopyWithImpl(this._self, this._then); + + final _UpdateCategoryDto _self; + final $Res Function(_UpdateCategoryDto) _then; + + /// Create a copy of UpdateCategoryDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = freezed, + Object? parentId = freezed, + Object? defaultMarkupPercentage = freezed, + }) { + return _then(_UpdateCategoryDto( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + parentId: freezed == parentId + ? _self.parentId + : parentId // ignore: cast_nullable_to_non_nullable + as String?, + defaultMarkupPercentage: freezed == defaultMarkupPercentage + ? _self.defaultMarkupPercentage + : defaultMarkupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_category_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_category_dto.g.dart new file mode 100644 index 00000000..24d670de --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_category_dto.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_category_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdateCategoryDto _$UpdateCategoryDtoFromJson(Map json) => + _UpdateCategoryDto( + name: json['name'] as String?, + parentId: json['parent_id'] as String?, + defaultMarkupPercentage: + (json['default_markup_percentage'] as num?)?.toDouble(), + ); + +Map _$UpdateCategoryDtoToJson(_UpdateCategoryDto instance) => + { + if (instance.name case final value?) 'name': value, + if (instance.parentId case final value?) 'parent_id': value, + if (instance.defaultMarkupPercentage case final value?) + 'default_markup_percentage': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_customer_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_customer_dto.dart new file mode 100644 index 00000000..7df0f14a --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_customer_dto.dart @@ -0,0 +1,61 @@ +/// UpdateCustomerDto +/// { +/// "properties": { +/// "name": { +/// "type": "string", +/// "nullable": true +/// }, +/// "cuit": { +/// "type": "string", +/// "nullable": true +/// }, +/// "address": { +/// "type": "string", +/// "nullable": true +/// }, +/// "require_full_payment_on_close": { +/// "type": "boolean", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "additionalProperties": false +/// } +library update_customer_dto; + +import 'exports.dart'; +part 'update_customer_dto.freezed.dart'; +part 'update_customer_dto.g.dart'; // UpdateCustomerDto + +@freezed +abstract class UpdateCustomerDto with _$UpdateCustomerDto { + const UpdateCustomerDto._(); + + @jsonSerializable + const factory UpdateCustomerDto({ + /// name + @JsonKey(name: UpdateCustomerDto.nameKey_) String? name, + + /// cuit + @JsonKey(name: UpdateCustomerDto.cuitKey_) String? cuit, + + /// address + @JsonKey(name: UpdateCustomerDto.addressKey_) String? address, + + /// requireFullPaymentOnClose + @JsonKey(name: UpdateCustomerDto.requireFullPaymentOnCloseKey_) + bool? requireFullPaymentOnClose, + }) = _UpdateCustomerDto; + + factory UpdateCustomerDto.fromJson(Map json) => + _$UpdateCustomerDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String cuitKey_ = r'cuit'; + + static const String addressKey_ = r'address'; + + static const String requireFullPaymentOnCloseKey_ = + r'require_full_payment_on_close'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_customer_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_customer_dto.freezed.dart new file mode 100644 index 00000000..733ffbbf --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_customer_dto.freezed.dart @@ -0,0 +1,424 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_customer_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateCustomerDto { + /// name + @JsonKey(name: UpdateCustomerDto.nameKey_) + String? get name; + + /// cuit + @JsonKey(name: UpdateCustomerDto.cuitKey_) + String? get cuit; + + /// address + @JsonKey(name: UpdateCustomerDto.addressKey_) + String? get address; + + /// requireFullPaymentOnClose + @JsonKey(name: UpdateCustomerDto.requireFullPaymentOnCloseKey_) + bool? get requireFullPaymentOnClose; + + /// Create a copy of UpdateCustomerDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateCustomerDtoCopyWith get copyWith => + _$UpdateCustomerDtoCopyWithImpl( + this as UpdateCustomerDto, _$identity); + + /// Serializes this UpdateCustomerDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateCustomerDto && + (identical(other.name, name) || other.name == name) && + (identical(other.cuit, cuit) || other.cuit == cuit) && + (identical(other.address, address) || other.address == address) && + (identical(other.requireFullPaymentOnClose, + requireFullPaymentOnClose) || + other.requireFullPaymentOnClose == requireFullPaymentOnClose)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, cuit, address, requireFullPaymentOnClose); + + @override + String toString() { + return 'UpdateCustomerDto(name: $name, cuit: $cuit, address: $address, requireFullPaymentOnClose: $requireFullPaymentOnClose)'; + } +} + +/// @nodoc +abstract mixin class $UpdateCustomerDtoCopyWith<$Res> { + factory $UpdateCustomerDtoCopyWith( + UpdateCustomerDto value, $Res Function(UpdateCustomerDto) _then) = + _$UpdateCustomerDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdateCustomerDto.nameKey_) String? name, + @JsonKey(name: UpdateCustomerDto.cuitKey_) String? cuit, + @JsonKey(name: UpdateCustomerDto.addressKey_) String? address, + @JsonKey(name: UpdateCustomerDto.requireFullPaymentOnCloseKey_) + bool? requireFullPaymentOnClose}); +} + +/// @nodoc +class _$UpdateCustomerDtoCopyWithImpl<$Res> + implements $UpdateCustomerDtoCopyWith<$Res> { + _$UpdateCustomerDtoCopyWithImpl(this._self, this._then); + + final UpdateCustomerDto _self; + final $Res Function(UpdateCustomerDto) _then; + + /// Create a copy of UpdateCustomerDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = freezed, + Object? cuit = freezed, + Object? address = freezed, + Object? requireFullPaymentOnClose = freezed, + }) { + return _then(_self.copyWith( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + cuit: freezed == cuit + ? _self.cuit + : cuit // ignore: cast_nullable_to_non_nullable + as String?, + address: freezed == address + ? _self.address + : address // ignore: cast_nullable_to_non_nullable + as String?, + requireFullPaymentOnClose: freezed == requireFullPaymentOnClose + ? _self.requireFullPaymentOnClose + : requireFullPaymentOnClose // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdateCustomerDto]. +extension UpdateCustomerDtoPatterns on UpdateCustomerDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdateCustomerDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateCustomerDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdateCustomerDto value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdateCustomerDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdateCustomerDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdateCustomerDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UpdateCustomerDto.nameKey_) String? name, + @JsonKey(name: UpdateCustomerDto.cuitKey_) String? cuit, + @JsonKey(name: UpdateCustomerDto.addressKey_) String? address, + @JsonKey(name: UpdateCustomerDto.requireFullPaymentOnCloseKey_) + bool? requireFullPaymentOnClose)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateCustomerDto() when $default != null: + return $default(_that.name, _that.cuit, _that.address, + _that.requireFullPaymentOnClose); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UpdateCustomerDto.nameKey_) String? name, + @JsonKey(name: UpdateCustomerDto.cuitKey_) String? cuit, + @JsonKey(name: UpdateCustomerDto.addressKey_) String? address, + @JsonKey(name: UpdateCustomerDto.requireFullPaymentOnCloseKey_) + bool? requireFullPaymentOnClose) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateCustomerDto(): + return $default(_that.name, _that.cuit, _that.address, + _that.requireFullPaymentOnClose); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UpdateCustomerDto.nameKey_) String? name, + @JsonKey(name: UpdateCustomerDto.cuitKey_) String? cuit, + @JsonKey(name: UpdateCustomerDto.addressKey_) String? address, + @JsonKey(name: UpdateCustomerDto.requireFullPaymentOnCloseKey_) + bool? requireFullPaymentOnClose)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateCustomerDto() when $default != null: + return $default(_that.name, _that.cuit, _that.address, + _that.requireFullPaymentOnClose); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdateCustomerDto extends UpdateCustomerDto { + const _UpdateCustomerDto( + {@JsonKey(name: UpdateCustomerDto.nameKey_) this.name, + @JsonKey(name: UpdateCustomerDto.cuitKey_) this.cuit, + @JsonKey(name: UpdateCustomerDto.addressKey_) this.address, + @JsonKey(name: UpdateCustomerDto.requireFullPaymentOnCloseKey_) + this.requireFullPaymentOnClose}) + : super._(); + factory _UpdateCustomerDto.fromJson(Map json) => + _$UpdateCustomerDtoFromJson(json); + + /// name + @override + @JsonKey(name: UpdateCustomerDto.nameKey_) + final String? name; + + /// cuit + @override + @JsonKey(name: UpdateCustomerDto.cuitKey_) + final String? cuit; + + /// address + @override + @JsonKey(name: UpdateCustomerDto.addressKey_) + final String? address; + + /// requireFullPaymentOnClose + @override + @JsonKey(name: UpdateCustomerDto.requireFullPaymentOnCloseKey_) + final bool? requireFullPaymentOnClose; + + /// Create a copy of UpdateCustomerDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdateCustomerDtoCopyWith<_UpdateCustomerDto> get copyWith => + __$UpdateCustomerDtoCopyWithImpl<_UpdateCustomerDto>(this, _$identity); + + @override + Map toJson() { + return _$UpdateCustomerDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdateCustomerDto && + (identical(other.name, name) || other.name == name) && + (identical(other.cuit, cuit) || other.cuit == cuit) && + (identical(other.address, address) || other.address == address) && + (identical(other.requireFullPaymentOnClose, + requireFullPaymentOnClose) || + other.requireFullPaymentOnClose == requireFullPaymentOnClose)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, cuit, address, requireFullPaymentOnClose); + + @override + String toString() { + return 'UpdateCustomerDto(name: $name, cuit: $cuit, address: $address, requireFullPaymentOnClose: $requireFullPaymentOnClose)'; + } +} + +/// @nodoc +abstract mixin class _$UpdateCustomerDtoCopyWith<$Res> + implements $UpdateCustomerDtoCopyWith<$Res> { + factory _$UpdateCustomerDtoCopyWith( + _UpdateCustomerDto value, $Res Function(_UpdateCustomerDto) _then) = + __$UpdateCustomerDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdateCustomerDto.nameKey_) String? name, + @JsonKey(name: UpdateCustomerDto.cuitKey_) String? cuit, + @JsonKey(name: UpdateCustomerDto.addressKey_) String? address, + @JsonKey(name: UpdateCustomerDto.requireFullPaymentOnCloseKey_) + bool? requireFullPaymentOnClose}); +} + +/// @nodoc +class __$UpdateCustomerDtoCopyWithImpl<$Res> + implements _$UpdateCustomerDtoCopyWith<$Res> { + __$UpdateCustomerDtoCopyWithImpl(this._self, this._then); + + final _UpdateCustomerDto _self; + final $Res Function(_UpdateCustomerDto) _then; + + /// Create a copy of UpdateCustomerDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = freezed, + Object? cuit = freezed, + Object? address = freezed, + Object? requireFullPaymentOnClose = freezed, + }) { + return _then(_UpdateCustomerDto( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + cuit: freezed == cuit + ? _self.cuit + : cuit // ignore: cast_nullable_to_non_nullable + as String?, + address: freezed == address + ? _self.address + : address // ignore: cast_nullable_to_non_nullable + as String?, + requireFullPaymentOnClose: freezed == requireFullPaymentOnClose + ? _self.requireFullPaymentOnClose + : requireFullPaymentOnClose // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_customer_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_customer_dto.g.dart new file mode 100644 index 00000000..ab7f00ed --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_customer_dto.g.dart @@ -0,0 +1,24 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_customer_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdateCustomerDto _$UpdateCustomerDtoFromJson(Map json) => + _UpdateCustomerDto( + name: json['name'] as String?, + cuit: json['cuit'] as String?, + address: json['address'] as String?, + requireFullPaymentOnClose: json['require_full_payment_on_close'] as bool?, + ); + +Map _$UpdateCustomerDtoToJson(_UpdateCustomerDto instance) => + { + if (instance.name case final value?) 'name': value, + if (instance.cuit case final value?) 'cuit': value, + if (instance.address case final value?) 'address': value, + if (instance.requireFullPaymentOnClose case final value?) + 'require_full_payment_on_close': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_order_command.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_command.dart new file mode 100644 index 00000000..d979da6c --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_command.dart @@ -0,0 +1,45 @@ +/// UpdateOrderCommand +/// { +/// "properties": { +/// "customer_id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "lines": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/OrderLineChange" +/// }, +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "additionalProperties": false +/// } +library update_order_command; + +import 'exports.dart'; +part 'update_order_command.freezed.dart'; +part 'update_order_command.g.dart'; // UpdateOrderCommand + +@freezed +abstract class UpdateOrderCommand with _$UpdateOrderCommand { + const UpdateOrderCommand._(); + + @jsonSerializable + const factory UpdateOrderCommand({ + /// customerId + @JsonKey(name: UpdateOrderCommand.customerIdKey_) String? customerId, + + /// lines + @JsonKey(name: UpdateOrderCommand.linesKey_) List? lines, + }) = _UpdateOrderCommand; + + factory UpdateOrderCommand.fromJson(Map json) => + _$UpdateOrderCommandFromJson(json); + + static const String customerIdKey_ = r'customer_id'; + + static const String linesKey_ = r'lines'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_order_command.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_command.freezed.dart new file mode 100644 index 00000000..339d5392 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_command.freezed.dart @@ -0,0 +1,378 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_order_command.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateOrderCommand { + /// customerId + @JsonKey(name: UpdateOrderCommand.customerIdKey_) + String? get customerId; + + /// lines + @JsonKey(name: UpdateOrderCommand.linesKey_) + List? get lines; + + /// Create a copy of UpdateOrderCommand + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateOrderCommandCopyWith get copyWith => + _$UpdateOrderCommandCopyWithImpl( + this as UpdateOrderCommand, _$identity); + + /// Serializes this UpdateOrderCommand to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateOrderCommand && + (identical(other.customerId, customerId) || + other.customerId == customerId) && + const DeepCollectionEquality().equals(other.lines, lines)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, customerId, const DeepCollectionEquality().hash(lines)); + + @override + String toString() { + return 'UpdateOrderCommand(customerId: $customerId, lines: $lines)'; + } +} + +/// @nodoc +abstract mixin class $UpdateOrderCommandCopyWith<$Res> { + factory $UpdateOrderCommandCopyWith( + UpdateOrderCommand value, $Res Function(UpdateOrderCommand) _then) = + _$UpdateOrderCommandCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdateOrderCommand.customerIdKey_) String? customerId, + @JsonKey(name: UpdateOrderCommand.linesKey_) + List? lines}); +} + +/// @nodoc +class _$UpdateOrderCommandCopyWithImpl<$Res> + implements $UpdateOrderCommandCopyWith<$Res> { + _$UpdateOrderCommandCopyWithImpl(this._self, this._then); + + final UpdateOrderCommand _self; + final $Res Function(UpdateOrderCommand) _then; + + /// Create a copy of UpdateOrderCommand + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? customerId = freezed, + Object? lines = freezed, + }) { + return _then(_self.copyWith( + customerId: freezed == customerId + ? _self.customerId + : customerId // ignore: cast_nullable_to_non_nullable + as String?, + lines: freezed == lines + ? _self.lines + : lines // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdateOrderCommand]. +extension UpdateOrderCommandPatterns on UpdateOrderCommand { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdateOrderCommand value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateOrderCommand() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdateOrderCommand value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdateOrderCommand(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdateOrderCommand value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdateOrderCommand() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UpdateOrderCommand.customerIdKey_) + String? customerId, + @JsonKey(name: UpdateOrderCommand.linesKey_) + List? lines)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateOrderCommand() when $default != null: + return $default(_that.customerId, _that.lines); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UpdateOrderCommand.customerIdKey_) + String? customerId, + @JsonKey(name: UpdateOrderCommand.linesKey_) + List? lines) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateOrderCommand(): + return $default(_that.customerId, _that.lines); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UpdateOrderCommand.customerIdKey_) + String? customerId, + @JsonKey(name: UpdateOrderCommand.linesKey_) + List? lines)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateOrderCommand() when $default != null: + return $default(_that.customerId, _that.lines); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdateOrderCommand extends UpdateOrderCommand { + const _UpdateOrderCommand( + {@JsonKey(name: UpdateOrderCommand.customerIdKey_) this.customerId, + @JsonKey(name: UpdateOrderCommand.linesKey_) + final List? lines}) + : _lines = lines, + super._(); + factory _UpdateOrderCommand.fromJson(Map json) => + _$UpdateOrderCommandFromJson(json); + + /// customerId + @override + @JsonKey(name: UpdateOrderCommand.customerIdKey_) + final String? customerId; + + /// lines + final List? _lines; + + /// lines + @override + @JsonKey(name: UpdateOrderCommand.linesKey_) + List? get lines { + final value = _lines; + if (value == null) return null; + if (_lines is EqualUnmodifiableListView) return _lines; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// Create a copy of UpdateOrderCommand + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdateOrderCommandCopyWith<_UpdateOrderCommand> get copyWith => + __$UpdateOrderCommandCopyWithImpl<_UpdateOrderCommand>(this, _$identity); + + @override + Map toJson() { + return _$UpdateOrderCommandToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdateOrderCommand && + (identical(other.customerId, customerId) || + other.customerId == customerId) && + const DeepCollectionEquality().equals(other._lines, _lines)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, customerId, const DeepCollectionEquality().hash(_lines)); + + @override + String toString() { + return 'UpdateOrderCommand(customerId: $customerId, lines: $lines)'; + } +} + +/// @nodoc +abstract mixin class _$UpdateOrderCommandCopyWith<$Res> + implements $UpdateOrderCommandCopyWith<$Res> { + factory _$UpdateOrderCommandCopyWith( + _UpdateOrderCommand value, $Res Function(_UpdateOrderCommand) _then) = + __$UpdateOrderCommandCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdateOrderCommand.customerIdKey_) String? customerId, + @JsonKey(name: UpdateOrderCommand.linesKey_) + List? lines}); +} + +/// @nodoc +class __$UpdateOrderCommandCopyWithImpl<$Res> + implements _$UpdateOrderCommandCopyWith<$Res> { + __$UpdateOrderCommandCopyWithImpl(this._self, this._then); + + final _UpdateOrderCommand _self; + final $Res Function(_UpdateOrderCommand) _then; + + /// Create a copy of UpdateOrderCommand + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? customerId = freezed, + Object? lines = freezed, + }) { + return _then(_UpdateOrderCommand( + customerId: freezed == customerId + ? _self.customerId + : customerId // ignore: cast_nullable_to_non_nullable + as String?, + lines: freezed == lines + ? _self._lines + : lines // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_order_command.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_command.g.dart new file mode 100644 index 00000000..74c6d652 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_command.g.dart @@ -0,0 +1,26 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_order_command.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdateOrderCommand _$UpdateOrderCommandFromJson(Map json) => + _UpdateOrderCommand( + customerId: json['customer_id'] as String?, + lines: (json['lines'] as List?) + ?.map((e) => const OrderLineChangeMapJsonConverter() + .fromJson(e as Map)) + .toList(), + ); + +Map _$UpdateOrderCommandToJson(_UpdateOrderCommand instance) => + { + if (instance.customerId case final value?) 'customer_id': value, + if (instance.lines + ?.map(const OrderLineChangeMapJsonConverter().toJson) + .toList() + case final value?) + 'lines': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_order_line.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_line.dart new file mode 100644 index 00000000..ce95f70b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_line.dart @@ -0,0 +1,65 @@ +/// UpdateOrderLine +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "quantity": { +/// "type": "integer", +/// "format": "int32", +/// "nullable": true +/// }, +/// "sale_price": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "type": { +/// "type": "string", +/// "default": "update" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "id", +/// "type" +/// ], +/// "additionalProperties": false +/// } +library update_order_line; + +import 'exports.dart'; +part 'update_order_line.freezed.dart'; +part 'update_order_line.g.dart'; // UpdateOrderLine + +@freezed +abstract class UpdateOrderLine with _$UpdateOrderLine { + const UpdateOrderLine._(); + + @jsonSerializable + const factory UpdateOrderLine({ + /// id + @JsonKey(name: UpdateOrderLine.idKey_) required String id, + + /// quantity + @JsonKey(name: UpdateOrderLine.quantityKey_) int? quantity, + + /// salePrice + @JsonKey(name: UpdateOrderLine.salePriceKey_) double? salePrice, + + /// type + @Default('update') @JsonKey(name: UpdateOrderLine.typeKey_) String type, + }) = _UpdateOrderLine; + + factory UpdateOrderLine.fromJson(Map json) => + _$UpdateOrderLineFromJson(json); + + static const String idKey_ = r'id'; + + static const String quantityKey_ = r'quantity'; + + static const String salePriceKey_ = r'sale_price'; + + static const String typeKey_ = r'type'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_order_line.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_line.freezed.dart new file mode 100644 index 00000000..999b71ec --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_line.freezed.dart @@ -0,0 +1,413 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_order_line.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateOrderLine { + /// id + @JsonKey(name: UpdateOrderLine.idKey_) + String get id; + + /// quantity + @JsonKey(name: UpdateOrderLine.quantityKey_) + int? get quantity; + + /// salePrice + @JsonKey(name: UpdateOrderLine.salePriceKey_) + double? get salePrice; + + /// type + @JsonKey(name: UpdateOrderLine.typeKey_) + String get type; + + /// Create a copy of UpdateOrderLine + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateOrderLineCopyWith get copyWith => + _$UpdateOrderLineCopyWithImpl( + this as UpdateOrderLine, _$identity); + + /// Serializes this UpdateOrderLine to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateOrderLine && + (identical(other.id, id) || other.id == id) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, quantity, salePrice, type); + + @override + String toString() { + return 'UpdateOrderLine(id: $id, quantity: $quantity, salePrice: $salePrice, type: $type)'; + } +} + +/// @nodoc +abstract mixin class $UpdateOrderLineCopyWith<$Res> { + factory $UpdateOrderLineCopyWith( + UpdateOrderLine value, $Res Function(UpdateOrderLine) _then) = + _$UpdateOrderLineCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdateOrderLine.idKey_) String id, + @JsonKey(name: UpdateOrderLine.quantityKey_) int? quantity, + @JsonKey(name: UpdateOrderLine.salePriceKey_) double? salePrice, + @JsonKey(name: UpdateOrderLine.typeKey_) String type}); +} + +/// @nodoc +class _$UpdateOrderLineCopyWithImpl<$Res> + implements $UpdateOrderLineCopyWith<$Res> { + _$UpdateOrderLineCopyWithImpl(this._self, this._then); + + final UpdateOrderLine _self; + final $Res Function(UpdateOrderLine) _then; + + /// Create a copy of UpdateOrderLine + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? quantity = freezed, + Object? salePrice = freezed, + Object? type = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + quantity: freezed == quantity + ? _self.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int?, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdateOrderLine]. +extension UpdateOrderLinePatterns on UpdateOrderLine { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdateOrderLine value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateOrderLine() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdateOrderLine value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdateOrderLine(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdateOrderLine value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdateOrderLine() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UpdateOrderLine.idKey_) String id, + @JsonKey(name: UpdateOrderLine.quantityKey_) int? quantity, + @JsonKey(name: UpdateOrderLine.salePriceKey_) double? salePrice, + @JsonKey(name: UpdateOrderLine.typeKey_) String type)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateOrderLine() when $default != null: + return $default(_that.id, _that.quantity, _that.salePrice, _that.type); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UpdateOrderLine.idKey_) String id, + @JsonKey(name: UpdateOrderLine.quantityKey_) int? quantity, + @JsonKey(name: UpdateOrderLine.salePriceKey_) double? salePrice, + @JsonKey(name: UpdateOrderLine.typeKey_) String type) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateOrderLine(): + return $default(_that.id, _that.quantity, _that.salePrice, _that.type); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UpdateOrderLine.idKey_) String id, + @JsonKey(name: UpdateOrderLine.quantityKey_) int? quantity, + @JsonKey(name: UpdateOrderLine.salePriceKey_) double? salePrice, + @JsonKey(name: UpdateOrderLine.typeKey_) String type)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateOrderLine() when $default != null: + return $default(_that.id, _that.quantity, _that.salePrice, _that.type); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdateOrderLine extends UpdateOrderLine { + const _UpdateOrderLine( + {@JsonKey(name: UpdateOrderLine.idKey_) required this.id, + @JsonKey(name: UpdateOrderLine.quantityKey_) this.quantity, + @JsonKey(name: UpdateOrderLine.salePriceKey_) this.salePrice, + @JsonKey(name: UpdateOrderLine.typeKey_) this.type = 'update'}) + : super._(); + factory _UpdateOrderLine.fromJson(Map json) => + _$UpdateOrderLineFromJson(json); + + /// id + @override + @JsonKey(name: UpdateOrderLine.idKey_) + final String id; + + /// quantity + @override + @JsonKey(name: UpdateOrderLine.quantityKey_) + final int? quantity; + + /// salePrice + @override + @JsonKey(name: UpdateOrderLine.salePriceKey_) + final double? salePrice; + + /// type + @override + @JsonKey(name: UpdateOrderLine.typeKey_) + final String type; + + /// Create a copy of UpdateOrderLine + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdateOrderLineCopyWith<_UpdateOrderLine> get copyWith => + __$UpdateOrderLineCopyWithImpl<_UpdateOrderLine>(this, _$identity); + + @override + Map toJson() { + return _$UpdateOrderLineToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdateOrderLine && + (identical(other.id, id) || other.id == id) && + (identical(other.quantity, quantity) || + other.quantity == quantity) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, quantity, salePrice, type); + + @override + String toString() { + return 'UpdateOrderLine(id: $id, quantity: $quantity, salePrice: $salePrice, type: $type)'; + } +} + +/// @nodoc +abstract mixin class _$UpdateOrderLineCopyWith<$Res> + implements $UpdateOrderLineCopyWith<$Res> { + factory _$UpdateOrderLineCopyWith( + _UpdateOrderLine value, $Res Function(_UpdateOrderLine) _then) = + __$UpdateOrderLineCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdateOrderLine.idKey_) String id, + @JsonKey(name: UpdateOrderLine.quantityKey_) int? quantity, + @JsonKey(name: UpdateOrderLine.salePriceKey_) double? salePrice, + @JsonKey(name: UpdateOrderLine.typeKey_) String type}); +} + +/// @nodoc +class __$UpdateOrderLineCopyWithImpl<$Res> + implements _$UpdateOrderLineCopyWith<$Res> { + __$UpdateOrderLineCopyWithImpl(this._self, this._then); + + final _UpdateOrderLine _self; + final $Res Function(_UpdateOrderLine) _then; + + /// Create a copy of UpdateOrderLine + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? quantity = freezed, + Object? salePrice = freezed, + Object? type = null, + }) { + return _then(_UpdateOrderLine( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + quantity: freezed == quantity + ? _self.quantity + : quantity // ignore: cast_nullable_to_non_nullable + as int?, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + type: null == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_order_line.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_line.g.dart new file mode 100644 index 00000000..ebd6d795 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_order_line.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_order_line.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdateOrderLine _$UpdateOrderLineFromJson(Map json) => + _UpdateOrderLine( + id: json['id'] as String, + quantity: (json['quantity'] as num?)?.toInt(), + salePrice: (json['sale_price'] as num?)?.toDouble(), + type: json['type'] as String? ?? 'update', + ); + +Map _$UpdateOrderLineToJson(_UpdateOrderLine instance) => + { + 'id': instance.id, + if (instance.quantity case final value?) 'quantity': value, + if (instance.salePrice case final value?) 'sale_price': value, + 'type': instance.type, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_dto.dart new file mode 100644 index 00000000..335c815f --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_dto.dart @@ -0,0 +1,88 @@ +/// UpdatePriceListDto +/// { +/// "properties": { +/// "name": { +/// "type": "string", +/// "nullable": true +/// }, +/// "enabled": { +/// "type": "boolean", +/// "nullable": true +/// }, +/// "valid_from": { +/// "type": "string", +/// "format": "date-time", +/// "nullable": true +/// }, +/// "valid_to": { +/// "type": "string", +/// "format": "date-time", +/// "nullable": true +/// }, +/// "sale_point_ids": { +/// "type": "array", +/// "items": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "nullable": true +/// }, +/// "policies": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/UpdatePriceListPolicyDto" +/// }, +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "additionalProperties": false +/// } +library update_price_list_dto; + +import 'exports.dart'; +part 'update_price_list_dto.freezed.dart'; +part 'update_price_list_dto.g.dart'; // UpdatePriceListDto + +@freezed +abstract class UpdatePriceListDto with _$UpdatePriceListDto { + const UpdatePriceListDto._(); + + @jsonSerializable + const factory UpdatePriceListDto({ + /// name + @JsonKey(name: UpdatePriceListDto.nameKey_) String? name, + + /// enabled + @JsonKey(name: UpdatePriceListDto.enabledKey_) bool? enabled, + + /// validFrom + @JsonKey(name: UpdatePriceListDto.validFromKey_) DateTime? validFrom, + + /// validTo + @JsonKey(name: UpdatePriceListDto.validToKey_) DateTime? validTo, + + /// salePointIds + @JsonKey(name: UpdatePriceListDto.salePointIdsKey_) + List? salePointIds, + + /// policies + @JsonKey(name: UpdatePriceListDto.policiesKey_) + List? policies, + }) = _UpdatePriceListDto; + + factory UpdatePriceListDto.fromJson(Map json) => + _$UpdatePriceListDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String enabledKey_ = r'enabled'; + + static const String validFromKey_ = r'valid_from'; + + static const String validToKey_ = r'valid_to'; + + static const String salePointIdsKey_ = r'sale_point_ids'; + + static const String policiesKey_ = r'policies'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_dto.freezed.dart new file mode 100644 index 00000000..7b931cf8 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_dto.freezed.dart @@ -0,0 +1,519 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_price_list_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdatePriceListDto { + /// name + @JsonKey(name: UpdatePriceListDto.nameKey_) + String? get name; + + /// enabled + @JsonKey(name: UpdatePriceListDto.enabledKey_) + bool? get enabled; + + /// validFrom + @JsonKey(name: UpdatePriceListDto.validFromKey_) + DateTime? get validFrom; + + /// validTo + @JsonKey(name: UpdatePriceListDto.validToKey_) + DateTime? get validTo; + + /// salePointIds + @JsonKey(name: UpdatePriceListDto.salePointIdsKey_) + List? get salePointIds; + + /// policies + @JsonKey(name: UpdatePriceListDto.policiesKey_) + List? get policies; + + /// Create a copy of UpdatePriceListDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdatePriceListDtoCopyWith get copyWith => + _$UpdatePriceListDtoCopyWithImpl( + this as UpdatePriceListDto, _$identity); + + /// Serializes this UpdatePriceListDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdatePriceListDto && + (identical(other.name, name) || other.name == name) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.validFrom, validFrom) || + other.validFrom == validFrom) && + (identical(other.validTo, validTo) || other.validTo == validTo) && + const DeepCollectionEquality() + .equals(other.salePointIds, salePointIds) && + const DeepCollectionEquality().equals(other.policies, policies)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + name, + enabled, + validFrom, + validTo, + const DeepCollectionEquality().hash(salePointIds), + const DeepCollectionEquality().hash(policies)); + + @override + String toString() { + return 'UpdatePriceListDto(name: $name, enabled: $enabled, validFrom: $validFrom, validTo: $validTo, salePointIds: $salePointIds, policies: $policies)'; + } +} + +/// @nodoc +abstract mixin class $UpdatePriceListDtoCopyWith<$Res> { + factory $UpdatePriceListDtoCopyWith( + UpdatePriceListDto value, $Res Function(UpdatePriceListDto) _then) = + _$UpdatePriceListDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdatePriceListDto.nameKey_) String? name, + @JsonKey(name: UpdatePriceListDto.enabledKey_) bool? enabled, + @JsonKey(name: UpdatePriceListDto.validFromKey_) DateTime? validFrom, + @JsonKey(name: UpdatePriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: UpdatePriceListDto.salePointIdsKey_) + List? salePointIds, + @JsonKey(name: UpdatePriceListDto.policiesKey_) + List? policies}); +} + +/// @nodoc +class _$UpdatePriceListDtoCopyWithImpl<$Res> + implements $UpdatePriceListDtoCopyWith<$Res> { + _$UpdatePriceListDtoCopyWithImpl(this._self, this._then); + + final UpdatePriceListDto _self; + final $Res Function(UpdatePriceListDto) _then; + + /// Create a copy of UpdatePriceListDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = freezed, + Object? enabled = freezed, + Object? validFrom = freezed, + Object? validTo = freezed, + Object? salePointIds = freezed, + Object? policies = freezed, + }) { + return _then(_self.copyWith( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + enabled: freezed == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + validFrom: freezed == validFrom + ? _self.validFrom + : validFrom // ignore: cast_nullable_to_non_nullable + as DateTime?, + validTo: freezed == validTo + ? _self.validTo + : validTo // ignore: cast_nullable_to_non_nullable + as DateTime?, + salePointIds: freezed == salePointIds + ? _self.salePointIds + : salePointIds // ignore: cast_nullable_to_non_nullable + as List?, + policies: freezed == policies + ? _self.policies + : policies // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdatePriceListDto]. +extension UpdatePriceListDtoPatterns on UpdatePriceListDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdatePriceListDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdatePriceListDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdatePriceListDto value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdatePriceListDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UpdatePriceListDto.nameKey_) String? name, + @JsonKey(name: UpdatePriceListDto.enabledKey_) bool? enabled, + @JsonKey(name: UpdatePriceListDto.validFromKey_) + DateTime? validFrom, + @JsonKey(name: UpdatePriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: UpdatePriceListDto.salePointIdsKey_) + List? salePointIds, + @JsonKey(name: UpdatePriceListDto.policiesKey_) + List? policies)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdatePriceListDto() when $default != null: + return $default(_that.name, _that.enabled, _that.validFrom, + _that.validTo, _that.salePointIds, _that.policies); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UpdatePriceListDto.nameKey_) String? name, + @JsonKey(name: UpdatePriceListDto.enabledKey_) bool? enabled, + @JsonKey(name: UpdatePriceListDto.validFromKey_) + DateTime? validFrom, + @JsonKey(name: UpdatePriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: UpdatePriceListDto.salePointIdsKey_) + List? salePointIds, + @JsonKey(name: UpdatePriceListDto.policiesKey_) + List? policies) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListDto(): + return $default(_that.name, _that.enabled, _that.validFrom, + _that.validTo, _that.salePointIds, _that.policies); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UpdatePriceListDto.nameKey_) String? name, + @JsonKey(name: UpdatePriceListDto.enabledKey_) bool? enabled, + @JsonKey(name: UpdatePriceListDto.validFromKey_) + DateTime? validFrom, + @JsonKey(name: UpdatePriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: UpdatePriceListDto.salePointIdsKey_) + List? salePointIds, + @JsonKey(name: UpdatePriceListDto.policiesKey_) + List? policies)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListDto() when $default != null: + return $default(_that.name, _that.enabled, _that.validFrom, + _that.validTo, _that.salePointIds, _that.policies); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdatePriceListDto extends UpdatePriceListDto { + const _UpdatePriceListDto( + {@JsonKey(name: UpdatePriceListDto.nameKey_) this.name, + @JsonKey(name: UpdatePriceListDto.enabledKey_) this.enabled, + @JsonKey(name: UpdatePriceListDto.validFromKey_) this.validFrom, + @JsonKey(name: UpdatePriceListDto.validToKey_) this.validTo, + @JsonKey(name: UpdatePriceListDto.salePointIdsKey_) + final List? salePointIds, + @JsonKey(name: UpdatePriceListDto.policiesKey_) + final List? policies}) + : _salePointIds = salePointIds, + _policies = policies, + super._(); + factory _UpdatePriceListDto.fromJson(Map json) => + _$UpdatePriceListDtoFromJson(json); + + /// name + @override + @JsonKey(name: UpdatePriceListDto.nameKey_) + final String? name; + + /// enabled + @override + @JsonKey(name: UpdatePriceListDto.enabledKey_) + final bool? enabled; + + /// validFrom + @override + @JsonKey(name: UpdatePriceListDto.validFromKey_) + final DateTime? validFrom; + + /// validTo + @override + @JsonKey(name: UpdatePriceListDto.validToKey_) + final DateTime? validTo; + + /// salePointIds + final List? _salePointIds; + + /// salePointIds + @override + @JsonKey(name: UpdatePriceListDto.salePointIdsKey_) + List? get salePointIds { + final value = _salePointIds; + if (value == null) return null; + if (_salePointIds is EqualUnmodifiableListView) return _salePointIds; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// policies + final List? _policies; + + /// policies + @override + @JsonKey(name: UpdatePriceListDto.policiesKey_) + List? get policies { + final value = _policies; + if (value == null) return null; + if (_policies is EqualUnmodifiableListView) return _policies; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// Create a copy of UpdatePriceListDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdatePriceListDtoCopyWith<_UpdatePriceListDto> get copyWith => + __$UpdatePriceListDtoCopyWithImpl<_UpdatePriceListDto>(this, _$identity); + + @override + Map toJson() { + return _$UpdatePriceListDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdatePriceListDto && + (identical(other.name, name) || other.name == name) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.validFrom, validFrom) || + other.validFrom == validFrom) && + (identical(other.validTo, validTo) || other.validTo == validTo) && + const DeepCollectionEquality() + .equals(other._salePointIds, _salePointIds) && + const DeepCollectionEquality().equals(other._policies, _policies)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + name, + enabled, + validFrom, + validTo, + const DeepCollectionEquality().hash(_salePointIds), + const DeepCollectionEquality().hash(_policies)); + + @override + String toString() { + return 'UpdatePriceListDto(name: $name, enabled: $enabled, validFrom: $validFrom, validTo: $validTo, salePointIds: $salePointIds, policies: $policies)'; + } +} + +/// @nodoc +abstract mixin class _$UpdatePriceListDtoCopyWith<$Res> + implements $UpdatePriceListDtoCopyWith<$Res> { + factory _$UpdatePriceListDtoCopyWith( + _UpdatePriceListDto value, $Res Function(_UpdatePriceListDto) _then) = + __$UpdatePriceListDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdatePriceListDto.nameKey_) String? name, + @JsonKey(name: UpdatePriceListDto.enabledKey_) bool? enabled, + @JsonKey(name: UpdatePriceListDto.validFromKey_) DateTime? validFrom, + @JsonKey(name: UpdatePriceListDto.validToKey_) DateTime? validTo, + @JsonKey(name: UpdatePriceListDto.salePointIdsKey_) + List? salePointIds, + @JsonKey(name: UpdatePriceListDto.policiesKey_) + List? policies}); +} + +/// @nodoc +class __$UpdatePriceListDtoCopyWithImpl<$Res> + implements _$UpdatePriceListDtoCopyWith<$Res> { + __$UpdatePriceListDtoCopyWithImpl(this._self, this._then); + + final _UpdatePriceListDto _self; + final $Res Function(_UpdatePriceListDto) _then; + + /// Create a copy of UpdatePriceListDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = freezed, + Object? enabled = freezed, + Object? validFrom = freezed, + Object? validTo = freezed, + Object? salePointIds = freezed, + Object? policies = freezed, + }) { + return _then(_UpdatePriceListDto( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + enabled: freezed == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + validFrom: freezed == validFrom + ? _self.validFrom + : validFrom // ignore: cast_nullable_to_non_nullable + as DateTime?, + validTo: freezed == validTo + ? _self.validTo + : validTo // ignore: cast_nullable_to_non_nullable + as DateTime?, + salePointIds: freezed == salePointIds + ? _self._salePointIds + : salePointIds // ignore: cast_nullable_to_non_nullable + as List?, + policies: freezed == policies + ? _self._policies + : policies // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_dto.g.dart new file mode 100644 index 00000000..d616dd31 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_dto.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_price_list_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdatePriceListDto _$UpdatePriceListDtoFromJson(Map json) => + _UpdatePriceListDto( + name: json['name'] as String?, + enabled: json['enabled'] as bool?, + validFrom: json['valid_from'] == null + ? null + : DateTime.parse(json['valid_from'] as String), + validTo: json['valid_to'] == null + ? null + : DateTime.parse(json['valid_to'] as String), + salePointIds: (json['sale_point_ids'] as List?) + ?.map((e) => e as String) + .toList(), + policies: (json['policies'] as List?) + ?.map((e) => + UpdatePriceListPolicyDto.fromJson(e as Map)) + .toList(), + ); + +Map _$UpdatePriceListDtoToJson(_UpdatePriceListDto instance) => + { + if (instance.name case final value?) 'name': value, + if (instance.enabled case final value?) 'enabled': value, + if (instance.validFrom?.toIso8601String() case final value?) + 'valid_from': value, + if (instance.validTo?.toIso8601String() case final value?) + 'valid_to': value, + if (instance.salePointIds case final value?) 'sale_point_ids': value, + if (instance.policies?.map((e) => e.toJson()).toList() case final value?) + 'policies': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_dto.dart new file mode 100644 index 00000000..e33694b5 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_dto.dart @@ -0,0 +1,91 @@ +/// UpdatePriceListPolicyDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "policy_type": { +/// "oneOf": [ +/// { +/// "$ref": "#/components/schemas/PriceListPolicyPolicyType" +/// }, +/// { +/// "type": "null" +/// } +/// ] +/// }, +/// "policy_type_value": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "enabled": { +/// "type": "boolean", +/// "nullable": true +/// }, +/// "notes": { +/// "type": "string", +/// "nullable": true +/// }, +/// "items": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/UpdatePriceListPolicyItemDto" +/// }, +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "additionalProperties": false +/// } +library update_price_list_policy_dto; + +import 'exports.dart'; +part 'update_price_list_policy_dto.freezed.dart'; +part 'update_price_list_policy_dto.g.dart'; // UpdatePriceListPolicyDto + +@freezed +abstract class UpdatePriceListPolicyDto with _$UpdatePriceListPolicyDto { + const UpdatePriceListPolicyDto._(); + + @jsonSerializable + const factory UpdatePriceListPolicyDto({ + /// id + @JsonKey(name: UpdatePriceListPolicyDto.idKey_) String? id, + + /// policyType + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType? policyType, + + /// policyTypeValue + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeValueKey_) + double? policyTypeValue, + + /// enabled + @JsonKey(name: UpdatePriceListPolicyDto.enabledKey_) bool? enabled, + + /// notes + @JsonKey(name: UpdatePriceListPolicyDto.notesKey_) String? notes, + + /// items + @JsonKey(name: UpdatePriceListPolicyDto.itemsKey_) + List? items, + }) = _UpdatePriceListPolicyDto; + + factory UpdatePriceListPolicyDto.fromJson(Map json) => + _$UpdatePriceListPolicyDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String policyTypeKey_ = r'policy_type'; + + static const String policyTypeValueKey_ = r'policy_type_value'; + + static const String enabledKey_ = r'enabled'; + + static const String notesKey_ = r'notes'; + + static const String itemsKey_ = r'items'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_dto.freezed.dart new file mode 100644 index 00000000..6fc8b0b8 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_dto.freezed.dart @@ -0,0 +1,500 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_price_list_policy_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdatePriceListPolicyDto { + /// id + @JsonKey(name: UpdatePriceListPolicyDto.idKey_) + String? get id; + + /// policyType + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType? get policyType; + + /// policyTypeValue + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeValueKey_) + double? get policyTypeValue; + + /// enabled + @JsonKey(name: UpdatePriceListPolicyDto.enabledKey_) + bool? get enabled; + + /// notes + @JsonKey(name: UpdatePriceListPolicyDto.notesKey_) + String? get notes; + + /// items + @JsonKey(name: UpdatePriceListPolicyDto.itemsKey_) + List? get items; + + /// Create a copy of UpdatePriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdatePriceListPolicyDtoCopyWith get copyWith => + _$UpdatePriceListPolicyDtoCopyWithImpl( + this as UpdatePriceListPolicyDto, _$identity); + + /// Serializes this UpdatePriceListPolicyDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdatePriceListPolicyDto && + (identical(other.id, id) || other.id == id) && + (identical(other.policyType, policyType) || + other.policyType == policyType) && + (identical(other.policyTypeValue, policyTypeValue) || + other.policyTypeValue == policyTypeValue) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.notes, notes) || other.notes == notes) && + const DeepCollectionEquality().equals(other.items, items)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, policyType, policyTypeValue, + enabled, notes, const DeepCollectionEquality().hash(items)); + + @override + String toString() { + return 'UpdatePriceListPolicyDto(id: $id, policyType: $policyType, policyTypeValue: $policyTypeValue, enabled: $enabled, notes: $notes, items: $items)'; + } +} + +/// @nodoc +abstract mixin class $UpdatePriceListPolicyDtoCopyWith<$Res> { + factory $UpdatePriceListPolicyDtoCopyWith(UpdatePriceListPolicyDto value, + $Res Function(UpdatePriceListPolicyDto) _then) = + _$UpdatePriceListPolicyDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdatePriceListPolicyDto.idKey_) String? id, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType? policyType, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeValueKey_) + double? policyTypeValue, + @JsonKey(name: UpdatePriceListPolicyDto.enabledKey_) bool? enabled, + @JsonKey(name: UpdatePriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: UpdatePriceListPolicyDto.itemsKey_) + List? items}); +} + +/// @nodoc +class _$UpdatePriceListPolicyDtoCopyWithImpl<$Res> + implements $UpdatePriceListPolicyDtoCopyWith<$Res> { + _$UpdatePriceListPolicyDtoCopyWithImpl(this._self, this._then); + + final UpdatePriceListPolicyDto _self; + final $Res Function(UpdatePriceListPolicyDto) _then; + + /// Create a copy of UpdatePriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? policyType = freezed, + Object? policyTypeValue = freezed, + Object? enabled = freezed, + Object? notes = freezed, + Object? items = freezed, + }) { + return _then(_self.copyWith( + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + policyType: freezed == policyType + ? _self.policyType + : policyType // ignore: cast_nullable_to_non_nullable + as PriceListPolicyPolicyType?, + policyTypeValue: freezed == policyTypeValue + ? _self.policyTypeValue + : policyTypeValue // ignore: cast_nullable_to_non_nullable + as double?, + enabled: freezed == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + items: freezed == items + ? _self.items + : items // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdatePriceListPolicyDto]. +extension UpdatePriceListPolicyDtoPatterns on UpdatePriceListPolicyDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdatePriceListPolicyDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdatePriceListPolicyDto value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdatePriceListPolicyDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UpdatePriceListPolicyDto.idKey_) String? id, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType? policyType, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeValueKey_) + double? policyTypeValue, + @JsonKey(name: UpdatePriceListPolicyDto.enabledKey_) bool? enabled, + @JsonKey(name: UpdatePriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: UpdatePriceListPolicyDto.itemsKey_) + List? items)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyDto() when $default != null: + return $default(_that.id, _that.policyType, _that.policyTypeValue, + _that.enabled, _that.notes, _that.items); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UpdatePriceListPolicyDto.idKey_) String? id, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType? policyType, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeValueKey_) + double? policyTypeValue, + @JsonKey(name: UpdatePriceListPolicyDto.enabledKey_) bool? enabled, + @JsonKey(name: UpdatePriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: UpdatePriceListPolicyDto.itemsKey_) + List? items) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyDto(): + return $default(_that.id, _that.policyType, _that.policyTypeValue, + _that.enabled, _that.notes, _that.items); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UpdatePriceListPolicyDto.idKey_) String? id, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType? policyType, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeValueKey_) + double? policyTypeValue, + @JsonKey(name: UpdatePriceListPolicyDto.enabledKey_) bool? enabled, + @JsonKey(name: UpdatePriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: UpdatePriceListPolicyDto.itemsKey_) + List? items)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyDto() when $default != null: + return $default(_that.id, _that.policyType, _that.policyTypeValue, + _that.enabled, _that.notes, _that.items); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdatePriceListPolicyDto extends UpdatePriceListPolicyDto { + const _UpdatePriceListPolicyDto( + {@JsonKey(name: UpdatePriceListPolicyDto.idKey_) this.id, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeKey_) this.policyType, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeValueKey_) + this.policyTypeValue, + @JsonKey(name: UpdatePriceListPolicyDto.enabledKey_) this.enabled, + @JsonKey(name: UpdatePriceListPolicyDto.notesKey_) this.notes, + @JsonKey(name: UpdatePriceListPolicyDto.itemsKey_) + final List? items}) + : _items = items, + super._(); + factory _UpdatePriceListPolicyDto.fromJson(Map json) => + _$UpdatePriceListPolicyDtoFromJson(json); + + /// id + @override + @JsonKey(name: UpdatePriceListPolicyDto.idKey_) + final String? id; + + /// policyType + @override + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeKey_) + final PriceListPolicyPolicyType? policyType; + + /// policyTypeValue + @override + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeValueKey_) + final double? policyTypeValue; + + /// enabled + @override + @JsonKey(name: UpdatePriceListPolicyDto.enabledKey_) + final bool? enabled; + + /// notes + @override + @JsonKey(name: UpdatePriceListPolicyDto.notesKey_) + final String? notes; + + /// items + final List? _items; + + /// items + @override + @JsonKey(name: UpdatePriceListPolicyDto.itemsKey_) + List? get items { + final value = _items; + if (value == null) return null; + if (_items is EqualUnmodifiableListView) return _items; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// Create a copy of UpdatePriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdatePriceListPolicyDtoCopyWith<_UpdatePriceListPolicyDto> get copyWith => + __$UpdatePriceListPolicyDtoCopyWithImpl<_UpdatePriceListPolicyDto>( + this, _$identity); + + @override + Map toJson() { + return _$UpdatePriceListPolicyDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdatePriceListPolicyDto && + (identical(other.id, id) || other.id == id) && + (identical(other.policyType, policyType) || + other.policyType == policyType) && + (identical(other.policyTypeValue, policyTypeValue) || + other.policyTypeValue == policyTypeValue) && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.notes, notes) || other.notes == notes) && + const DeepCollectionEquality().equals(other._items, _items)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, policyType, policyTypeValue, + enabled, notes, const DeepCollectionEquality().hash(_items)); + + @override + String toString() { + return 'UpdatePriceListPolicyDto(id: $id, policyType: $policyType, policyTypeValue: $policyTypeValue, enabled: $enabled, notes: $notes, items: $items)'; + } +} + +/// @nodoc +abstract mixin class _$UpdatePriceListPolicyDtoCopyWith<$Res> + implements $UpdatePriceListPolicyDtoCopyWith<$Res> { + factory _$UpdatePriceListPolicyDtoCopyWith(_UpdatePriceListPolicyDto value, + $Res Function(_UpdatePriceListPolicyDto) _then) = + __$UpdatePriceListPolicyDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdatePriceListPolicyDto.idKey_) String? id, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeKey_) + PriceListPolicyPolicyType? policyType, + @JsonKey(name: UpdatePriceListPolicyDto.policyTypeValueKey_) + double? policyTypeValue, + @JsonKey(name: UpdatePriceListPolicyDto.enabledKey_) bool? enabled, + @JsonKey(name: UpdatePriceListPolicyDto.notesKey_) String? notes, + @JsonKey(name: UpdatePriceListPolicyDto.itemsKey_) + List? items}); +} + +/// @nodoc +class __$UpdatePriceListPolicyDtoCopyWithImpl<$Res> + implements _$UpdatePriceListPolicyDtoCopyWith<$Res> { + __$UpdatePriceListPolicyDtoCopyWithImpl(this._self, this._then); + + final _UpdatePriceListPolicyDto _self; + final $Res Function(_UpdatePriceListPolicyDto) _then; + + /// Create a copy of UpdatePriceListPolicyDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = freezed, + Object? policyType = freezed, + Object? policyTypeValue = freezed, + Object? enabled = freezed, + Object? notes = freezed, + Object? items = freezed, + }) { + return _then(_UpdatePriceListPolicyDto( + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + policyType: freezed == policyType + ? _self.policyType + : policyType // ignore: cast_nullable_to_non_nullable + as PriceListPolicyPolicyType?, + policyTypeValue: freezed == policyTypeValue + ? _self.policyTypeValue + : policyTypeValue // ignore: cast_nullable_to_non_nullable + as double?, + enabled: freezed == enabled + ? _self.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + notes: freezed == notes + ? _self.notes + : notes // ignore: cast_nullable_to_non_nullable + as String?, + items: freezed == items + ? _self._items + : items // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_dto.g.dart new file mode 100644 index 00000000..8c4618b9 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_dto.g.dart @@ -0,0 +1,36 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_price_list_policy_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdatePriceListPolicyDto _$UpdatePriceListPolicyDtoFromJson( + Map json) => + _UpdatePriceListPolicyDto( + id: json['id'] as String?, + policyType: json['policy_type'] == null + ? null + : PriceListPolicyPolicyType.fromJson(json['policy_type'] as String), + policyTypeValue: (json['policy_type_value'] as num?)?.toDouble(), + enabled: json['enabled'] as bool?, + notes: json['notes'] as String?, + items: (json['items'] as List?) + ?.map((e) => + UpdatePriceListPolicyItemDto.fromJson(e as Map)) + .toList(), + ); + +Map _$UpdatePriceListPolicyDtoToJson( + _UpdatePriceListPolicyDto instance) => + { + if (instance.id case final value?) 'id': value, + if (instance.policyType?.toJson() case final value?) 'policy_type': value, + if (instance.policyTypeValue case final value?) + 'policy_type_value': value, + if (instance.enabled case final value?) 'enabled': value, + if (instance.notes case final value?) 'notes': value, + if (instance.items?.map((e) => e.toJson()).toList() case final value?) + 'items': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_item_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_item_dto.dart new file mode 100644 index 00000000..f155ff3c --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_item_dto.dart @@ -0,0 +1,48 @@ +/// UpdatePriceListPolicyItemDto +/// { +/// "properties": { +/// "product_id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "product_presentation_id": { +/// "type": "string", +/// "format": "uuid" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "product_id", +/// "product_presentation_id" +/// ], +/// "additionalProperties": false +/// } +library update_price_list_policy_item_dto; + +import 'exports.dart'; +part 'update_price_list_policy_item_dto.freezed.dart'; +part 'update_price_list_policy_item_dto.g.dart'; // UpdatePriceListPolicyItemDto + +@freezed +abstract class UpdatePriceListPolicyItemDto + with _$UpdatePriceListPolicyItemDto { + const UpdatePriceListPolicyItemDto._(); + + @jsonSerializable + const factory UpdatePriceListPolicyItemDto({ + /// productId + @JsonKey(name: UpdatePriceListPolicyItemDto.productIdKey_) + required String productId, + + /// productPresentationId + @JsonKey(name: UpdatePriceListPolicyItemDto.productPresentationIdKey_) + required String productPresentationId, + }) = _UpdatePriceListPolicyItemDto; + + factory UpdatePriceListPolicyItemDto.fromJson(Map json) => + _$UpdatePriceListPolicyItemDtoFromJson(json); + + static const String productIdKey_ = r'product_id'; + + static const String productPresentationIdKey_ = r'product_presentation_id'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_item_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_item_dto.freezed.dart new file mode 100644 index 00000000..d049ba6b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_item_dto.freezed.dart @@ -0,0 +1,380 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_price_list_policy_item_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdatePriceListPolicyItemDto { + /// productId + @JsonKey(name: UpdatePriceListPolicyItemDto.productIdKey_) + String get productId; + + /// productPresentationId + @JsonKey(name: UpdatePriceListPolicyItemDto.productPresentationIdKey_) + String get productPresentationId; + + /// Create a copy of UpdatePriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdatePriceListPolicyItemDtoCopyWith + get copyWith => _$UpdatePriceListPolicyItemDtoCopyWithImpl< + UpdatePriceListPolicyItemDto>( + this as UpdatePriceListPolicyItemDto, _$identity); + + /// Serializes this UpdatePriceListPolicyItemDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdatePriceListPolicyItemDto && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.productPresentationId, productPresentationId) || + other.productPresentationId == productPresentationId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, productId, productPresentationId); + + @override + String toString() { + return 'UpdatePriceListPolicyItemDto(productId: $productId, productPresentationId: $productPresentationId)'; + } +} + +/// @nodoc +abstract mixin class $UpdatePriceListPolicyItemDtoCopyWith<$Res> { + factory $UpdatePriceListPolicyItemDtoCopyWith( + UpdatePriceListPolicyItemDto value, + $Res Function(UpdatePriceListPolicyItemDto) _then) = + _$UpdatePriceListPolicyItemDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdatePriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey(name: UpdatePriceListPolicyItemDto.productPresentationIdKey_) + String productPresentationId}); +} + +/// @nodoc +class _$UpdatePriceListPolicyItemDtoCopyWithImpl<$Res> + implements $UpdatePriceListPolicyItemDtoCopyWith<$Res> { + _$UpdatePriceListPolicyItemDtoCopyWithImpl(this._self, this._then); + + final UpdatePriceListPolicyItemDto _self; + final $Res Function(UpdatePriceListPolicyItemDto) _then; + + /// Create a copy of UpdatePriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? productId = null, + Object? productPresentationId = null, + }) { + return _then(_self.copyWith( + productId: null == productId + ? _self.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + productPresentationId: null == productPresentationId + ? _self.productPresentationId + : productPresentationId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdatePriceListPolicyItemDto]. +extension UpdatePriceListPolicyItemDtoPatterns on UpdatePriceListPolicyItemDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdatePriceListPolicyItemDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyItemDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdatePriceListPolicyItemDto value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyItemDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdatePriceListPolicyItemDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyItemDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UpdatePriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey( + name: UpdatePriceListPolicyItemDto.productPresentationIdKey_) + String productPresentationId)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyItemDto() when $default != null: + return $default(_that.productId, _that.productPresentationId); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UpdatePriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey( + name: UpdatePriceListPolicyItemDto.productPresentationIdKey_) + String productPresentationId) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyItemDto(): + return $default(_that.productId, _that.productPresentationId); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UpdatePriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey( + name: UpdatePriceListPolicyItemDto.productPresentationIdKey_) + String productPresentationId)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdatePriceListPolicyItemDto() when $default != null: + return $default(_that.productId, _that.productPresentationId); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdatePriceListPolicyItemDto extends UpdatePriceListPolicyItemDto { + const _UpdatePriceListPolicyItemDto( + {@JsonKey(name: UpdatePriceListPolicyItemDto.productIdKey_) + required this.productId, + @JsonKey(name: UpdatePriceListPolicyItemDto.productPresentationIdKey_) + required this.productPresentationId}) + : super._(); + factory _UpdatePriceListPolicyItemDto.fromJson(Map json) => + _$UpdatePriceListPolicyItemDtoFromJson(json); + + /// productId + @override + @JsonKey(name: UpdatePriceListPolicyItemDto.productIdKey_) + final String productId; + + /// productPresentationId + @override + @JsonKey(name: UpdatePriceListPolicyItemDto.productPresentationIdKey_) + final String productPresentationId; + + /// Create a copy of UpdatePriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdatePriceListPolicyItemDtoCopyWith<_UpdatePriceListPolicyItemDto> + get copyWith => __$UpdatePriceListPolicyItemDtoCopyWithImpl< + _UpdatePriceListPolicyItemDto>(this, _$identity); + + @override + Map toJson() { + return _$UpdatePriceListPolicyItemDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdatePriceListPolicyItemDto && + (identical(other.productId, productId) || + other.productId == productId) && + (identical(other.productPresentationId, productPresentationId) || + other.productPresentationId == productPresentationId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, productId, productPresentationId); + + @override + String toString() { + return 'UpdatePriceListPolicyItemDto(productId: $productId, productPresentationId: $productPresentationId)'; + } +} + +/// @nodoc +abstract mixin class _$UpdatePriceListPolicyItemDtoCopyWith<$Res> + implements $UpdatePriceListPolicyItemDtoCopyWith<$Res> { + factory _$UpdatePriceListPolicyItemDtoCopyWith( + _UpdatePriceListPolicyItemDto value, + $Res Function(_UpdatePriceListPolicyItemDto) _then) = + __$UpdatePriceListPolicyItemDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdatePriceListPolicyItemDto.productIdKey_) + String productId, + @JsonKey(name: UpdatePriceListPolicyItemDto.productPresentationIdKey_) + String productPresentationId}); +} + +/// @nodoc +class __$UpdatePriceListPolicyItemDtoCopyWithImpl<$Res> + implements _$UpdatePriceListPolicyItemDtoCopyWith<$Res> { + __$UpdatePriceListPolicyItemDtoCopyWithImpl(this._self, this._then); + + final _UpdatePriceListPolicyItemDto _self; + final $Res Function(_UpdatePriceListPolicyItemDto) _then; + + /// Create a copy of UpdatePriceListPolicyItemDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? productId = null, + Object? productPresentationId = null, + }) { + return _then(_UpdatePriceListPolicyItemDto( + productId: null == productId + ? _self.productId + : productId // ignore: cast_nullable_to_non_nullable + as String, + productPresentationId: null == productPresentationId + ? _self.productPresentationId + : productPresentationId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_item_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_item_dto.g.dart new file mode 100644 index 00000000..17054f6f --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_price_list_policy_item_dto.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_price_list_policy_item_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdatePriceListPolicyItemDto _$UpdatePriceListPolicyItemDtoFromJson( + Map json) => + _UpdatePriceListPolicyItemDto( + productId: json['product_id'] as String, + productPresentationId: json['product_presentation_id'] as String, + ); + +Map _$UpdatePriceListPolicyItemDtoToJson( + _UpdatePriceListPolicyItemDto instance) => + { + 'product_id': instance.productId, + 'product_presentation_id': instance.productPresentationId, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_product_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_dto.dart new file mode 100644 index 00000000..5093a5eb --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_dto.dart @@ -0,0 +1,144 @@ +/// UpdateProductDto +/// { +/// "properties": { +/// "name": { +/// "type": "string", +/// "nullable": true +/// }, +/// "category_id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "description": { +/// "type": "string", +/// "nullable": true +/// }, +/// "barcode": { +/// "type": "string", +/// "nullable": true +/// }, +/// "purchase_price": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "markup_percentage": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "sale_price": { +/// "type": "number", +/// "format": "double", +/// "nullable": true +/// }, +/// "allow_generic": { +/// "type": "boolean", +/// "nullable": true +/// }, +/// "use_boolean_stock": { +/// "type": "boolean", +/// "nullable": true +/// }, +/// "has_stock": { +/// "type": "boolean", +/// "nullable": true +/// }, +/// "variants": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/UpdateProductVariantDto" +/// }, +/// "nullable": true +/// }, +/// "presentations": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/UpdateProductPresentationDto" +/// }, +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "additionalProperties": false +/// } +library update_product_dto; + +import 'exports.dart'; +part 'update_product_dto.freezed.dart'; +part 'update_product_dto.g.dart'; // UpdateProductDto + +@freezed +abstract class UpdateProductDto with _$UpdateProductDto { + const UpdateProductDto._(); + + @jsonSerializable + const factory UpdateProductDto({ + /// name + @JsonKey(name: UpdateProductDto.nameKey_) String? name, + + /// categoryId + @JsonKey(name: UpdateProductDto.categoryIdKey_) String? categoryId, + + /// description + @JsonKey(name: UpdateProductDto.descriptionKey_) String? description, + + /// barcode + @JsonKey(name: UpdateProductDto.barcodeKey_) String? barcode, + + /// purchasePrice + @JsonKey(name: UpdateProductDto.purchasePriceKey_) double? purchasePrice, + + /// markupPercentage + @JsonKey(name: UpdateProductDto.markupPercentageKey_) + double? markupPercentage, + + /// salePrice + @JsonKey(name: UpdateProductDto.salePriceKey_) double? salePrice, + + /// allowGeneric + @JsonKey(name: UpdateProductDto.allowGenericKey_) bool? allowGeneric, + + /// useBooleanStock + @JsonKey(name: UpdateProductDto.useBooleanStockKey_) bool? useBooleanStock, + + /// hasStock + @JsonKey(name: UpdateProductDto.hasStockKey_) bool? hasStock, + + /// variants + @JsonKey(name: UpdateProductDto.variantsKey_) + List? variants, + + /// presentations + @JsonKey(name: UpdateProductDto.presentationsKey_) + List? presentations, + }) = _UpdateProductDto; + + factory UpdateProductDto.fromJson(Map json) => + _$UpdateProductDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String categoryIdKey_ = r'category_id'; + + static const String descriptionKey_ = r'description'; + + static const String barcodeKey_ = r'barcode'; + + static const String purchasePriceKey_ = r'purchase_price'; + + static const String markupPercentageKey_ = r'markup_percentage'; + + static const String salePriceKey_ = r'sale_price'; + + static const String allowGenericKey_ = r'allow_generic'; + + static const String useBooleanStockKey_ = r'use_boolean_stock'; + + static const String hasStockKey_ = r'has_stock'; + + static const String variantsKey_ = r'variants'; + + static const String presentationsKey_ = r'presentations'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_product_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_dto.freezed.dart new file mode 100644 index 00000000..1c3be7ae --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_dto.freezed.dart @@ -0,0 +1,757 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_product_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateProductDto { + /// name + @JsonKey(name: UpdateProductDto.nameKey_) + String? get name; + + /// categoryId + @JsonKey(name: UpdateProductDto.categoryIdKey_) + String? get categoryId; + + /// description + @JsonKey(name: UpdateProductDto.descriptionKey_) + String? get description; + + /// barcode + @JsonKey(name: UpdateProductDto.barcodeKey_) + String? get barcode; + + /// purchasePrice + @JsonKey(name: UpdateProductDto.purchasePriceKey_) + double? get purchasePrice; + + /// markupPercentage + @JsonKey(name: UpdateProductDto.markupPercentageKey_) + double? get markupPercentage; + + /// salePrice + @JsonKey(name: UpdateProductDto.salePriceKey_) + double? get salePrice; + + /// allowGeneric + @JsonKey(name: UpdateProductDto.allowGenericKey_) + bool? get allowGeneric; + + /// useBooleanStock + @JsonKey(name: UpdateProductDto.useBooleanStockKey_) + bool? get useBooleanStock; + + /// hasStock + @JsonKey(name: UpdateProductDto.hasStockKey_) + bool? get hasStock; + + /// variants + @JsonKey(name: UpdateProductDto.variantsKey_) + List? get variants; + + /// presentations + @JsonKey(name: UpdateProductDto.presentationsKey_) + List? get presentations; + + /// Create a copy of UpdateProductDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateProductDtoCopyWith get copyWith => + _$UpdateProductDtoCopyWithImpl( + this as UpdateProductDto, _$identity); + + /// Serializes this UpdateProductDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateProductDto && + (identical(other.name, name) || other.name == name) && + (identical(other.categoryId, categoryId) || + other.categoryId == categoryId) && + (identical(other.description, description) || + other.description == description) && + (identical(other.barcode, barcode) || other.barcode == barcode) && + (identical(other.purchasePrice, purchasePrice) || + other.purchasePrice == purchasePrice) && + (identical(other.markupPercentage, markupPercentage) || + other.markupPercentage == markupPercentage) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice) && + (identical(other.allowGeneric, allowGeneric) || + other.allowGeneric == allowGeneric) && + (identical(other.useBooleanStock, useBooleanStock) || + other.useBooleanStock == useBooleanStock) && + (identical(other.hasStock, hasStock) || + other.hasStock == hasStock) && + const DeepCollectionEquality().equals(other.variants, variants) && + const DeepCollectionEquality() + .equals(other.presentations, presentations)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + name, + categoryId, + description, + barcode, + purchasePrice, + markupPercentage, + salePrice, + allowGeneric, + useBooleanStock, + hasStock, + const DeepCollectionEquality().hash(variants), + const DeepCollectionEquality().hash(presentations)); + + @override + String toString() { + return 'UpdateProductDto(name: $name, categoryId: $categoryId, description: $description, barcode: $barcode, purchasePrice: $purchasePrice, markupPercentage: $markupPercentage, salePrice: $salePrice, allowGeneric: $allowGeneric, useBooleanStock: $useBooleanStock, hasStock: $hasStock, variants: $variants, presentations: $presentations)'; + } +} + +/// @nodoc +abstract mixin class $UpdateProductDtoCopyWith<$Res> { + factory $UpdateProductDtoCopyWith( + UpdateProductDto value, $Res Function(UpdateProductDto) _then) = + _$UpdateProductDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdateProductDto.nameKey_) String? name, + @JsonKey(name: UpdateProductDto.categoryIdKey_) String? categoryId, + @JsonKey(name: UpdateProductDto.descriptionKey_) String? description, + @JsonKey(name: UpdateProductDto.barcodeKey_) String? barcode, + @JsonKey(name: UpdateProductDto.purchasePriceKey_) double? purchasePrice, + @JsonKey(name: UpdateProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: UpdateProductDto.salePriceKey_) double? salePrice, + @JsonKey(name: UpdateProductDto.allowGenericKey_) bool? allowGeneric, + @JsonKey(name: UpdateProductDto.useBooleanStockKey_) + bool? useBooleanStock, + @JsonKey(name: UpdateProductDto.hasStockKey_) bool? hasStock, + @JsonKey(name: UpdateProductDto.variantsKey_) + List? variants, + @JsonKey(name: UpdateProductDto.presentationsKey_) + List? presentations}); +} + +/// @nodoc +class _$UpdateProductDtoCopyWithImpl<$Res> + implements $UpdateProductDtoCopyWith<$Res> { + _$UpdateProductDtoCopyWithImpl(this._self, this._then); + + final UpdateProductDto _self; + final $Res Function(UpdateProductDto) _then; + + /// Create a copy of UpdateProductDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = freezed, + Object? categoryId = freezed, + Object? description = freezed, + Object? barcode = freezed, + Object? purchasePrice = freezed, + Object? markupPercentage = freezed, + Object? salePrice = freezed, + Object? allowGeneric = freezed, + Object? useBooleanStock = freezed, + Object? hasStock = freezed, + Object? variants = freezed, + Object? presentations = freezed, + }) { + return _then(_self.copyWith( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + categoryId: freezed == categoryId + ? _self.categoryId + : categoryId // ignore: cast_nullable_to_non_nullable + as String?, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + barcode: freezed == barcode + ? _self.barcode + : barcode // ignore: cast_nullable_to_non_nullable + as String?, + purchasePrice: freezed == purchasePrice + ? _self.purchasePrice + : purchasePrice // ignore: cast_nullable_to_non_nullable + as double?, + markupPercentage: freezed == markupPercentage + ? _self.markupPercentage + : markupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + allowGeneric: freezed == allowGeneric + ? _self.allowGeneric + : allowGeneric // ignore: cast_nullable_to_non_nullable + as bool?, + useBooleanStock: freezed == useBooleanStock + ? _self.useBooleanStock + : useBooleanStock // ignore: cast_nullable_to_non_nullable + as bool?, + hasStock: freezed == hasStock + ? _self.hasStock + : hasStock // ignore: cast_nullable_to_non_nullable + as bool?, + variants: freezed == variants + ? _self.variants + : variants // ignore: cast_nullable_to_non_nullable + as List?, + presentations: freezed == presentations + ? _self.presentations + : presentations // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdateProductDto]. +extension UpdateProductDtoPatterns on UpdateProductDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdateProductDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateProductDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdateProductDto value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdateProductDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UpdateProductDto.nameKey_) String? name, + @JsonKey(name: UpdateProductDto.categoryIdKey_) String? categoryId, + @JsonKey(name: UpdateProductDto.descriptionKey_) + String? description, + @JsonKey(name: UpdateProductDto.barcodeKey_) String? barcode, + @JsonKey(name: UpdateProductDto.purchasePriceKey_) + double? purchasePrice, + @JsonKey(name: UpdateProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: UpdateProductDto.salePriceKey_) double? salePrice, + @JsonKey(name: UpdateProductDto.allowGenericKey_) + bool? allowGeneric, + @JsonKey(name: UpdateProductDto.useBooleanStockKey_) + bool? useBooleanStock, + @JsonKey(name: UpdateProductDto.hasStockKey_) bool? hasStock, + @JsonKey(name: UpdateProductDto.variantsKey_) + List? variants, + @JsonKey(name: UpdateProductDto.presentationsKey_) + List? presentations)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateProductDto() when $default != null: + return $default( + _that.name, + _that.categoryId, + _that.description, + _that.barcode, + _that.purchasePrice, + _that.markupPercentage, + _that.salePrice, + _that.allowGeneric, + _that.useBooleanStock, + _that.hasStock, + _that.variants, + _that.presentations); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UpdateProductDto.nameKey_) String? name, + @JsonKey(name: UpdateProductDto.categoryIdKey_) String? categoryId, + @JsonKey(name: UpdateProductDto.descriptionKey_) + String? description, + @JsonKey(name: UpdateProductDto.barcodeKey_) String? barcode, + @JsonKey(name: UpdateProductDto.purchasePriceKey_) + double? purchasePrice, + @JsonKey(name: UpdateProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: UpdateProductDto.salePriceKey_) double? salePrice, + @JsonKey(name: UpdateProductDto.allowGenericKey_) + bool? allowGeneric, + @JsonKey(name: UpdateProductDto.useBooleanStockKey_) + bool? useBooleanStock, + @JsonKey(name: UpdateProductDto.hasStockKey_) bool? hasStock, + @JsonKey(name: UpdateProductDto.variantsKey_) + List? variants, + @JsonKey(name: UpdateProductDto.presentationsKey_) + List? presentations) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductDto(): + return $default( + _that.name, + _that.categoryId, + _that.description, + _that.barcode, + _that.purchasePrice, + _that.markupPercentage, + _that.salePrice, + _that.allowGeneric, + _that.useBooleanStock, + _that.hasStock, + _that.variants, + _that.presentations); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UpdateProductDto.nameKey_) String? name, + @JsonKey(name: UpdateProductDto.categoryIdKey_) String? categoryId, + @JsonKey(name: UpdateProductDto.descriptionKey_) + String? description, + @JsonKey(name: UpdateProductDto.barcodeKey_) String? barcode, + @JsonKey(name: UpdateProductDto.purchasePriceKey_) + double? purchasePrice, + @JsonKey(name: UpdateProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: UpdateProductDto.salePriceKey_) double? salePrice, + @JsonKey(name: UpdateProductDto.allowGenericKey_) + bool? allowGeneric, + @JsonKey(name: UpdateProductDto.useBooleanStockKey_) + bool? useBooleanStock, + @JsonKey(name: UpdateProductDto.hasStockKey_) bool? hasStock, + @JsonKey(name: UpdateProductDto.variantsKey_) + List? variants, + @JsonKey(name: UpdateProductDto.presentationsKey_) + List? presentations)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductDto() when $default != null: + return $default( + _that.name, + _that.categoryId, + _that.description, + _that.barcode, + _that.purchasePrice, + _that.markupPercentage, + _that.salePrice, + _that.allowGeneric, + _that.useBooleanStock, + _that.hasStock, + _that.variants, + _that.presentations); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdateProductDto extends UpdateProductDto { + const _UpdateProductDto( + {@JsonKey(name: UpdateProductDto.nameKey_) this.name, + @JsonKey(name: UpdateProductDto.categoryIdKey_) this.categoryId, + @JsonKey(name: UpdateProductDto.descriptionKey_) this.description, + @JsonKey(name: UpdateProductDto.barcodeKey_) this.barcode, + @JsonKey(name: UpdateProductDto.purchasePriceKey_) this.purchasePrice, + @JsonKey(name: UpdateProductDto.markupPercentageKey_) + this.markupPercentage, + @JsonKey(name: UpdateProductDto.salePriceKey_) this.salePrice, + @JsonKey(name: UpdateProductDto.allowGenericKey_) this.allowGeneric, + @JsonKey(name: UpdateProductDto.useBooleanStockKey_) this.useBooleanStock, + @JsonKey(name: UpdateProductDto.hasStockKey_) this.hasStock, + @JsonKey(name: UpdateProductDto.variantsKey_) + final List? variants, + @JsonKey(name: UpdateProductDto.presentationsKey_) + final List? presentations}) + : _variants = variants, + _presentations = presentations, + super._(); + factory _UpdateProductDto.fromJson(Map json) => + _$UpdateProductDtoFromJson(json); + + /// name + @override + @JsonKey(name: UpdateProductDto.nameKey_) + final String? name; + + /// categoryId + @override + @JsonKey(name: UpdateProductDto.categoryIdKey_) + final String? categoryId; + + /// description + @override + @JsonKey(name: UpdateProductDto.descriptionKey_) + final String? description; + + /// barcode + @override + @JsonKey(name: UpdateProductDto.barcodeKey_) + final String? barcode; + + /// purchasePrice + @override + @JsonKey(name: UpdateProductDto.purchasePriceKey_) + final double? purchasePrice; + + /// markupPercentage + @override + @JsonKey(name: UpdateProductDto.markupPercentageKey_) + final double? markupPercentage; + + /// salePrice + @override + @JsonKey(name: UpdateProductDto.salePriceKey_) + final double? salePrice; + + /// allowGeneric + @override + @JsonKey(name: UpdateProductDto.allowGenericKey_) + final bool? allowGeneric; + + /// useBooleanStock + @override + @JsonKey(name: UpdateProductDto.useBooleanStockKey_) + final bool? useBooleanStock; + + /// hasStock + @override + @JsonKey(name: UpdateProductDto.hasStockKey_) + final bool? hasStock; + + /// variants + final List? _variants; + + /// variants + @override + @JsonKey(name: UpdateProductDto.variantsKey_) + List? get variants { + final value = _variants; + if (value == null) return null; + if (_variants is EqualUnmodifiableListView) return _variants; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// presentations + final List? _presentations; + + /// presentations + @override + @JsonKey(name: UpdateProductDto.presentationsKey_) + List? get presentations { + final value = _presentations; + if (value == null) return null; + if (_presentations is EqualUnmodifiableListView) return _presentations; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// Create a copy of UpdateProductDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdateProductDtoCopyWith<_UpdateProductDto> get copyWith => + __$UpdateProductDtoCopyWithImpl<_UpdateProductDto>(this, _$identity); + + @override + Map toJson() { + return _$UpdateProductDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdateProductDto && + (identical(other.name, name) || other.name == name) && + (identical(other.categoryId, categoryId) || + other.categoryId == categoryId) && + (identical(other.description, description) || + other.description == description) && + (identical(other.barcode, barcode) || other.barcode == barcode) && + (identical(other.purchasePrice, purchasePrice) || + other.purchasePrice == purchasePrice) && + (identical(other.markupPercentage, markupPercentage) || + other.markupPercentage == markupPercentage) && + (identical(other.salePrice, salePrice) || + other.salePrice == salePrice) && + (identical(other.allowGeneric, allowGeneric) || + other.allowGeneric == allowGeneric) && + (identical(other.useBooleanStock, useBooleanStock) || + other.useBooleanStock == useBooleanStock) && + (identical(other.hasStock, hasStock) || + other.hasStock == hasStock) && + const DeepCollectionEquality().equals(other._variants, _variants) && + const DeepCollectionEquality() + .equals(other._presentations, _presentations)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + name, + categoryId, + description, + barcode, + purchasePrice, + markupPercentage, + salePrice, + allowGeneric, + useBooleanStock, + hasStock, + const DeepCollectionEquality().hash(_variants), + const DeepCollectionEquality().hash(_presentations)); + + @override + String toString() { + return 'UpdateProductDto(name: $name, categoryId: $categoryId, description: $description, barcode: $barcode, purchasePrice: $purchasePrice, markupPercentage: $markupPercentage, salePrice: $salePrice, allowGeneric: $allowGeneric, useBooleanStock: $useBooleanStock, hasStock: $hasStock, variants: $variants, presentations: $presentations)'; + } +} + +/// @nodoc +abstract mixin class _$UpdateProductDtoCopyWith<$Res> + implements $UpdateProductDtoCopyWith<$Res> { + factory _$UpdateProductDtoCopyWith( + _UpdateProductDto value, $Res Function(_UpdateProductDto) _then) = + __$UpdateProductDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdateProductDto.nameKey_) String? name, + @JsonKey(name: UpdateProductDto.categoryIdKey_) String? categoryId, + @JsonKey(name: UpdateProductDto.descriptionKey_) String? description, + @JsonKey(name: UpdateProductDto.barcodeKey_) String? barcode, + @JsonKey(name: UpdateProductDto.purchasePriceKey_) double? purchasePrice, + @JsonKey(name: UpdateProductDto.markupPercentageKey_) + double? markupPercentage, + @JsonKey(name: UpdateProductDto.salePriceKey_) double? salePrice, + @JsonKey(name: UpdateProductDto.allowGenericKey_) bool? allowGeneric, + @JsonKey(name: UpdateProductDto.useBooleanStockKey_) + bool? useBooleanStock, + @JsonKey(name: UpdateProductDto.hasStockKey_) bool? hasStock, + @JsonKey(name: UpdateProductDto.variantsKey_) + List? variants, + @JsonKey(name: UpdateProductDto.presentationsKey_) + List? presentations}); +} + +/// @nodoc +class __$UpdateProductDtoCopyWithImpl<$Res> + implements _$UpdateProductDtoCopyWith<$Res> { + __$UpdateProductDtoCopyWithImpl(this._self, this._then); + + final _UpdateProductDto _self; + final $Res Function(_UpdateProductDto) _then; + + /// Create a copy of UpdateProductDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = freezed, + Object? categoryId = freezed, + Object? description = freezed, + Object? barcode = freezed, + Object? purchasePrice = freezed, + Object? markupPercentage = freezed, + Object? salePrice = freezed, + Object? allowGeneric = freezed, + Object? useBooleanStock = freezed, + Object? hasStock = freezed, + Object? variants = freezed, + Object? presentations = freezed, + }) { + return _then(_UpdateProductDto( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + categoryId: freezed == categoryId + ? _self.categoryId + : categoryId // ignore: cast_nullable_to_non_nullable + as String?, + description: freezed == description + ? _self.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + barcode: freezed == barcode + ? _self.barcode + : barcode // ignore: cast_nullable_to_non_nullable + as String?, + purchasePrice: freezed == purchasePrice + ? _self.purchasePrice + : purchasePrice // ignore: cast_nullable_to_non_nullable + as double?, + markupPercentage: freezed == markupPercentage + ? _self.markupPercentage + : markupPercentage // ignore: cast_nullable_to_non_nullable + as double?, + salePrice: freezed == salePrice + ? _self.salePrice + : salePrice // ignore: cast_nullable_to_non_nullable + as double?, + allowGeneric: freezed == allowGeneric + ? _self.allowGeneric + : allowGeneric // ignore: cast_nullable_to_non_nullable + as bool?, + useBooleanStock: freezed == useBooleanStock + ? _self.useBooleanStock + : useBooleanStock // ignore: cast_nullable_to_non_nullable + as bool?, + hasStock: freezed == hasStock + ? _self.hasStock + : hasStock // ignore: cast_nullable_to_non_nullable + as bool?, + variants: freezed == variants + ? _self._variants + : variants // ignore: cast_nullable_to_non_nullable + as List?, + presentations: freezed == presentations + ? _self._presentations + : presentations // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_product_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_dto.g.dart new file mode 100644 index 00000000..b94661b9 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_dto.g.dart @@ -0,0 +1,50 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_product_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdateProductDto _$UpdateProductDtoFromJson(Map json) => + _UpdateProductDto( + name: json['name'] as String?, + categoryId: json['category_id'] as String?, + description: json['description'] as String?, + barcode: json['barcode'] as String?, + purchasePrice: (json['purchase_price'] as num?)?.toDouble(), + markupPercentage: (json['markup_percentage'] as num?)?.toDouble(), + salePrice: (json['sale_price'] as num?)?.toDouble(), + allowGeneric: json['allow_generic'] as bool?, + useBooleanStock: json['use_boolean_stock'] as bool?, + hasStock: json['has_stock'] as bool?, + variants: (json['variants'] as List?) + ?.map((e) => + UpdateProductVariantDto.fromJson(e as Map)) + .toList(), + presentations: (json['presentations'] as List?) + ?.map((e) => + UpdateProductPresentationDto.fromJson(e as Map)) + .toList(), + ); + +Map _$UpdateProductDtoToJson(_UpdateProductDto instance) => + { + if (instance.name case final value?) 'name': value, + if (instance.categoryId case final value?) 'category_id': value, + if (instance.description case final value?) 'description': value, + if (instance.barcode case final value?) 'barcode': value, + if (instance.purchasePrice case final value?) 'purchase_price': value, + if (instance.markupPercentage case final value?) + 'markup_percentage': value, + if (instance.salePrice case final value?) 'sale_price': value, + if (instance.allowGeneric case final value?) 'allow_generic': value, + if (instance.useBooleanStock case final value?) + 'use_boolean_stock': value, + if (instance.hasStock case final value?) 'has_stock': value, + if (instance.variants?.map((e) => e.toJson()).toList() case final value?) + 'variants': value, + if (instance.presentations?.map((e) => e.toJson()).toList() + case final value?) + 'presentations': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_product_presentation_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_presentation_dto.dart new file mode 100644 index 00000000..07d4072c --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_presentation_dto.dart @@ -0,0 +1,54 @@ +/// UpdateProductPresentationDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "name": { +/// "type": "string", +/// "nullable": true +/// }, +/// "quantity_multiplier": { +/// "type": "integer", +/// "format": "int32", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "additionalProperties": false +/// } +library update_product_presentation_dto; + +import 'exports.dart'; +part 'update_product_presentation_dto.freezed.dart'; +part 'update_product_presentation_dto.g.dart'; // UpdateProductPresentationDto + +@freezed +abstract class UpdateProductPresentationDto + with _$UpdateProductPresentationDto { + const UpdateProductPresentationDto._(); + + @jsonSerializable + const factory UpdateProductPresentationDto({ + /// id + @JsonKey(name: UpdateProductPresentationDto.idKey_) String? id, + + /// name + @JsonKey(name: UpdateProductPresentationDto.nameKey_) String? name, + + /// quantityMultiplier + @JsonKey(name: UpdateProductPresentationDto.quantityMultiplierKey_) + int? quantityMultiplier, + }) = _UpdateProductPresentationDto; + + factory UpdateProductPresentationDto.fromJson(Map json) => + _$UpdateProductPresentationDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; + + static const String quantityMultiplierKey_ = r'quantity_multiplier'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_product_presentation_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_presentation_dto.freezed.dart new file mode 100644 index 00000000..2098f233 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_presentation_dto.freezed.dart @@ -0,0 +1,394 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_product_presentation_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateProductPresentationDto { + /// id + @JsonKey(name: UpdateProductPresentationDto.idKey_) + String? get id; + + /// name + @JsonKey(name: UpdateProductPresentationDto.nameKey_) + String? get name; + + /// quantityMultiplier + @JsonKey(name: UpdateProductPresentationDto.quantityMultiplierKey_) + int? get quantityMultiplier; + + /// Create a copy of UpdateProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateProductPresentationDtoCopyWith + get copyWith => _$UpdateProductPresentationDtoCopyWithImpl< + UpdateProductPresentationDto>( + this as UpdateProductPresentationDto, _$identity); + + /// Serializes this UpdateProductPresentationDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateProductPresentationDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.quantityMultiplier, quantityMultiplier) || + other.quantityMultiplier == quantityMultiplier)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, quantityMultiplier); + + @override + String toString() { + return 'UpdateProductPresentationDto(id: $id, name: $name, quantityMultiplier: $quantityMultiplier)'; + } +} + +/// @nodoc +abstract mixin class $UpdateProductPresentationDtoCopyWith<$Res> { + factory $UpdateProductPresentationDtoCopyWith( + UpdateProductPresentationDto value, + $Res Function(UpdateProductPresentationDto) _then) = + _$UpdateProductPresentationDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdateProductPresentationDto.idKey_) String? id, + @JsonKey(name: UpdateProductPresentationDto.nameKey_) String? name, + @JsonKey(name: UpdateProductPresentationDto.quantityMultiplierKey_) + int? quantityMultiplier}); +} + +/// @nodoc +class _$UpdateProductPresentationDtoCopyWithImpl<$Res> + implements $UpdateProductPresentationDtoCopyWith<$Res> { + _$UpdateProductPresentationDtoCopyWithImpl(this._self, this._then); + + final UpdateProductPresentationDto _self; + final $Res Function(UpdateProductPresentationDto) _then; + + /// Create a copy of UpdateProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? name = freezed, + Object? quantityMultiplier = freezed, + }) { + return _then(_self.copyWith( + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + quantityMultiplier: freezed == quantityMultiplier + ? _self.quantityMultiplier + : quantityMultiplier // ignore: cast_nullable_to_non_nullable + as int?, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdateProductPresentationDto]. +extension UpdateProductPresentationDtoPatterns on UpdateProductPresentationDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdateProductPresentationDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateProductPresentationDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdateProductPresentationDto value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductPresentationDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdateProductPresentationDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductPresentationDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UpdateProductPresentationDto.idKey_) String? id, + @JsonKey(name: UpdateProductPresentationDto.nameKey_) String? name, + @JsonKey(name: UpdateProductPresentationDto.quantityMultiplierKey_) + int? quantityMultiplier)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateProductPresentationDto() when $default != null: + return $default(_that.id, _that.name, _that.quantityMultiplier); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UpdateProductPresentationDto.idKey_) String? id, + @JsonKey(name: UpdateProductPresentationDto.nameKey_) String? name, + @JsonKey(name: UpdateProductPresentationDto.quantityMultiplierKey_) + int? quantityMultiplier) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductPresentationDto(): + return $default(_that.id, _that.name, _that.quantityMultiplier); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UpdateProductPresentationDto.idKey_) String? id, + @JsonKey(name: UpdateProductPresentationDto.nameKey_) String? name, + @JsonKey(name: UpdateProductPresentationDto.quantityMultiplierKey_) + int? quantityMultiplier)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductPresentationDto() when $default != null: + return $default(_that.id, _that.name, _that.quantityMultiplier); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdateProductPresentationDto extends UpdateProductPresentationDto { + const _UpdateProductPresentationDto( + {@JsonKey(name: UpdateProductPresentationDto.idKey_) this.id, + @JsonKey(name: UpdateProductPresentationDto.nameKey_) this.name, + @JsonKey(name: UpdateProductPresentationDto.quantityMultiplierKey_) + this.quantityMultiplier}) + : super._(); + factory _UpdateProductPresentationDto.fromJson(Map json) => + _$UpdateProductPresentationDtoFromJson(json); + + /// id + @override + @JsonKey(name: UpdateProductPresentationDto.idKey_) + final String? id; + + /// name + @override + @JsonKey(name: UpdateProductPresentationDto.nameKey_) + final String? name; + + /// quantityMultiplier + @override + @JsonKey(name: UpdateProductPresentationDto.quantityMultiplierKey_) + final int? quantityMultiplier; + + /// Create a copy of UpdateProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdateProductPresentationDtoCopyWith<_UpdateProductPresentationDto> + get copyWith => __$UpdateProductPresentationDtoCopyWithImpl< + _UpdateProductPresentationDto>(this, _$identity); + + @override + Map toJson() { + return _$UpdateProductPresentationDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdateProductPresentationDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.quantityMultiplier, quantityMultiplier) || + other.quantityMultiplier == quantityMultiplier)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name, quantityMultiplier); + + @override + String toString() { + return 'UpdateProductPresentationDto(id: $id, name: $name, quantityMultiplier: $quantityMultiplier)'; + } +} + +/// @nodoc +abstract mixin class _$UpdateProductPresentationDtoCopyWith<$Res> + implements $UpdateProductPresentationDtoCopyWith<$Res> { + factory _$UpdateProductPresentationDtoCopyWith( + _UpdateProductPresentationDto value, + $Res Function(_UpdateProductPresentationDto) _then) = + __$UpdateProductPresentationDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdateProductPresentationDto.idKey_) String? id, + @JsonKey(name: UpdateProductPresentationDto.nameKey_) String? name, + @JsonKey(name: UpdateProductPresentationDto.quantityMultiplierKey_) + int? quantityMultiplier}); +} + +/// @nodoc +class __$UpdateProductPresentationDtoCopyWithImpl<$Res> + implements _$UpdateProductPresentationDtoCopyWith<$Res> { + __$UpdateProductPresentationDtoCopyWithImpl(this._self, this._then); + + final _UpdateProductPresentationDto _self; + final $Res Function(_UpdateProductPresentationDto) _then; + + /// Create a copy of UpdateProductPresentationDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = freezed, + Object? name = freezed, + Object? quantityMultiplier = freezed, + }) { + return _then(_UpdateProductPresentationDto( + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + quantityMultiplier: freezed == quantityMultiplier + ? _self.quantityMultiplier + : quantityMultiplier // ignore: cast_nullable_to_non_nullable + as int?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_product_presentation_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_presentation_dto.g.dart new file mode 100644 index 00000000..a96cb841 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_presentation_dto.g.dart @@ -0,0 +1,24 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_product_presentation_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdateProductPresentationDto _$UpdateProductPresentationDtoFromJson( + Map json) => + _UpdateProductPresentationDto( + id: json['id'] as String?, + name: json['name'] as String?, + quantityMultiplier: (json['quantity_multiplier'] as num?)?.toInt(), + ); + +Map _$UpdateProductPresentationDtoToJson( + _UpdateProductPresentationDto instance) => + { + if (instance.id case final value?) 'id': value, + if (instance.name case final value?) 'name': value, + if (instance.quantityMultiplier case final value?) + 'quantity_multiplier': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_product_variant_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_variant_dto.dart new file mode 100644 index 00000000..c0bc93dc --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_variant_dto.dart @@ -0,0 +1,42 @@ +/// UpdateProductVariantDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid", +/// "nullable": true +/// }, +/// "name": { +/// "type": "string", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "additionalProperties": false +/// } +library update_product_variant_dto; + +import 'exports.dart'; +part 'update_product_variant_dto.freezed.dart'; +part 'update_product_variant_dto.g.dart'; // UpdateProductVariantDto + +@freezed +abstract class UpdateProductVariantDto with _$UpdateProductVariantDto { + const UpdateProductVariantDto._(); + + @jsonSerializable + const factory UpdateProductVariantDto({ + /// id + @JsonKey(name: UpdateProductVariantDto.idKey_) String? id, + + /// name + @JsonKey(name: UpdateProductVariantDto.nameKey_) String? name, + }) = _UpdateProductVariantDto; + + factory UpdateProductVariantDto.fromJson(Map json) => + _$UpdateProductVariantDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_product_variant_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_variant_dto.freezed.dart new file mode 100644 index 00000000..41e0f3f7 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_variant_dto.freezed.dart @@ -0,0 +1,353 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_product_variant_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateProductVariantDto { + /// id + @JsonKey(name: UpdateProductVariantDto.idKey_) + String? get id; + + /// name + @JsonKey(name: UpdateProductVariantDto.nameKey_) + String? get name; + + /// Create a copy of UpdateProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateProductVariantDtoCopyWith get copyWith => + _$UpdateProductVariantDtoCopyWithImpl( + this as UpdateProductVariantDto, _$identity); + + /// Serializes this UpdateProductVariantDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateProductVariantDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name); + + @override + String toString() { + return 'UpdateProductVariantDto(id: $id, name: $name)'; + } +} + +/// @nodoc +abstract mixin class $UpdateProductVariantDtoCopyWith<$Res> { + factory $UpdateProductVariantDtoCopyWith(UpdateProductVariantDto value, + $Res Function(UpdateProductVariantDto) _then) = + _$UpdateProductVariantDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdateProductVariantDto.idKey_) String? id, + @JsonKey(name: UpdateProductVariantDto.nameKey_) String? name}); +} + +/// @nodoc +class _$UpdateProductVariantDtoCopyWithImpl<$Res> + implements $UpdateProductVariantDtoCopyWith<$Res> { + _$UpdateProductVariantDtoCopyWithImpl(this._self, this._then); + + final UpdateProductVariantDto _self; + final $Res Function(UpdateProductVariantDto) _then; + + /// Create a copy of UpdateProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? name = freezed, + }) { + return _then(_self.copyWith( + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdateProductVariantDto]. +extension UpdateProductVariantDtoPatterns on UpdateProductVariantDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdateProductVariantDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateProductVariantDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdateProductVariantDto value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductVariantDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdateProductVariantDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductVariantDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(@JsonKey(name: UpdateProductVariantDto.idKey_) String? id, + @JsonKey(name: UpdateProductVariantDto.nameKey_) String? name)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateProductVariantDto() when $default != null: + return $default(_that.id, _that.name); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(@JsonKey(name: UpdateProductVariantDto.idKey_) String? id, + @JsonKey(name: UpdateProductVariantDto.nameKey_) String? name) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductVariantDto(): + return $default(_that.id, _that.name); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(@JsonKey(name: UpdateProductVariantDto.idKey_) String? id, + @JsonKey(name: UpdateProductVariantDto.nameKey_) String? name)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateProductVariantDto() when $default != null: + return $default(_that.id, _that.name); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdateProductVariantDto extends UpdateProductVariantDto { + const _UpdateProductVariantDto( + {@JsonKey(name: UpdateProductVariantDto.idKey_) this.id, + @JsonKey(name: UpdateProductVariantDto.nameKey_) this.name}) + : super._(); + factory _UpdateProductVariantDto.fromJson(Map json) => + _$UpdateProductVariantDtoFromJson(json); + + /// id + @override + @JsonKey(name: UpdateProductVariantDto.idKey_) + final String? id; + + /// name + @override + @JsonKey(name: UpdateProductVariantDto.nameKey_) + final String? name; + + /// Create a copy of UpdateProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdateProductVariantDtoCopyWith<_UpdateProductVariantDto> get copyWith => + __$UpdateProductVariantDtoCopyWithImpl<_UpdateProductVariantDto>( + this, _$identity); + + @override + Map toJson() { + return _$UpdateProductVariantDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdateProductVariantDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name); + + @override + String toString() { + return 'UpdateProductVariantDto(id: $id, name: $name)'; + } +} + +/// @nodoc +abstract mixin class _$UpdateProductVariantDtoCopyWith<$Res> + implements $UpdateProductVariantDtoCopyWith<$Res> { + factory _$UpdateProductVariantDtoCopyWith(_UpdateProductVariantDto value, + $Res Function(_UpdateProductVariantDto) _then) = + __$UpdateProductVariantDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdateProductVariantDto.idKey_) String? id, + @JsonKey(name: UpdateProductVariantDto.nameKey_) String? name}); +} + +/// @nodoc +class __$UpdateProductVariantDtoCopyWithImpl<$Res> + implements _$UpdateProductVariantDtoCopyWith<$Res> { + __$UpdateProductVariantDtoCopyWithImpl(this._self, this._then); + + final _UpdateProductVariantDto _self; + final $Res Function(_UpdateProductVariantDto) _then; + + /// Create a copy of UpdateProductVariantDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = freezed, + Object? name = freezed, + }) { + return _then(_UpdateProductVariantDto( + id: freezed == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_product_variant_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_variant_dto.g.dart new file mode 100644 index 00000000..e2209d9b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_product_variant_dto.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_product_variant_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdateProductVariantDto _$UpdateProductVariantDtoFromJson( + Map json) => + _UpdateProductVariantDto( + id: json['id'] as String?, + name: json['name'] as String?, + ); + +Map _$UpdateProductVariantDtoToJson( + _UpdateProductVariantDto instance) => + { + if (instance.id case final value?) 'id': value, + if (instance.name case final value?) 'name': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_sale_point_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_sale_point_dto.dart new file mode 100644 index 00000000..2b3c5f66 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_sale_point_dto.dart @@ -0,0 +1,45 @@ +/// UpdateSalePointDto +/// { +/// "properties": { +/// "name": { +/// "type": "string", +/// "nullable": true +/// }, +/// "users_id": { +/// "type": "array", +/// "items": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "additionalProperties": false +/// } +library update_sale_point_dto; + +import 'exports.dart'; +part 'update_sale_point_dto.freezed.dart'; +part 'update_sale_point_dto.g.dart'; // UpdateSalePointDto + +@freezed +abstract class UpdateSalePointDto with _$UpdateSalePointDto { + const UpdateSalePointDto._(); + + @jsonSerializable + const factory UpdateSalePointDto({ + /// name + @JsonKey(name: UpdateSalePointDto.nameKey_) String? name, + + /// usersId + @JsonKey(name: UpdateSalePointDto.usersIdKey_) List? usersId, + }) = _UpdateSalePointDto; + + factory UpdateSalePointDto.fromJson(Map json) => + _$UpdateSalePointDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String usersIdKey_ = r'users_id'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_sale_point_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_sale_point_dto.freezed.dart new file mode 100644 index 00000000..3c8c4b2b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_sale_point_dto.freezed.dart @@ -0,0 +1,371 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_sale_point_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateSalePointDto { + /// name + @JsonKey(name: UpdateSalePointDto.nameKey_) + String? get name; + + /// usersId + @JsonKey(name: UpdateSalePointDto.usersIdKey_) + List? get usersId; + + /// Create a copy of UpdateSalePointDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateSalePointDtoCopyWith get copyWith => + _$UpdateSalePointDtoCopyWithImpl( + this as UpdateSalePointDto, _$identity); + + /// Serializes this UpdateSalePointDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateSalePointDto && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.usersId, usersId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, name, const DeepCollectionEquality().hash(usersId)); + + @override + String toString() { + return 'UpdateSalePointDto(name: $name, usersId: $usersId)'; + } +} + +/// @nodoc +abstract mixin class $UpdateSalePointDtoCopyWith<$Res> { + factory $UpdateSalePointDtoCopyWith( + UpdateSalePointDto value, $Res Function(UpdateSalePointDto) _then) = + _$UpdateSalePointDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdateSalePointDto.nameKey_) String? name, + @JsonKey(name: UpdateSalePointDto.usersIdKey_) List? usersId}); +} + +/// @nodoc +class _$UpdateSalePointDtoCopyWithImpl<$Res> + implements $UpdateSalePointDtoCopyWith<$Res> { + _$UpdateSalePointDtoCopyWithImpl(this._self, this._then); + + final UpdateSalePointDto _self; + final $Res Function(UpdateSalePointDto) _then; + + /// Create a copy of UpdateSalePointDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = freezed, + Object? usersId = freezed, + }) { + return _then(_self.copyWith( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + usersId: freezed == usersId + ? _self.usersId + : usersId // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdateSalePointDto]. +extension UpdateSalePointDtoPatterns on UpdateSalePointDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdateSalePointDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateSalePointDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdateSalePointDto value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdateSalePointDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdateSalePointDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdateSalePointDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UpdateSalePointDto.nameKey_) String? name, + @JsonKey(name: UpdateSalePointDto.usersIdKey_) + List? usersId)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateSalePointDto() when $default != null: + return $default(_that.name, _that.usersId); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UpdateSalePointDto.nameKey_) String? name, + @JsonKey(name: UpdateSalePointDto.usersIdKey_) + List? usersId) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateSalePointDto(): + return $default(_that.name, _that.usersId); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UpdateSalePointDto.nameKey_) String? name, + @JsonKey(name: UpdateSalePointDto.usersIdKey_) + List? usersId)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateSalePointDto() when $default != null: + return $default(_that.name, _that.usersId); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdateSalePointDto extends UpdateSalePointDto { + const _UpdateSalePointDto( + {@JsonKey(name: UpdateSalePointDto.nameKey_) this.name, + @JsonKey(name: UpdateSalePointDto.usersIdKey_) + final List? usersId}) + : _usersId = usersId, + super._(); + factory _UpdateSalePointDto.fromJson(Map json) => + _$UpdateSalePointDtoFromJson(json); + + /// name + @override + @JsonKey(name: UpdateSalePointDto.nameKey_) + final String? name; + + /// usersId + final List? _usersId; + + /// usersId + @override + @JsonKey(name: UpdateSalePointDto.usersIdKey_) + List? get usersId { + final value = _usersId; + if (value == null) return null; + if (_usersId is EqualUnmodifiableListView) return _usersId; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// Create a copy of UpdateSalePointDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdateSalePointDtoCopyWith<_UpdateSalePointDto> get copyWith => + __$UpdateSalePointDtoCopyWithImpl<_UpdateSalePointDto>(this, _$identity); + + @override + Map toJson() { + return _$UpdateSalePointDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdateSalePointDto && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other._usersId, _usersId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, name, const DeepCollectionEquality().hash(_usersId)); + + @override + String toString() { + return 'UpdateSalePointDto(name: $name, usersId: $usersId)'; + } +} + +/// @nodoc +abstract mixin class _$UpdateSalePointDtoCopyWith<$Res> + implements $UpdateSalePointDtoCopyWith<$Res> { + factory _$UpdateSalePointDtoCopyWith( + _UpdateSalePointDto value, $Res Function(_UpdateSalePointDto) _then) = + __$UpdateSalePointDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdateSalePointDto.nameKey_) String? name, + @JsonKey(name: UpdateSalePointDto.usersIdKey_) List? usersId}); +} + +/// @nodoc +class __$UpdateSalePointDtoCopyWithImpl<$Res> + implements _$UpdateSalePointDtoCopyWith<$Res> { + __$UpdateSalePointDtoCopyWithImpl(this._self, this._then); + + final _UpdateSalePointDto _self; + final $Res Function(_UpdateSalePointDto) _then; + + /// Create a copy of UpdateSalePointDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = freezed, + Object? usersId = freezed, + }) { + return _then(_UpdateSalePointDto( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + usersId: freezed == usersId + ? _self._usersId + : usersId // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_sale_point_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_sale_point_dto.g.dart new file mode 100644 index 00000000..37e7b49b --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_sale_point_dto.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_sale_point_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdateSalePointDto _$UpdateSalePointDtoFromJson(Map json) => + _UpdateSalePointDto( + name: json['name'] as String?, + usersId: (json['users_id'] as List?) + ?.map((e) => e as String) + .toList(), + ); + +Map _$UpdateSalePointDtoToJson(_UpdateSalePointDto instance) => + { + if (instance.name case final value?) 'name': value, + if (instance.usersId case final value?) 'users_id': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_user_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_user_dto.dart new file mode 100644 index 00000000..a268c310 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_user_dto.dart @@ -0,0 +1,75 @@ +/// UpdateUserDto +/// { +/// "properties": { +/// "name": { +/// "type": "string", +/// "nullable": true +/// }, +/// "roles": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/Role" +/// }, +/// "nullable": true +/// }, +/// "is_active": { +/// "type": "boolean", +/// "nullable": true +/// }, +/// "new_password": { +/// "type": "string", +/// "nullable": true +/// }, +/// "sale_points_id": { +/// "type": "array", +/// "items": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "additionalProperties": false +/// } +library update_user_dto; + +import 'exports.dart'; +part 'update_user_dto.freezed.dart'; +part 'update_user_dto.g.dart'; // UpdateUserDto + +@freezed +abstract class UpdateUserDto with _$UpdateUserDto { + const UpdateUserDto._(); + + @jsonSerializable + const factory UpdateUserDto({ + /// name + @JsonKey(name: UpdateUserDto.nameKey_) String? name, + + /// roles + @JsonKey(name: UpdateUserDto.rolesKey_) List? roles, + + /// isActive + @JsonKey(name: UpdateUserDto.isActiveKey_) bool? isActive, + + /// newPassword + @JsonKey(name: UpdateUserDto.newPasswordKey_) String? newPassword, + + /// salePointsId + @JsonKey(name: UpdateUserDto.salePointsIdKey_) List? salePointsId, + }) = _UpdateUserDto; + + factory UpdateUserDto.fromJson(Map json) => + _$UpdateUserDtoFromJson(json); + + static const String nameKey_ = r'name'; + + static const String rolesKey_ = r'roles'; + + static const String isActiveKey_ = r'is_active'; + + static const String newPasswordKey_ = r'new_password'; + + static const String salePointsIdKey_ = r'sale_points_id'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_user_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_user_dto.freezed.dart new file mode 100644 index 00000000..f1bc5e95 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_user_dto.freezed.dart @@ -0,0 +1,483 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'update_user_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateUserDto { + /// name + @JsonKey(name: UpdateUserDto.nameKey_) + String? get name; + + /// roles + @JsonKey(name: UpdateUserDto.rolesKey_) + List? get roles; + + /// isActive + @JsonKey(name: UpdateUserDto.isActiveKey_) + bool? get isActive; + + /// newPassword + @JsonKey(name: UpdateUserDto.newPasswordKey_) + String? get newPassword; + + /// salePointsId + @JsonKey(name: UpdateUserDto.salePointsIdKey_) + List? get salePointsId; + + /// Create a copy of UpdateUserDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdateUserDtoCopyWith get copyWith => + _$UpdateUserDtoCopyWithImpl( + this as UpdateUserDto, _$identity); + + /// Serializes this UpdateUserDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdateUserDto && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.roles, roles) && + (identical(other.isActive, isActive) || + other.isActive == isActive) && + (identical(other.newPassword, newPassword) || + other.newPassword == newPassword) && + const DeepCollectionEquality() + .equals(other.salePointsId, salePointsId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + name, + const DeepCollectionEquality().hash(roles), + isActive, + newPassword, + const DeepCollectionEquality().hash(salePointsId)); + + @override + String toString() { + return 'UpdateUserDto(name: $name, roles: $roles, isActive: $isActive, newPassword: $newPassword, salePointsId: $salePointsId)'; + } +} + +/// @nodoc +abstract mixin class $UpdateUserDtoCopyWith<$Res> { + factory $UpdateUserDtoCopyWith( + UpdateUserDto value, $Res Function(UpdateUserDto) _then) = + _$UpdateUserDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UpdateUserDto.nameKey_) String? name, + @JsonKey(name: UpdateUserDto.rolesKey_) List? roles, + @JsonKey(name: UpdateUserDto.isActiveKey_) bool? isActive, + @JsonKey(name: UpdateUserDto.newPasswordKey_) String? newPassword, + @JsonKey(name: UpdateUserDto.salePointsIdKey_) + List? salePointsId}); +} + +/// @nodoc +class _$UpdateUserDtoCopyWithImpl<$Res> + implements $UpdateUserDtoCopyWith<$Res> { + _$UpdateUserDtoCopyWithImpl(this._self, this._then); + + final UpdateUserDto _self; + final $Res Function(UpdateUserDto) _then; + + /// Create a copy of UpdateUserDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = freezed, + Object? roles = freezed, + Object? isActive = freezed, + Object? newPassword = freezed, + Object? salePointsId = freezed, + }) { + return _then(_self.copyWith( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + roles: freezed == roles + ? _self.roles + : roles // ignore: cast_nullable_to_non_nullable + as List?, + isActive: freezed == isActive + ? _self.isActive + : isActive // ignore: cast_nullable_to_non_nullable + as bool?, + newPassword: freezed == newPassword + ? _self.newPassword + : newPassword // ignore: cast_nullable_to_non_nullable + as String?, + salePointsId: freezed == salePointsId + ? _self.salePointsId + : salePointsId // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// Adds pattern-matching-related methods to [UpdateUserDto]. +extension UpdateUserDtoPatterns on UpdateUserDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UpdateUserDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateUserDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UpdateUserDto value) $default, + ) { + final _that = this; + switch (_that) { + case _UpdateUserDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UpdateUserDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _UpdateUserDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UpdateUserDto.nameKey_) String? name, + @JsonKey(name: UpdateUserDto.rolesKey_) List? roles, + @JsonKey(name: UpdateUserDto.isActiveKey_) bool? isActive, + @JsonKey(name: UpdateUserDto.newPasswordKey_) String? newPassword, + @JsonKey(name: UpdateUserDto.salePointsIdKey_) + List? salePointsId)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UpdateUserDto() when $default != null: + return $default(_that.name, _that.roles, _that.isActive, + _that.newPassword, _that.salePointsId); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UpdateUserDto.nameKey_) String? name, + @JsonKey(name: UpdateUserDto.rolesKey_) List? roles, + @JsonKey(name: UpdateUserDto.isActiveKey_) bool? isActive, + @JsonKey(name: UpdateUserDto.newPasswordKey_) String? newPassword, + @JsonKey(name: UpdateUserDto.salePointsIdKey_) + List? salePointsId) + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateUserDto(): + return $default(_that.name, _that.roles, _that.isActive, + _that.newPassword, _that.salePointsId); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UpdateUserDto.nameKey_) String? name, + @JsonKey(name: UpdateUserDto.rolesKey_) List? roles, + @JsonKey(name: UpdateUserDto.isActiveKey_) bool? isActive, + @JsonKey(name: UpdateUserDto.newPasswordKey_) String? newPassword, + @JsonKey(name: UpdateUserDto.salePointsIdKey_) + List? salePointsId)? + $default, + ) { + final _that = this; + switch (_that) { + case _UpdateUserDto() when $default != null: + return $default(_that.name, _that.roles, _that.isActive, + _that.newPassword, _that.salePointsId); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UpdateUserDto extends UpdateUserDto { + const _UpdateUserDto( + {@JsonKey(name: UpdateUserDto.nameKey_) this.name, + @JsonKey(name: UpdateUserDto.rolesKey_) final List? roles, + @JsonKey(name: UpdateUserDto.isActiveKey_) this.isActive, + @JsonKey(name: UpdateUserDto.newPasswordKey_) this.newPassword, + @JsonKey(name: UpdateUserDto.salePointsIdKey_) + final List? salePointsId}) + : _roles = roles, + _salePointsId = salePointsId, + super._(); + factory _UpdateUserDto.fromJson(Map json) => + _$UpdateUserDtoFromJson(json); + + /// name + @override + @JsonKey(name: UpdateUserDto.nameKey_) + final String? name; + + /// roles + final List? _roles; + + /// roles + @override + @JsonKey(name: UpdateUserDto.rolesKey_) + List? get roles { + final value = _roles; + if (value == null) return null; + if (_roles is EqualUnmodifiableListView) return _roles; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// isActive + @override + @JsonKey(name: UpdateUserDto.isActiveKey_) + final bool? isActive; + + /// newPassword + @override + @JsonKey(name: UpdateUserDto.newPasswordKey_) + final String? newPassword; + + /// salePointsId + final List? _salePointsId; + + /// salePointsId + @override + @JsonKey(name: UpdateUserDto.salePointsIdKey_) + List? get salePointsId { + final value = _salePointsId; + if (value == null) return null; + if (_salePointsId is EqualUnmodifiableListView) return _salePointsId; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// Create a copy of UpdateUserDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UpdateUserDtoCopyWith<_UpdateUserDto> get copyWith => + __$UpdateUserDtoCopyWithImpl<_UpdateUserDto>(this, _$identity); + + @override + Map toJson() { + return _$UpdateUserDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UpdateUserDto && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other._roles, _roles) && + (identical(other.isActive, isActive) || + other.isActive == isActive) && + (identical(other.newPassword, newPassword) || + other.newPassword == newPassword) && + const DeepCollectionEquality() + .equals(other._salePointsId, _salePointsId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + name, + const DeepCollectionEquality().hash(_roles), + isActive, + newPassword, + const DeepCollectionEquality().hash(_salePointsId)); + + @override + String toString() { + return 'UpdateUserDto(name: $name, roles: $roles, isActive: $isActive, newPassword: $newPassword, salePointsId: $salePointsId)'; + } +} + +/// @nodoc +abstract mixin class _$UpdateUserDtoCopyWith<$Res> + implements $UpdateUserDtoCopyWith<$Res> { + factory _$UpdateUserDtoCopyWith( + _UpdateUserDto value, $Res Function(_UpdateUserDto) _then) = + __$UpdateUserDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UpdateUserDto.nameKey_) String? name, + @JsonKey(name: UpdateUserDto.rolesKey_) List? roles, + @JsonKey(name: UpdateUserDto.isActiveKey_) bool? isActive, + @JsonKey(name: UpdateUserDto.newPasswordKey_) String? newPassword, + @JsonKey(name: UpdateUserDto.salePointsIdKey_) + List? salePointsId}); +} + +/// @nodoc +class __$UpdateUserDtoCopyWithImpl<$Res> + implements _$UpdateUserDtoCopyWith<$Res> { + __$UpdateUserDtoCopyWithImpl(this._self, this._then); + + final _UpdateUserDto _self; + final $Res Function(_UpdateUserDto) _then; + + /// Create a copy of UpdateUserDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? name = freezed, + Object? roles = freezed, + Object? isActive = freezed, + Object? newPassword = freezed, + Object? salePointsId = freezed, + }) { + return _then(_UpdateUserDto( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + roles: freezed == roles + ? _self._roles + : roles // ignore: cast_nullable_to_non_nullable + as List?, + isActive: freezed == isActive + ? _self.isActive + : isActive // ignore: cast_nullable_to_non_nullable + as bool?, + newPassword: freezed == newPassword + ? _self.newPassword + : newPassword // ignore: cast_nullable_to_non_nullable + as String?, + salePointsId: freezed == salePointsId + ? _self._salePointsId + : salePointsId // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/update_user_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/update_user_dto.g.dart new file mode 100644 index 00000000..3a3fc969 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/update_user_dto.g.dart @@ -0,0 +1,30 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_user_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdateUserDto _$UpdateUserDtoFromJson(Map json) => + _UpdateUserDto( + name: json['name'] as String?, + roles: (json['roles'] as List?) + ?.map((e) => Role.fromJson(e as String)) + .toList(), + isActive: json['is_active'] as bool?, + newPassword: json['new_password'] as String?, + salePointsId: (json['sale_points_id'] as List?) + ?.map((e) => e as String) + .toList(), + ); + +Map _$UpdateUserDtoToJson(_UpdateUserDto instance) => + { + if (instance.name case final value?) 'name': value, + if (instance.roles?.map((e) => e.toJson()).toList() case final value?) + 'roles': value, + if (instance.isActive case final value?) 'is_active': value, + if (instance.newPassword case final value?) 'new_password': value, + if (instance.salePointsId case final value?) 'sale_points_id': value, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/user_dto.dart b/packages/swagger_to_dart/example/lib/src/gen/models/user_dto.dart new file mode 100644 index 00000000..9314c4e4 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/user_dto.dart @@ -0,0 +1,87 @@ +/// UserDto +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "name": { +/// "type": "string" +/// }, +/// "username": { +/// "type": "string" +/// }, +/// "is_active": { +/// "type": "boolean" +/// }, +/// "roles": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/Role" +/// } +/// }, +/// "sale_points": { +/// "type": "array", +/// "items": { +/// "$ref": "#/components/schemas/SalePointRef" +/// } +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "id", +/// "is_active", +/// "name", +/// "roles", +/// "sale_points", +/// "username" +/// ], +/// "additionalProperties": false +/// } +library user_dto; + +import 'exports.dart'; +part 'user_dto.freezed.dart'; +part 'user_dto.g.dart'; // UserDto + +@freezed +abstract class UserDto with _$UserDto { + const UserDto._(); + + @jsonSerializable + const factory UserDto({ + /// id + @JsonKey(name: UserDto.idKey_) required String id, + + /// name + @JsonKey(name: UserDto.nameKey_) required String name, + + /// username + @JsonKey(name: UserDto.usernameKey_) required String username, + + /// isActive + @JsonKey(name: UserDto.isActiveKey_) required bool isActive, + + /// roles + @JsonKey(name: UserDto.rolesKey_) required List roles, + + /// salePoints + @JsonKey(name: UserDto.salePointsKey_) + required List salePoints, + }) = _UserDto; + + factory UserDto.fromJson(Map json) => + _$UserDtoFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; + + static const String usernameKey_ = r'username'; + + static const String isActiveKey_ = r'is_active'; + + static const String rolesKey_ = r'roles'; + + static const String salePointsKey_ = r'sale_points'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/user_dto.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/user_dto.freezed.dart new file mode 100644 index 00000000..ea1a3a5a --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/user_dto.freezed.dart @@ -0,0 +1,500 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserDto { + /// id + @JsonKey(name: UserDto.idKey_) + String get id; + + /// name + @JsonKey(name: UserDto.nameKey_) + String get name; + + /// username + @JsonKey(name: UserDto.usernameKey_) + String get username; + + /// isActive + @JsonKey(name: UserDto.isActiveKey_) + bool get isActive; + + /// roles + @JsonKey(name: UserDto.rolesKey_) + List get roles; + + /// salePoints + @JsonKey(name: UserDto.salePointsKey_) + List get salePoints; + + /// Create a copy of UserDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserDtoCopyWith get copyWith => + _$UserDtoCopyWithImpl(this as UserDto, _$identity); + + /// Serializes this UserDto to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.username, username) || + other.username == username) && + (identical(other.isActive, isActive) || + other.isActive == isActive) && + const DeepCollectionEquality().equals(other.roles, roles) && + const DeepCollectionEquality() + .equals(other.salePoints, salePoints)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + name, + username, + isActive, + const DeepCollectionEquality().hash(roles), + const DeepCollectionEquality().hash(salePoints)); + + @override + String toString() { + return 'UserDto(id: $id, name: $name, username: $username, isActive: $isActive, roles: $roles, salePoints: $salePoints)'; + } +} + +/// @nodoc +abstract mixin class $UserDtoCopyWith<$Res> { + factory $UserDtoCopyWith(UserDto value, $Res Function(UserDto) _then) = + _$UserDtoCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UserDto.idKey_) String id, + @JsonKey(name: UserDto.nameKey_) String name, + @JsonKey(name: UserDto.usernameKey_) String username, + @JsonKey(name: UserDto.isActiveKey_) bool isActive, + @JsonKey(name: UserDto.rolesKey_) List roles, + @JsonKey(name: UserDto.salePointsKey_) List salePoints}); +} + +/// @nodoc +class _$UserDtoCopyWithImpl<$Res> implements $UserDtoCopyWith<$Res> { + _$UserDtoCopyWithImpl(this._self, this._then); + + final UserDto _self; + final $Res Function(UserDto) _then; + + /// Create a copy of UserDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + Object? username = null, + Object? isActive = null, + Object? roles = null, + Object? salePoints = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + username: null == username + ? _self.username + : username // ignore: cast_nullable_to_non_nullable + as String, + isActive: null == isActive + ? _self.isActive + : isActive // ignore: cast_nullable_to_non_nullable + as bool, + roles: null == roles + ? _self.roles + : roles // ignore: cast_nullable_to_non_nullable + as List, + salePoints: null == salePoints + ? _self.salePoints + : salePoints // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// Adds pattern-matching-related methods to [UserDto]. +extension UserDtoPatterns on UserDto { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UserDto value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UserDto() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UserDto value) $default, + ) { + final _that = this; + switch (_that) { + case _UserDto(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UserDto value)? $default, + ) { + final _that = this; + switch (_that) { + case _UserDto() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UserDto.idKey_) String id, + @JsonKey(name: UserDto.nameKey_) String name, + @JsonKey(name: UserDto.usernameKey_) String username, + @JsonKey(name: UserDto.isActiveKey_) bool isActive, + @JsonKey(name: UserDto.rolesKey_) List roles, + @JsonKey(name: UserDto.salePointsKey_) + List salePoints)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UserDto() when $default != null: + return $default(_that.id, _that.name, _that.username, _that.isActive, + _that.roles, _that.salePoints); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UserDto.idKey_) String id, + @JsonKey(name: UserDto.nameKey_) String name, + @JsonKey(name: UserDto.usernameKey_) String username, + @JsonKey(name: UserDto.isActiveKey_) bool isActive, + @JsonKey(name: UserDto.rolesKey_) List roles, + @JsonKey(name: UserDto.salePointsKey_) + List salePoints) + $default, + ) { + final _that = this; + switch (_that) { + case _UserDto(): + return $default(_that.id, _that.name, _that.username, _that.isActive, + _that.roles, _that.salePoints); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UserDto.idKey_) String id, + @JsonKey(name: UserDto.nameKey_) String name, + @JsonKey(name: UserDto.usernameKey_) String username, + @JsonKey(name: UserDto.isActiveKey_) bool isActive, + @JsonKey(name: UserDto.rolesKey_) List roles, + @JsonKey(name: UserDto.salePointsKey_) + List salePoints)? + $default, + ) { + final _that = this; + switch (_that) { + case _UserDto() when $default != null: + return $default(_that.id, _that.name, _that.username, _that.isActive, + _that.roles, _that.salePoints); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UserDto extends UserDto { + const _UserDto( + {@JsonKey(name: UserDto.idKey_) required this.id, + @JsonKey(name: UserDto.nameKey_) required this.name, + @JsonKey(name: UserDto.usernameKey_) required this.username, + @JsonKey(name: UserDto.isActiveKey_) required this.isActive, + @JsonKey(name: UserDto.rolesKey_) required final List roles, + @JsonKey(name: UserDto.salePointsKey_) + required final List salePoints}) + : _roles = roles, + _salePoints = salePoints, + super._(); + factory _UserDto.fromJson(Map json) => + _$UserDtoFromJson(json); + + /// id + @override + @JsonKey(name: UserDto.idKey_) + final String id; + + /// name + @override + @JsonKey(name: UserDto.nameKey_) + final String name; + + /// username + @override + @JsonKey(name: UserDto.usernameKey_) + final String username; + + /// isActive + @override + @JsonKey(name: UserDto.isActiveKey_) + final bool isActive; + + /// roles + final List _roles; + + /// roles + @override + @JsonKey(name: UserDto.rolesKey_) + List get roles { + if (_roles is EqualUnmodifiableListView) return _roles; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_roles); + } + + /// salePoints + final List _salePoints; + + /// salePoints + @override + @JsonKey(name: UserDto.salePointsKey_) + List get salePoints { + if (_salePoints is EqualUnmodifiableListView) return _salePoints; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_salePoints); + } + + /// Create a copy of UserDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UserDtoCopyWith<_UserDto> get copyWith => + __$UserDtoCopyWithImpl<_UserDto>(this, _$identity); + + @override + Map toJson() { + return _$UserDtoToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UserDto && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.username, username) || + other.username == username) && + (identical(other.isActive, isActive) || + other.isActive == isActive) && + const DeepCollectionEquality().equals(other._roles, _roles) && + const DeepCollectionEquality() + .equals(other._salePoints, _salePoints)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + name, + username, + isActive, + const DeepCollectionEquality().hash(_roles), + const DeepCollectionEquality().hash(_salePoints)); + + @override + String toString() { + return 'UserDto(id: $id, name: $name, username: $username, isActive: $isActive, roles: $roles, salePoints: $salePoints)'; + } +} + +/// @nodoc +abstract mixin class _$UserDtoCopyWith<$Res> implements $UserDtoCopyWith<$Res> { + factory _$UserDtoCopyWith(_UserDto value, $Res Function(_UserDto) _then) = + __$UserDtoCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UserDto.idKey_) String id, + @JsonKey(name: UserDto.nameKey_) String name, + @JsonKey(name: UserDto.usernameKey_) String username, + @JsonKey(name: UserDto.isActiveKey_) bool isActive, + @JsonKey(name: UserDto.rolesKey_) List roles, + @JsonKey(name: UserDto.salePointsKey_) List salePoints}); +} + +/// @nodoc +class __$UserDtoCopyWithImpl<$Res> implements _$UserDtoCopyWith<$Res> { + __$UserDtoCopyWithImpl(this._self, this._then); + + final _UserDto _self; + final $Res Function(_UserDto) _then; + + /// Create a copy of UserDto + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? name = null, + Object? username = null, + Object? isActive = null, + Object? roles = null, + Object? salePoints = null, + }) { + return _then(_UserDto( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + username: null == username + ? _self.username + : username // ignore: cast_nullable_to_non_nullable + as String, + isActive: null == isActive + ? _self.isActive + : isActive // ignore: cast_nullable_to_non_nullable + as bool, + roles: null == roles + ? _self._roles + : roles // ignore: cast_nullable_to_non_nullable + as List, + salePoints: null == salePoints + ? _self._salePoints + : salePoints // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/user_dto.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/user_dto.g.dart new file mode 100644 index 00000000..171bda98 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/user_dto.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UserDto _$UserDtoFromJson(Map json) => _UserDto( + id: json['id'] as String, + name: json['name'] as String, + username: json['username'] as String, + isActive: json['is_active'] as bool, + roles: (json['roles'] as List) + .map((e) => Role.fromJson(e as String)) + .toList(), + salePoints: (json['sale_points'] as List) + .map((e) => SalePointRef.fromJson(e as Map)) + .toList(), + ); + +Map _$UserDtoToJson(_UserDto instance) => { + 'id': instance.id, + 'name': instance.name, + 'username': instance.username, + 'is_active': instance.isActive, + 'roles': instance.roles.map((e) => e.toJson()).toList(), + 'sale_points': instance.salePoints.map((e) => e.toJson()).toList(), + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/user_ref.dart b/packages/swagger_to_dart/example/lib/src/gen/models/user_ref.dart new file mode 100644 index 00000000..49c59476 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/user_ref.dart @@ -0,0 +1,44 @@ +/// UserRef +/// { +/// "properties": { +/// "id": { +/// "type": "string", +/// "format": "uuid" +/// }, +/// "name": { +/// "type": "string" +/// } +/// }, +/// "type": "object", +/// "required": [ +/// "id", +/// "name" +/// ], +/// "additionalProperties": false +/// } +library user_ref; + +import 'exports.dart'; +part 'user_ref.freezed.dart'; +part 'user_ref.g.dart'; // UserRef + +@freezed +abstract class UserRef with _$UserRef { + const UserRef._(); + + @jsonSerializable + const factory UserRef({ + /// id + @JsonKey(name: UserRef.idKey_) required String id, + + /// name + @JsonKey(name: UserRef.nameKey_) required String name, + }) = _UserRef; + + factory UserRef.fromJson(Map json) => + _$UserRefFromJson(json); + + static const String idKey_ = r'id'; + + static const String nameKey_ = r'name'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/user_ref.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/user_ref.freezed.dart new file mode 100644 index 00000000..9ea37f65 --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/user_ref.freezed.dart @@ -0,0 +1,346 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_ref.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UserRef { + /// id + @JsonKey(name: UserRef.idKey_) + String get id; + + /// name + @JsonKey(name: UserRef.nameKey_) + String get name; + + /// Create a copy of UserRef + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UserRefCopyWith get copyWith => + _$UserRefCopyWithImpl(this as UserRef, _$identity); + + /// Serializes this UserRef to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UserRef && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name); + + @override + String toString() { + return 'UserRef(id: $id, name: $name)'; + } +} + +/// @nodoc +abstract mixin class $UserRefCopyWith<$Res> { + factory $UserRefCopyWith(UserRef value, $Res Function(UserRef) _then) = + _$UserRefCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UserRef.idKey_) String id, + @JsonKey(name: UserRef.nameKey_) String name}); +} + +/// @nodoc +class _$UserRefCopyWithImpl<$Res> implements $UserRefCopyWith<$Res> { + _$UserRefCopyWithImpl(this._self, this._then); + + final UserRef _self; + final $Res Function(UserRef) _then; + + /// Create a copy of UserRef + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? name = null, + }) { + return _then(_self.copyWith( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// Adds pattern-matching-related methods to [UserRef]. +extension UserRefPatterns on UserRef { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UserRef value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UserRef() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UserRef value) $default, + ) { + final _that = this; + switch (_that) { + case _UserRef(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UserRef value)? $default, + ) { + final _that = this; + switch (_that) { + case _UserRef() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(@JsonKey(name: UserRef.idKey_) String id, + @JsonKey(name: UserRef.nameKey_) String name)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UserRef() when $default != null: + return $default(_that.id, _that.name); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(@JsonKey(name: UserRef.idKey_) String id, + @JsonKey(name: UserRef.nameKey_) String name) + $default, + ) { + final _that = this; + switch (_that) { + case _UserRef(): + return $default(_that.id, _that.name); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(@JsonKey(name: UserRef.idKey_) String id, + @JsonKey(name: UserRef.nameKey_) String name)? + $default, + ) { + final _that = this; + switch (_that) { + case _UserRef() when $default != null: + return $default(_that.id, _that.name); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UserRef extends UserRef { + const _UserRef( + {@JsonKey(name: UserRef.idKey_) required this.id, + @JsonKey(name: UserRef.nameKey_) required this.name}) + : super._(); + factory _UserRef.fromJson(Map json) => + _$UserRefFromJson(json); + + /// id + @override + @JsonKey(name: UserRef.idKey_) + final String id; + + /// name + @override + @JsonKey(name: UserRef.nameKey_) + final String name; + + /// Create a copy of UserRef + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UserRefCopyWith<_UserRef> get copyWith => + __$UserRefCopyWithImpl<_UserRef>(this, _$identity); + + @override + Map toJson() { + return _$UserRefToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UserRef && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, name); + + @override + String toString() { + return 'UserRef(id: $id, name: $name)'; + } +} + +/// @nodoc +abstract mixin class _$UserRefCopyWith<$Res> implements $UserRefCopyWith<$Res> { + factory _$UserRefCopyWith(_UserRef value, $Res Function(_UserRef) _then) = + __$UserRefCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UserRef.idKey_) String id, + @JsonKey(name: UserRef.nameKey_) String name}); +} + +/// @nodoc +class __$UserRefCopyWithImpl<$Res> implements _$UserRefCopyWith<$Res> { + __$UserRefCopyWithImpl(this._self, this._then); + + final _UserRef _self; + final $Res Function(_UserRef) _then; + + /// Create a copy of UserRef + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? id = null, + Object? name = null, + }) { + return _then(_UserRef( + id: null == id + ? _self.id + : id // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/user_ref.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/user_ref.g.dart new file mode 100644 index 00000000..af7e90cb --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/user_ref.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_ref.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UserRef _$UserRefFromJson(Map json) => _UserRef( + id: json['id'] as String, + name: json['name'] as String, + ); + +Map _$UserRefToJson(_UserRef instance) => { + 'id': instance.id, + 'name': instance.name, + }; diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/users_api_users_get_query_parameters.dart b/packages/swagger_to_dart/example/lib/src/gen/models/users_api_users_get_query_parameters.dart new file mode 100644 index 00000000..36e2b20c --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/users_api_users_get_query_parameters.dart @@ -0,0 +1,42 @@ +/// UsersApiUsersGetQueryParameters +/// { +/// "properties": { +/// "active": { +/// "type": "boolean", +/// "nullable": true +/// }, +/// "search": { +/// "type": "string", +/// "nullable": true +/// } +/// }, +/// "type": "object", +/// "required": [] +/// } +library users_api_users_get_query_parameters; + +import 'exports.dart'; +part 'users_api_users_get_query_parameters.freezed.dart'; +part 'users_api_users_get_query_parameters.g.dart'; // UsersApiUsersGetQueryParameters + +@freezed +abstract class UsersApiUsersGetQueryParameters + with _$UsersApiUsersGetQueryParameters { + const UsersApiUsersGetQueryParameters._(); + + @jsonSerializable + const factory UsersApiUsersGetQueryParameters({ + /// active + @JsonKey(name: UsersApiUsersGetQueryParameters.activeKey_) bool? active, + + /// search + @JsonKey(name: UsersApiUsersGetQueryParameters.searchKey_) String? search, + }) = _UsersApiUsersGetQueryParameters; + + factory UsersApiUsersGetQueryParameters.fromJson(Map json) => + _$UsersApiUsersGetQueryParametersFromJson(json); + + static const String activeKey_ = r'active'; + + static const String searchKey_ = r'search'; +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/users_api_users_get_query_parameters.freezed.dart b/packages/swagger_to_dart/example/lib/src/gen/models/users_api_users_get_query_parameters.freezed.dart new file mode 100644 index 00000000..93d375ce --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/users_api_users_get_query_parameters.freezed.dart @@ -0,0 +1,369 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'users_api_users_get_query_parameters.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +/// @nodoc +mixin _$UsersApiUsersGetQueryParameters { + /// active + @JsonKey(name: UsersApiUsersGetQueryParameters.activeKey_) + bool? get active; + + /// search + @JsonKey(name: UsersApiUsersGetQueryParameters.searchKey_) + String? get search; + + /// Create a copy of UsersApiUsersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UsersApiUsersGetQueryParametersCopyWith + get copyWith => _$UsersApiUsersGetQueryParametersCopyWithImpl< + UsersApiUsersGetQueryParameters>( + this as UsersApiUsersGetQueryParameters, _$identity); + + /// Serializes this UsersApiUsersGetQueryParameters to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UsersApiUsersGetQueryParameters && + (identical(other.active, active) || other.active == active) && + (identical(other.search, search) || other.search == search)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, active, search); + + @override + String toString() { + return 'UsersApiUsersGetQueryParameters(active: $active, search: $search)'; + } +} + +/// @nodoc +abstract mixin class $UsersApiUsersGetQueryParametersCopyWith<$Res> { + factory $UsersApiUsersGetQueryParametersCopyWith( + UsersApiUsersGetQueryParameters value, + $Res Function(UsersApiUsersGetQueryParameters) _then) = + _$UsersApiUsersGetQueryParametersCopyWithImpl; + @useResult + $Res call( + {@JsonKey(name: UsersApiUsersGetQueryParameters.activeKey_) bool? active, + @JsonKey(name: UsersApiUsersGetQueryParameters.searchKey_) + String? search}); +} + +/// @nodoc +class _$UsersApiUsersGetQueryParametersCopyWithImpl<$Res> + implements $UsersApiUsersGetQueryParametersCopyWith<$Res> { + _$UsersApiUsersGetQueryParametersCopyWithImpl(this._self, this._then); + + final UsersApiUsersGetQueryParameters _self; + final $Res Function(UsersApiUsersGetQueryParameters) _then; + + /// Create a copy of UsersApiUsersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? active = freezed, + Object? search = freezed, + }) { + return _then(_self.copyWith( + active: freezed == active + ? _self.active + : active // ignore: cast_nullable_to_non_nullable + as bool?, + search: freezed == search + ? _self.search + : search // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// Adds pattern-matching-related methods to [UsersApiUsersGetQueryParameters]. +extension UsersApiUsersGetQueryParametersPatterns + on UsersApiUsersGetQueryParameters { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_UsersApiUsersGetQueryParameters value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UsersApiUsersGetQueryParameters() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_UsersApiUsersGetQueryParameters value) $default, + ) { + final _that = this; + switch (_that) { + case _UsersApiUsersGetQueryParameters(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_UsersApiUsersGetQueryParameters value)? $default, + ) { + final _that = this; + switch (_that) { + case _UsersApiUsersGetQueryParameters() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + @JsonKey(name: UsersApiUsersGetQueryParameters.activeKey_) + bool? active, + @JsonKey(name: UsersApiUsersGetQueryParameters.searchKey_) + String? search)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _UsersApiUsersGetQueryParameters() when $default != null: + return $default(_that.active, _that.search); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + @JsonKey(name: UsersApiUsersGetQueryParameters.activeKey_) + bool? active, + @JsonKey(name: UsersApiUsersGetQueryParameters.searchKey_) + String? search) + $default, + ) { + final _that = this; + switch (_that) { + case _UsersApiUsersGetQueryParameters(): + return $default(_that.active, _that.search); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + @JsonKey(name: UsersApiUsersGetQueryParameters.activeKey_) + bool? active, + @JsonKey(name: UsersApiUsersGetQueryParameters.searchKey_) + String? search)? + $default, + ) { + final _that = this; + switch (_that) { + case _UsersApiUsersGetQueryParameters() when $default != null: + return $default(_that.active, _that.search); + case _: + return null; + } + } +} + +/// @nodoc + +@jsonSerializable +class _UsersApiUsersGetQueryParameters extends UsersApiUsersGetQueryParameters { + const _UsersApiUsersGetQueryParameters( + {@JsonKey(name: UsersApiUsersGetQueryParameters.activeKey_) this.active, + @JsonKey(name: UsersApiUsersGetQueryParameters.searchKey_) this.search}) + : super._(); + factory _UsersApiUsersGetQueryParameters.fromJson( + Map json) => + _$UsersApiUsersGetQueryParametersFromJson(json); + + /// active + @override + @JsonKey(name: UsersApiUsersGetQueryParameters.activeKey_) + final bool? active; + + /// search + @override + @JsonKey(name: UsersApiUsersGetQueryParameters.searchKey_) + final String? search; + + /// Create a copy of UsersApiUsersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UsersApiUsersGetQueryParametersCopyWith<_UsersApiUsersGetQueryParameters> + get copyWith => __$UsersApiUsersGetQueryParametersCopyWithImpl< + _UsersApiUsersGetQueryParameters>(this, _$identity); + + @override + Map toJson() { + return _$UsersApiUsersGetQueryParametersToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _UsersApiUsersGetQueryParameters && + (identical(other.active, active) || other.active == active) && + (identical(other.search, search) || other.search == search)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, active, search); + + @override + String toString() { + return 'UsersApiUsersGetQueryParameters(active: $active, search: $search)'; + } +} + +/// @nodoc +abstract mixin class _$UsersApiUsersGetQueryParametersCopyWith<$Res> + implements $UsersApiUsersGetQueryParametersCopyWith<$Res> { + factory _$UsersApiUsersGetQueryParametersCopyWith( + _UsersApiUsersGetQueryParameters value, + $Res Function(_UsersApiUsersGetQueryParameters) _then) = + __$UsersApiUsersGetQueryParametersCopyWithImpl; + @override + @useResult + $Res call( + {@JsonKey(name: UsersApiUsersGetQueryParameters.activeKey_) bool? active, + @JsonKey(name: UsersApiUsersGetQueryParameters.searchKey_) + String? search}); +} + +/// @nodoc +class __$UsersApiUsersGetQueryParametersCopyWithImpl<$Res> + implements _$UsersApiUsersGetQueryParametersCopyWith<$Res> { + __$UsersApiUsersGetQueryParametersCopyWithImpl(this._self, this._then); + + final _UsersApiUsersGetQueryParameters _self; + final $Res Function(_UsersApiUsersGetQueryParameters) _then; + + /// Create a copy of UsersApiUsersGetQueryParameters + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({ + Object? active = freezed, + Object? search = freezed, + }) { + return _then(_UsersApiUsersGetQueryParameters( + active: freezed == active + ? _self.active + : active // ignore: cast_nullable_to_non_nullable + as bool?, + search: freezed == search + ? _self.search + : search // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} diff --git a/packages/swagger_to_dart/example/lib/src/gen/models/users_api_users_get_query_parameters.g.dart b/packages/swagger_to_dart/example/lib/src/gen/models/users_api_users_get_query_parameters.g.dart new file mode 100644 index 00000000..260e361e --- /dev/null +++ b/packages/swagger_to_dart/example/lib/src/gen/models/users_api_users_get_query_parameters.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'users_api_users_get_query_parameters.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UsersApiUsersGetQueryParameters _$UsersApiUsersGetQueryParametersFromJson( + Map json) => + _UsersApiUsersGetQueryParameters( + active: json['active'] as bool?, + search: json['search'] as String?, + ); + +Map _$UsersApiUsersGetQueryParametersToJson( + _UsersApiUsersGetQueryParameters instance) => + { + if (instance.active case final value?) 'active': value, + if (instance.search case final value?) 'search': value, + }; diff --git a/packages/swagger_to_dart/lib/src/generator/api_client/api_client_generator.dart b/packages/swagger_to_dart/lib/src/generator/api_client/api_client_generator.dart index 512c3e0f..2743ecb5 100644 --- a/packages/swagger_to_dart/lib/src/generator/api_client/api_client_generator.dart +++ b/packages/swagger_to_dart/lib/src/generator/api_client/api_client_generator.dart @@ -286,6 +286,7 @@ class ApiClientGenerator { ..body = Block.of([ Code( '''return ${methodName}_($_requestBodyName: $_requestBodyName${canToJson ? '.toJson()' : ''}, extras: extras, + ${parameters.where((e) => e.name != _queriesParameterName).map((e) => '${e.name}: ${e.name},').join('\n')} ${parameters.firstWhereOrNull((e) => e.name == _queriesParameterName) != null ? 'queries: queries,' : ''} cancelToken: cancelToken, onSendProgress: onSendProgress, @@ -451,7 +452,11 @@ class ApiClientGenerator { continue; } - final dartType = context.extension.typeConverter.get( + final isRequired = + p.in_ == OpenApiPathMethodParameterType.path || + (p.required_ ?? false); + + var dartType = context.extension.typeConverter.get( p.schema, className: className, ); @@ -460,6 +465,13 @@ class ApiClientGenerator { p.schema, ); + // An optional parameter without a schema default must be nullable, + // otherwise the generated Dart signature (no `required`, no default, + // non-nullable type) doesn't compile. + if (!isRequired && defaultValue == null && !dartType.endsWith('?')) { + dartType = '$dartType?'; + } + result.add( Parameter( (b) => b @@ -481,7 +493,7 @@ class ApiClientGenerator { ]) ..named = true ..name = Renaming.instance.renameProperty(p.name) - ..required = defaultValue == null + ..required = isRequired ..defaultTo = defaultValue == null ? null : Code(defaultValue) ..type = refer(dartType), ), diff --git a/packages/swagger_to_dart/lib/src/generator/model/model_generator.dart b/packages/swagger_to_dart/lib/src/generator/model/model_generator.dart index 48197890..4f8609d8 100644 --- a/packages/swagger_to_dart/lib/src/generator/model/model_generator.dart +++ b/packages/swagger_to_dart/lib/src/generator/model/model_generator.dart @@ -10,6 +10,16 @@ class ModelGenerator extends LibraryGenerator { Library build(MapEntry model) { final schema = model.value; + // Check if this is a top-level oneOf schema + if (schema.oneOf != null && schema.oneOf!.isNotEmpty) { + // Check if all oneOf items are references (refs) + final oneOf = schema.oneOf!; + if (oneOf.every((e) => e is OpenApiSchemaRef)) { + final strategy = UnionModelStrategy(context); + return strategy.buildFromTopLevelSchema(model); + } + } + final ModelGeneratorStrategy strategy; if (schema.enum_ != null) { diff --git a/packages/swagger_to_dart/lib/src/generator/model/strategy/enum_model_generator_strategy.dart b/packages/swagger_to_dart/lib/src/generator/model/strategy/enum_model_generator_strategy.dart index dae10bd2..0f369315 100644 --- a/packages/swagger_to_dart/lib/src/generator/model/strategy/enum_model_generator_strategy.dart +++ b/packages/swagger_to_dart/lib/src/generator/model/strategy/enum_model_generator_strategy.dart @@ -46,8 +46,10 @@ class EnumModelGeneratorStrategy ); final filename = Renaming.instance.renameFile(className); - // Can be a list of [String] or an [int]. - final values = model.value.enum_ ?? []; + // Can be a list of [String] or an [int]. A `null` entry marks the schema as nullable + // (OpenAPI 3.1 idiom for nullable enums) and isn't a real enum member — the containing + // property's own nullability already expresses that, so it's filtered out here. + final values = (model.value.enum_ ?? []).whereType().toList(); final enumFallbackType = context.config.model.enumFallbackType; diff --git a/packages/swagger_to_dart/lib/src/generator/model/strategy/union_model_strategy.dart b/packages/swagger_to_dart/lib/src/generator/model/strategy/union_model_strategy.dart index 4a558388..5a4faa11 100644 --- a/packages/swagger_to_dart/lib/src/generator/model/strategy/union_model_strategy.dart +++ b/packages/swagger_to_dart/lib/src/generator/model/strategy/union_model_strategy.dart @@ -24,6 +24,9 @@ class UnionModelStrategy extends ModelGeneratorStrategy { const UnionModelStrategy(super.context); + /// Helper to generate a key field name (e.g., 'productIdKey_') + static String getKey(String name) => '${name}Key_'; + @override Library build(UnionModelStrategyParams params) { final unionClassFallbackName = context.config.model.unionClassFallbackName; @@ -35,15 +38,75 @@ class UnionModelStrategy ); final filename = Renaming.instance.renameFile(className); - const String valueKeyName = 'value'; + // First pass: collect all unique property keys across all union cases + // Map from original JSON key -> renamed Dart property name + final Map allPropertyKeys = {}; + + for (final entry in params.refSchemaMap.entries) { + final refSchema = entry.value; + final referencedSchema = context.openApi.getOpenApiSchemasByRef(refSchema.ref!); + final properties = referencedSchema?.properties ?? {}; + + for (final propEntry in properties.entries) { + final originalKey = propEntry.key; + final propName = Renaming.instance.renameProperty(originalKey); + allPropertyKeys[originalKey] = propName; + } + } + + // Generate static const String fields for all unique property keys + final keyFields = allPropertyKeys.entries.map((entry) { + final originalKey = entry.key; + final propName = entry.value; + + return Field( + (b) => b + ..static = true + ..modifier = FieldModifier.constant + ..name = getKey(propName) + ..type = refer('$String') + ..assignment = stringCode(originalKey), + ); + }).toList(); + // Second pass: generate union constructors with proper key references final unions = params.refSchemaMap.entries.map((entry) { final name = entry.key; + final refSchema = entry.value; - final type = context.extension.typeConverter.get( - entry.value, - className: className, - ); + // Get the referenced schema to inline its properties + final referencedSchema = context.openApi.getOpenApiSchemasByRef(refSchema.ref!); + final properties = referencedSchema?.properties ?? {}; + final requiredProps = referencedSchema?.required_ ?? []; + + // Generate parameters for each property of the referenced schema + final parameters = properties.entries.map((propEntry) { + final propName = Renaming.instance.renameProperty(propEntry.key); + final dartType = context.extension.typeConverter.get( + propEntry.value, + className: className, + ); + final defaultValue = context.extension.typeConverter.getDefaultValue(propEntry.value); + final isRequired = requiredProps.contains(propEntry.key) && defaultValue == null; + final isNullable = dartType.endsWith('?'); + final hasDefaultValue = defaultValue != null; + final adjustedDartType = (!hasDefaultValue && !isNullable && !isRequired) + ? '$dartType?' + : dartType; + + return Parameter( + (b) => b + ..docs.add('/// $propName') + ..named = true + ..required = isRequired + ..annotations.addAll([ + if (hasDefaultValue) refer('$Default($defaultValue)'), + refer('JsonKey(name: $className.${getKey(propName)})'), + ]) + ..name = propName + ..type = refer(adjustedDartType), + ); + }).toList(); return Constructor( (b) => b @@ -55,17 +118,11 @@ class UnionModelStrategy ..factory = true ..name = Recase.instance.toCamelCase(name) ..redirect = refer(className + Recase.instance.toPascalCase(name)) - ..requiredParameters.addAll([ - Parameter( - (b) => b - ..named = true - ..name = valueKeyName - ..type = refer(type), - ) - ]), + ..optionalParameters.addAll(parameters), ); }).toList(); + // With inlined properties, the JSON converter simply passes through the JSON context.addJsonConvertor( Class( (b) => b @@ -74,16 +131,6 @@ class UnionModelStrategy refer('JsonConverter<$className, Map>'), ]) ..constructors.add(Constructor((b) => b..constant = true)) - ..fields.addAll([ - Field( - (b) => b - ..modifier = FieldModifier.constant - ..static = true - ..name = 'unionKey' - ..type = refer('String') - ..assignment = stringCode(valueKeyName), - ) - ]) ..methods.addAll([ Method( (b) => b @@ -97,8 +144,7 @@ class UnionModelStrategy ..name = 'json' ..type = refer('Map')), ]) - ..body = Code( - 'return $className.fromJson({unionKey: json, ...json});'), + ..body = Code('return $className.fromJson(json);'), ), Method( (b) => b @@ -112,8 +158,7 @@ class UnionModelStrategy ..name = 'object' ..type = refer(className)), ]) - ..body = Code( - 'return {unionKey: object.toJson(), ...object.toJson()};'), + ..body = Code('return object.toJson();'), ) ]), ), @@ -151,6 +196,7 @@ class UnionModelStrategy ..sealed = true ..name = className ..mixins.addAll([refer('_\$$className')]) + ..fields.addAll(keyFields) ..constructors.addAll([ Constructor( (b) => b @@ -171,11 +217,11 @@ class UnionModelStrategy ..redirect = refer( className + Recase.instance.toPascalCase(fallbackName), ) - ..requiredParameters.addAll([ + ..optionalParameters.addAll([ Parameter( (b) => b ..named = true - ..name = valueKeyName + ..name = 'json' ..type = refer('Map?'), ) ]), @@ -309,6 +355,54 @@ class UnionModelStrategy return (model, className); } + /// Build a union model from a top-level schema (OpenApiSchemas) that has oneOf. + /// This handles the case when oneOf/discriminator are defined at the schema level + /// rather than as a nested property. + Library buildFromTopLevelSchema(MapEntry entry) { + final schemaName = entry.key; + final schema = entry.value; + final oneOf = schema.oneOf!; + final discriminator = schema.discriminator; + + final prefixes = context.config.model.removeModelPrefixes; + final String className = Renaming.instance.renameClass( + schema.title ?? schemaName, + removePrefixes: prefixes.isNotEmpty ? prefixes : null, + ); + + final Map refSchemaMap; + if (discriminator case final discriminator?) { + refSchemaMap = { + for (final mapEntry in discriminator.mapping.entries) + mapEntry.key: oneOf + .whereType() + .firstWhere((e) => e.ref == mapEntry.value), + }; + } else { + refSchemaMap = { + for (final refSchema in oneOf.whereType()) + refSchema.name: refSchema, + }; + } + + // Create an OpenApiSchemaOneOf to pass to the build method + final oneOfSchema = OpenApiSchemaOneOf( + oneOf: oneOf, + title: schema.title ?? schemaName, + discriminator: discriminator, + description: schema.description, + ); + + return build( + UnionModelStrategyParams( + key: className, + schema: oneOfSchema, + refSchemaMap: refSchemaMap, + discriminator: discriminator, + ), + ); + } + Reference _freezedAnnotation({ required String? unionClassFallbackName, required String? unionKey, diff --git a/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.dart b/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.dart index f69d781b..ab9deb11 100644 --- a/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.dart +++ b/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.dart @@ -26,14 +26,18 @@ abstract class OpenApiSchemas with _$OpenApiSchemas { @OpenApiSchemaJsonConverter() @JsonKey(name: 'properties') required Map? properties, - @JsonKey(name: 'type') required String type, + @JsonKey(name: 'type') String? type, @JsonKey(name: 'required') List? required_, - @JsonKey(name: 'enum') List? enum_, + @JsonKey(name: 'enum') List? enum_, @JsonKey(name: 'const') Object? const_, @JsonKey(name: 'title') String? title, @JsonKey(name: 'description') String? description, @JsonKey(name: 'x-enum-varnames') List? xEnumVarnames, @JsonKey(name: 'additionalProperties') bool? additionalProperties, + @OpenApiSchemaJsonConverter() + @JsonKey(name: 'oneOf') + List? oneOf, + @JsonKey(name: 'discriminator') OpenApiSchemaOneOfDiscriminator? discriminator, }) = _OpenApiSchemas; factory OpenApiSchemas.fromJson(Map json) => diff --git a/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.freezed.dart b/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.freezed.dart index 071ba2ac..e19225fa 100644 --- a/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.freezed.dart +++ b/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.freezed.dart @@ -382,11 +382,11 @@ mixin _$OpenApiSchemas { @JsonKey(name: 'properties') Map? get properties; @JsonKey(name: 'type') - String get type; + String? get type; @JsonKey(name: 'required') List? get required_; @JsonKey(name: 'enum') - List? get enum_; + List? get enum_; @JsonKey(name: 'const') Object? get const_; @JsonKey(name: 'title') @@ -397,6 +397,11 @@ mixin _$OpenApiSchemas { List? get xEnumVarnames; @JsonKey(name: 'additionalProperties') bool? get additionalProperties; + @OpenApiSchemaJsonConverter() + @JsonKey(name: 'oneOf') + List? get oneOf; + @JsonKey(name: 'discriminator') + OpenApiSchemaOneOfDiscriminator? get discriminator; /// Create a copy of OpenApiSchemas /// with the given fields replaced by the non-null parameter values. @@ -426,7 +431,10 @@ mixin _$OpenApiSchemas { const DeepCollectionEquality() .equals(other.xEnumVarnames, xEnumVarnames) && (identical(other.additionalProperties, additionalProperties) || - other.additionalProperties == additionalProperties)); + other.additionalProperties == additionalProperties) && + const DeepCollectionEquality().equals(other.oneOf, oneOf) && + (identical(other.discriminator, discriminator) || + other.discriminator == discriminator)); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -441,11 +449,13 @@ mixin _$OpenApiSchemas { title, description, const DeepCollectionEquality().hash(xEnumVarnames), - additionalProperties); + additionalProperties, + const DeepCollectionEquality().hash(oneOf), + discriminator); @override String toString() { - return 'OpenApiSchemas(properties: $properties, type: $type, required_: $required_, enum_: $enum_, const_: $const_, title: $title, description: $description, xEnumVarnames: $xEnumVarnames, additionalProperties: $additionalProperties)'; + return 'OpenApiSchemas(properties: $properties, type: $type, required_: $required_, enum_: $enum_, const_: $const_, title: $title, description: $description, xEnumVarnames: $xEnumVarnames, additionalProperties: $additionalProperties, oneOf: $oneOf, discriminator: $discriminator)'; } } @@ -459,14 +469,21 @@ abstract mixin class $OpenApiSchemasCopyWith<$Res> { {@OpenApiSchemaJsonConverter() @JsonKey(name: 'properties') Map? properties, - @JsonKey(name: 'type') String type, + @JsonKey(name: 'type') String? type, @JsonKey(name: 'required') List? required_, - @JsonKey(name: 'enum') List? enum_, + @JsonKey(name: 'enum') List? enum_, @JsonKey(name: 'const') Object? const_, @JsonKey(name: 'title') String? title, @JsonKey(name: 'description') String? description, @JsonKey(name: 'x-enum-varnames') List? xEnumVarnames, - @JsonKey(name: 'additionalProperties') bool? additionalProperties}); + @JsonKey(name: 'additionalProperties') bool? additionalProperties, + @OpenApiSchemaJsonConverter() + @JsonKey(name: 'oneOf') + List? oneOf, + @JsonKey(name: 'discriminator') + OpenApiSchemaOneOfDiscriminator? discriminator}); + + $OpenApiSchemaOneOfDiscriminatorCopyWith<$Res>? get discriminator; } /// @nodoc @@ -483,7 +500,7 @@ class _$OpenApiSchemasCopyWithImpl<$Res> @override $Res call({ Object? properties = freezed, - Object? type = null, + Object? type = freezed, Object? required_ = freezed, Object? enum_ = freezed, Object? const_ = freezed, @@ -491,16 +508,18 @@ class _$OpenApiSchemasCopyWithImpl<$Res> Object? description = freezed, Object? xEnumVarnames = freezed, Object? additionalProperties = freezed, + Object? oneOf = freezed, + Object? discriminator = freezed, }) { return _then(_self.copyWith( properties: freezed == properties ? _self.properties : properties // ignore: cast_nullable_to_non_nullable as Map?, - type: null == type + type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable - as String, + as String?, required_: freezed == required_ ? _self.required_ : required_ // ignore: cast_nullable_to_non_nullable @@ -508,7 +527,7 @@ class _$OpenApiSchemasCopyWithImpl<$Res> enum_: freezed == enum_ ? _self.enum_ : enum_ // ignore: cast_nullable_to_non_nullable - as List?, + as List?, const_: freezed == const_ ? _self.const_ : const_, title: freezed == title ? _self.title @@ -526,8 +545,31 @@ class _$OpenApiSchemasCopyWithImpl<$Res> ? _self.additionalProperties : additionalProperties // ignore: cast_nullable_to_non_nullable as bool?, + oneOf: freezed == oneOf + ? _self.oneOf + : oneOf // ignore: cast_nullable_to_non_nullable + as List?, + discriminator: freezed == discriminator + ? _self.discriminator + : discriminator // ignore: cast_nullable_to_non_nullable + as OpenApiSchemaOneOfDiscriminator?, )); } + + /// Create a copy of OpenApiSchemas + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $OpenApiSchemaOneOfDiscriminatorCopyWith<$Res>? get discriminator { + if (_self.discriminator == null) { + return null; + } + + return $OpenApiSchemaOneOfDiscriminatorCopyWith<$Res>(_self.discriminator!, + (value) { + return _then(_self.copyWith(discriminator: value)); + }); + } } /// Adds pattern-matching-related methods to [OpenApiSchemas]. @@ -627,14 +669,19 @@ extension OpenApiSchemasPatterns on OpenApiSchemas { @OpenApiSchemaJsonConverter() @JsonKey(name: 'properties') Map? properties, - @JsonKey(name: 'type') String type, + @JsonKey(name: 'type') String? type, @JsonKey(name: 'required') List? required_, - @JsonKey(name: 'enum') List? enum_, + @JsonKey(name: 'enum') List? enum_, @JsonKey(name: 'const') Object? const_, @JsonKey(name: 'title') String? title, @JsonKey(name: 'description') String? description, @JsonKey(name: 'x-enum-varnames') List? xEnumVarnames, - @JsonKey(name: 'additionalProperties') bool? additionalProperties)? + @JsonKey(name: 'additionalProperties') bool? additionalProperties, + @OpenApiSchemaJsonConverter() + @JsonKey(name: 'oneOf') + List? oneOf, + @JsonKey(name: 'discriminator') + OpenApiSchemaOneOfDiscriminator? discriminator)? $default, { required TResult orElse(), }) { @@ -650,7 +697,9 @@ extension OpenApiSchemasPatterns on OpenApiSchemas { _that.title, _that.description, _that.xEnumVarnames, - _that.additionalProperties); + _that.additionalProperties, + _that.oneOf, + _that.discriminator); case _: return orElse(); } @@ -675,14 +724,19 @@ extension OpenApiSchemasPatterns on OpenApiSchemas { @OpenApiSchemaJsonConverter() @JsonKey(name: 'properties') Map? properties, - @JsonKey(name: 'type') String type, + @JsonKey(name: 'type') String? type, @JsonKey(name: 'required') List? required_, - @JsonKey(name: 'enum') List? enum_, + @JsonKey(name: 'enum') List? enum_, @JsonKey(name: 'const') Object? const_, @JsonKey(name: 'title') String? title, @JsonKey(name: 'description') String? description, @JsonKey(name: 'x-enum-varnames') List? xEnumVarnames, - @JsonKey(name: 'additionalProperties') bool? additionalProperties) + @JsonKey(name: 'additionalProperties') bool? additionalProperties, + @OpenApiSchemaJsonConverter() + @JsonKey(name: 'oneOf') + List? oneOf, + @JsonKey(name: 'discriminator') + OpenApiSchemaOneOfDiscriminator? discriminator) $default, ) { final _that = this; @@ -697,7 +751,9 @@ extension OpenApiSchemasPatterns on OpenApiSchemas { _that.title, _that.description, _that.xEnumVarnames, - _that.additionalProperties); + _that.additionalProperties, + _that.oneOf, + _that.discriminator); case _: throw StateError('Unexpected subclass'); } @@ -721,14 +777,19 @@ extension OpenApiSchemasPatterns on OpenApiSchemas { @OpenApiSchemaJsonConverter() @JsonKey(name: 'properties') Map? properties, - @JsonKey(name: 'type') String type, + @JsonKey(name: 'type') String? type, @JsonKey(name: 'required') List? required_, - @JsonKey(name: 'enum') List? enum_, + @JsonKey(name: 'enum') List? enum_, @JsonKey(name: 'const') Object? const_, @JsonKey(name: 'title') String? title, @JsonKey(name: 'description') String? description, @JsonKey(name: 'x-enum-varnames') List? xEnumVarnames, - @JsonKey(name: 'additionalProperties') bool? additionalProperties)? + @JsonKey(name: 'additionalProperties') bool? additionalProperties, + @OpenApiSchemaJsonConverter() + @JsonKey(name: 'oneOf') + List? oneOf, + @JsonKey(name: 'discriminator') + OpenApiSchemaOneOfDiscriminator? discriminator)? $default, ) { final _that = this; @@ -743,7 +804,9 @@ extension OpenApiSchemasPatterns on OpenApiSchemas { _that.title, _that.description, _that.xEnumVarnames, - _that.additionalProperties); + _that.additionalProperties, + _that.oneOf, + _that.discriminator); case _: return null; } @@ -757,18 +820,23 @@ class _OpenApiSchemas extends OpenApiSchemas { {@OpenApiSchemaJsonConverter() @JsonKey(name: 'properties') required final Map? properties, - @JsonKey(name: 'type') required this.type, + @JsonKey(name: 'type') this.type, @JsonKey(name: 'required') final List? required_, - @JsonKey(name: 'enum') final List? enum_, + @JsonKey(name: 'enum') final List? enum_, @JsonKey(name: 'const') this.const_, @JsonKey(name: 'title') this.title, @JsonKey(name: 'description') this.description, @JsonKey(name: 'x-enum-varnames') final List? xEnumVarnames, - @JsonKey(name: 'additionalProperties') this.additionalProperties}) + @JsonKey(name: 'additionalProperties') this.additionalProperties, + @OpenApiSchemaJsonConverter() + @JsonKey(name: 'oneOf') + final List? oneOf, + @JsonKey(name: 'discriminator') this.discriminator}) : _properties = properties, _required_ = required_, _enum_ = enum_, _xEnumVarnames = xEnumVarnames, + _oneOf = oneOf, super._(); factory _OpenApiSchemas.fromJson(Map json) => _$OpenApiSchemasFromJson(json); @@ -787,7 +855,7 @@ class _OpenApiSchemas extends OpenApiSchemas { @override @JsonKey(name: 'type') - final String type; + final String? type; final List? _required_; @override @JsonKey(name: 'required') @@ -799,10 +867,10 @@ class _OpenApiSchemas extends OpenApiSchemas { return EqualUnmodifiableListView(value); } - final List? _enum_; + final List? _enum_; @override @JsonKey(name: 'enum') - List? get enum_ { + List? get enum_ { final value = _enum_; if (value == null) return null; if (_enum_ is EqualUnmodifiableListView) return _enum_; @@ -833,6 +901,21 @@ class _OpenApiSchemas extends OpenApiSchemas { @override @JsonKey(name: 'additionalProperties') final bool? additionalProperties; + final List? _oneOf; + @override + @OpenApiSchemaJsonConverter() + @JsonKey(name: 'oneOf') + List? get oneOf { + final value = _oneOf; + if (value == null) return null; + if (_oneOf is EqualUnmodifiableListView) return _oneOf; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + @JsonKey(name: 'discriminator') + final OpenApiSchemaOneOfDiscriminator? discriminator; /// Create a copy of OpenApiSchemas /// with the given fields replaced by the non-null parameter values. @@ -867,7 +950,10 @@ class _OpenApiSchemas extends OpenApiSchemas { const DeepCollectionEquality() .equals(other._xEnumVarnames, _xEnumVarnames) && (identical(other.additionalProperties, additionalProperties) || - other.additionalProperties == additionalProperties)); + other.additionalProperties == additionalProperties) && + const DeepCollectionEquality().equals(other._oneOf, _oneOf) && + (identical(other.discriminator, discriminator) || + other.discriminator == discriminator)); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -882,11 +968,13 @@ class _OpenApiSchemas extends OpenApiSchemas { title, description, const DeepCollectionEquality().hash(_xEnumVarnames), - additionalProperties); + additionalProperties, + const DeepCollectionEquality().hash(_oneOf), + discriminator); @override String toString() { - return 'OpenApiSchemas(properties: $properties, type: $type, required_: $required_, enum_: $enum_, const_: $const_, title: $title, description: $description, xEnumVarnames: $xEnumVarnames, additionalProperties: $additionalProperties)'; + return 'OpenApiSchemas(properties: $properties, type: $type, required_: $required_, enum_: $enum_, const_: $const_, title: $title, description: $description, xEnumVarnames: $xEnumVarnames, additionalProperties: $additionalProperties, oneOf: $oneOf, discriminator: $discriminator)'; } } @@ -902,14 +990,22 @@ abstract mixin class _$OpenApiSchemasCopyWith<$Res> {@OpenApiSchemaJsonConverter() @JsonKey(name: 'properties') Map? properties, - @JsonKey(name: 'type') String type, + @JsonKey(name: 'type') String? type, @JsonKey(name: 'required') List? required_, - @JsonKey(name: 'enum') List? enum_, + @JsonKey(name: 'enum') List? enum_, @JsonKey(name: 'const') Object? const_, @JsonKey(name: 'title') String? title, @JsonKey(name: 'description') String? description, @JsonKey(name: 'x-enum-varnames') List? xEnumVarnames, - @JsonKey(name: 'additionalProperties') bool? additionalProperties}); + @JsonKey(name: 'additionalProperties') bool? additionalProperties, + @OpenApiSchemaJsonConverter() + @JsonKey(name: 'oneOf') + List? oneOf, + @JsonKey(name: 'discriminator') + OpenApiSchemaOneOfDiscriminator? discriminator}); + + @override + $OpenApiSchemaOneOfDiscriminatorCopyWith<$Res>? get discriminator; } /// @nodoc @@ -926,7 +1022,7 @@ class __$OpenApiSchemasCopyWithImpl<$Res> @pragma('vm:prefer-inline') $Res call({ Object? properties = freezed, - Object? type = null, + Object? type = freezed, Object? required_ = freezed, Object? enum_ = freezed, Object? const_ = freezed, @@ -934,16 +1030,18 @@ class __$OpenApiSchemasCopyWithImpl<$Res> Object? description = freezed, Object? xEnumVarnames = freezed, Object? additionalProperties = freezed, + Object? oneOf = freezed, + Object? discriminator = freezed, }) { return _then(_OpenApiSchemas( properties: freezed == properties ? _self._properties : properties // ignore: cast_nullable_to_non_nullable as Map?, - type: null == type + type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable - as String, + as String?, required_: freezed == required_ ? _self._required_ : required_ // ignore: cast_nullable_to_non_nullable @@ -951,7 +1049,7 @@ class __$OpenApiSchemasCopyWithImpl<$Res> enum_: freezed == enum_ ? _self._enum_ : enum_ // ignore: cast_nullable_to_non_nullable - as List?, + as List?, const_: freezed == const_ ? _self.const_ : const_, title: freezed == title ? _self.title @@ -969,6 +1067,29 @@ class __$OpenApiSchemasCopyWithImpl<$Res> ? _self.additionalProperties : additionalProperties // ignore: cast_nullable_to_non_nullable as bool?, + oneOf: freezed == oneOf + ? _self._oneOf + : oneOf // ignore: cast_nullable_to_non_nullable + as List?, + discriminator: freezed == discriminator + ? _self.discriminator + : discriminator // ignore: cast_nullable_to_non_nullable + as OpenApiSchemaOneOfDiscriminator?, )); } + + /// Create a copy of OpenApiSchemas + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $OpenApiSchemaOneOfDiscriminatorCopyWith<$Res>? get discriminator { + if (_self.discriminator == null) { + return null; + } + + return $OpenApiSchemaOneOfDiscriminatorCopyWith<$Res>(_self.discriminator!, + (value) { + return _then(_self.copyWith(discriminator: value)); + }); + } } diff --git a/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.g.dart b/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.g.dart index 09100af6..fb117dba 100644 --- a/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.g.dart +++ b/packages/swagger_to_dart/lib/src/schema/openapi/v3/open_api_components.g.dart @@ -31,11 +31,11 @@ _OpenApiSchemas _$OpenApiSchemasFromJson(Map json) => const OpenApiSchemaJsonConverter() .fromJson(e as Map)), ), - type: json['type'] as String, + type: json['type'] as String?, required_: (json['required'] as List?) ?.map((e) => e as String) .toList(), - enum_: (json['enum'] as List?)?.map((e) => e as Object).toList(), + enum_: json['enum'] as List?, const_: json['const'], title: json['title'] as String?, description: json['description'] as String?, @@ -43,6 +43,14 @@ _OpenApiSchemas _$OpenApiSchemasFromJson(Map json) => ?.map((e) => e as String) .toList(), additionalProperties: json['additionalProperties'] as bool?, + oneOf: (json['oneOf'] as List?) + ?.map((e) => const OpenApiSchemaJsonConverter() + .fromJson(e as Map)) + .toList(), + discriminator: json['discriminator'] == null + ? null + : OpenApiSchemaOneOfDiscriminator.fromJson( + json['discriminator'] as Map), ); Map _$OpenApiSchemasToJson(_OpenApiSchemas instance) => @@ -51,7 +59,7 @@ Map _$OpenApiSchemasToJson(_OpenApiSchemas instance) => MapEntry(k, const OpenApiSchemaJsonConverter().toJson(e))) case final value?) 'properties': value, - 'type': instance.type, + if (instance.type case final value?) 'type': value, if (instance.required_ case final value?) 'required': value, if (instance.enum_ case final value?) 'enum': value, if (instance.const_ case final value?) 'const': value, @@ -60,4 +68,11 @@ Map _$OpenApiSchemasToJson(_OpenApiSchemas instance) => if (instance.xEnumVarnames case final value?) 'x-enum-varnames': value, if (instance.additionalProperties case final value?) 'additionalProperties': value, + if (instance.oneOf + ?.map(const OpenApiSchemaJsonConverter().toJson) + .toList() + case final value?) + 'oneOf': value, + if (instance.discriminator?.toJson() case final value?) + 'discriminator': value, };