Initial commit with Advoware proxy

This commit is contained in:
root
2025-10-19 14:57:07 +00:00
commit 273aa8b549
45771 changed files with 5534555 additions and 0 deletions

View File

View File

@@ -0,0 +1,37 @@
import httpx
from typing import Dict, Any
from .types import Order, Pet
class PetStoreService:
async def create_pet(self, pet: Dict[str, Any]) -> Pet:
pet_data = {
"name": pet.get("name", ""),
"photoUrls": [pet.get("photoUrl", "")],
"status": "available"
}
async with httpx.AsyncClient() as client:
response = await client.post(
'https://petstore.swagger.io/v2/pet',
json=pet_data,
headers={'Content-Type': 'application/json'}
)
return response.json()
async def create_order(self, order: Dict[str, Any]) -> Order:
async with httpx.AsyncClient() as client:
order_data = {
"quantity": order.get("quantity", 1),
"petId": 1,
"shipDate": order.get("ship_date", "2025-08-22T22:07:04.730Z"),
"status": order.get("status", "placed"),
}
response = await client.post(
'https://petstore.swagger.io/v2/store/order',
json=order_data,
headers={'Content-Type': 'application/json'}
)
return response.json()
pet_store_service = PetStoreService()

View File

@@ -0,0 +1,19 @@
from pydantic import BaseModel
from enum import Enum
class OrderStatus(str, Enum):
PLACED = "placed"
APPROVED = "approved"
DELIVERED = "delivered"
class Pet(BaseModel):
id: int
name: str
photoUrl: str
class Order(BaseModel):
id: str
quantity: int
petId: int
shipDate: str
status: OrderStatus