unitysvc-services 0.1.0__py3-none-any.whl → 0.1.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- unitysvc_services/api.py +278 -0
- unitysvc_services/format_data.py +2 -7
- unitysvc_services/list.py +14 -43
- unitysvc_services/models/base.py +139 -0
- unitysvc_services/models/listing_v1.py +23 -3
- unitysvc_services/models/provider_v1.py +23 -2
- unitysvc_services/models/seller_v1.py +12 -6
- unitysvc_services/models/service_v1.py +8 -1
- unitysvc_services/populate.py +2 -6
- unitysvc_services/publisher.py +732 -467
- unitysvc_services/py.typed +0 -0
- unitysvc_services/query.py +521 -318
- unitysvc_services/update.py +10 -14
- unitysvc_services/utils.py +105 -7
- unitysvc_services/validator.py +194 -10
- {unitysvc_services-0.1.0.dist-info → unitysvc_services-0.1.4.dist-info}/METADATA +42 -39
- unitysvc_services-0.1.4.dist-info/RECORD +25 -0
- unitysvc_services-0.1.0.dist-info/RECORD +0 -23
- {unitysvc_services-0.1.0.dist-info → unitysvc_services-0.1.4.dist-info}/WHEEL +0 -0
- {unitysvc_services-0.1.0.dist-info → unitysvc_services-0.1.4.dist-info}/entry_points.txt +0 -0
- {unitysvc_services-0.1.0.dist-info → unitysvc_services-0.1.4.dist-info}/licenses/LICENSE +0 -0
- {unitysvc_services-0.1.0.dist-info → unitysvc_services-0.1.4.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
from datetime import datetime
|
2
2
|
|
3
|
-
from pydantic import BaseModel, ConfigDict, EmailStr, Field, HttpUrl
|
3
|
+
from pydantic import BaseModel, ConfigDict, EmailStr, Field, HttpUrl, field_validator
|
4
4
|
|
5
|
-
from unitysvc_services.models.base import Document, SellerTypeEnum
|
5
|
+
from unitysvc_services.models.base import Document, SellerStatusEnum, SellerTypeEnum, validate_name
|
6
6
|
|
7
7
|
|
8
8
|
class SellerV1(BaseModel):
|
@@ -98,13 +98,19 @@ class SellerV1(BaseModel):
|
|
98
98
|
# fields for business operation purposes
|
99
99
|
#
|
100
100
|
|
101
|
-
# Status
|
102
|
-
|
103
|
-
default=
|
104
|
-
description="
|
101
|
+
# Status field to track seller state
|
102
|
+
status: SellerStatusEnum = Field(
|
103
|
+
default=SellerStatusEnum.active,
|
104
|
+
description="Seller status: active, disabled, or incomplete",
|
105
105
|
)
|
106
106
|
|
107
107
|
is_verified: bool = Field(
|
108
108
|
default=False,
|
109
109
|
description="Whether the seller has been verified (KYC/business verification)",
|
110
110
|
)
|
111
|
+
|
112
|
+
@field_validator("name")
|
113
|
+
@classmethod
|
114
|
+
def validate_name_format(cls, v: str) -> str:
|
115
|
+
"""Validate that seller name uses URL-safe identifiers."""
|
116
|
+
return validate_name(v, "seller", allow_slash=False)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from datetime import datetime
|
2
2
|
from typing import Any
|
3
3
|
|
4
|
-
from pydantic import BaseModel, ConfigDict, Field, HttpUrl
|
4
|
+
from pydantic import BaseModel, ConfigDict, Field, HttpUrl, field_validator
|
5
5
|
|
6
6
|
from unitysvc_services.models.base import (
|
7
7
|
AccessInterface,
|
@@ -10,6 +10,7 @@ from unitysvc_services.models.base import (
|
|
10
10
|
ServiceTypeEnum,
|
11
11
|
TagEnum,
|
12
12
|
UpstreamStatusEnum,
|
13
|
+
validate_name,
|
13
14
|
)
|
14
15
|
|
15
16
|
|
@@ -78,3 +79,9 @@ class ServiceV1(BaseModel):
|
|
78
79
|
# a list of pricing models
|
79
80
|
#
|
80
81
|
upstream_price: Pricing | None = Field(description="List of pricing information")
|
82
|
+
|
83
|
+
@field_validator("name")
|
84
|
+
@classmethod
|
85
|
+
def validate_name_format(cls, v: str) -> str:
|
86
|
+
"""Validate that service name uses valid identifiers (allows slashes for hierarchical names)."""
|
87
|
+
return validate_name(v, "service", allow_slash=True)
|
unitysvc_services/populate.py
CHANGED
@@ -19,7 +19,7 @@ console = Console()
|
|
19
19
|
def populate(
|
20
20
|
data_dir: Path | None = typer.Argument(
|
21
21
|
None,
|
22
|
-
help="Directory containing provider data files (default:
|
22
|
+
help="Directory containing provider data files (default: current directory)",
|
23
23
|
),
|
24
24
|
provider_name: str | None = typer.Option(
|
25
25
|
None,
|
@@ -41,11 +41,7 @@ def populate(
|
|
41
41
|
"""
|
42
42
|
# Set data directory
|
43
43
|
if data_dir is None:
|
44
|
-
|
45
|
-
if data_dir_str:
|
46
|
-
data_dir = Path(data_dir_str)
|
47
|
-
else:
|
48
|
-
data_dir = Path.cwd() / "data"
|
44
|
+
data_dir = Path.cwd()
|
49
45
|
|
50
46
|
if not data_dir.is_absolute():
|
51
47
|
data_dir = Path.cwd() / data_dir
|