unitysvc-services 0.2.0__py3-none-any.whl → 0.2.2__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/publisher.py +25 -108
- unitysvc_services/py.typed +0 -0
- unitysvc_services/query.py +18 -34
- {unitysvc_services-0.2.0.dist-info → unitysvc_services-0.2.2.dist-info}/METADATA +1 -1
- {unitysvc_services-0.2.0.dist-info → unitysvc_services-0.2.2.dist-info}/RECORD +9 -8
- {unitysvc_services-0.2.0.dist-info → unitysvc_services-0.2.2.dist-info}/WHEEL +0 -0
- {unitysvc_services-0.2.0.dist-info → unitysvc_services-0.2.2.dist-info}/entry_points.txt +0 -0
- {unitysvc_services-0.2.0.dist-info → unitysvc_services-0.2.2.dist-info}/licenses/LICENSE +0 -0
- {unitysvc_services-0.2.0.dist-info → unitysvc_services-0.2.2.dist-info}/top_level.txt +0 -0
unitysvc_services/publisher.py
CHANGED
@@ -19,12 +19,19 @@ from .validator import DataValidator
|
|
19
19
|
class ServiceDataPublisher:
|
20
20
|
"""Publishes service data to UnitySVC backend endpoints."""
|
21
21
|
|
22
|
-
def __init__(self
|
23
|
-
self.base_url =
|
24
|
-
self.
|
22
|
+
def __init__(self) -> None:
|
23
|
+
self.base_url = os.environ.get("UNITYSVC_BASE_URL")
|
24
|
+
if not self.base_url:
|
25
|
+
raise ValueError("UNITYSVC_BASE_URL environment variable not set")
|
26
|
+
|
27
|
+
self.api_key = os.environ.get("UNITYSVC_API_KEY")
|
28
|
+
if not self.api_key:
|
29
|
+
raise ValueError("UNITYSVC_API_KEY environment variable not set")
|
30
|
+
|
31
|
+
self.base_url = self.base_url.rstrip("/")
|
25
32
|
self.client = httpx.Client(
|
26
33
|
headers={
|
27
|
-
"X-API-Key": api_key,
|
34
|
+
"X-API-Key": self.api_key,
|
28
35
|
"Content-Type": "application/json",
|
29
36
|
},
|
30
37
|
timeout=30.0,
|
@@ -573,29 +580,11 @@ def publish_callback(
|
|
573
580
|
console.print(f"[red]✗[/red] Path not found: {data_path}", style="bold red")
|
574
581
|
raise typer.Exit(code=1)
|
575
582
|
|
576
|
-
# Get backend URL from environment
|
577
|
-
backend_url = os.getenv("UNITYSVC_BASE_URL")
|
578
|
-
if not backend_url:
|
579
|
-
console.print(
|
580
|
-
"[red]✗[/red] UNITYSVC_BASE_URL environment variable not set.",
|
581
|
-
style="bold red",
|
582
|
-
)
|
583
|
-
raise typer.Exit(code=1)
|
584
|
-
|
585
|
-
# Get API key from environment
|
586
|
-
api_key = os.getenv("UNITYSVC_API_KEY")
|
587
|
-
if not api_key:
|
588
|
-
console.print(
|
589
|
-
"[red]✗[/red] UNITYSVC_API_KEY environment variable not set.",
|
590
|
-
style="bold red",
|
591
|
-
)
|
592
|
-
raise typer.Exit(code=1)
|
593
|
-
|
594
583
|
console.print(f"[bold blue]Publishing all data from:[/bold blue] {data_path}")
|
595
|
-
console.print(f"[bold blue]Backend URL:[/bold blue] {
|
584
|
+
console.print(f"[bold blue]Backend URL:[/bold blue] {os.getenv('UNITYSVC_BASE_URL', 'N/A')}\n")
|
596
585
|
|
597
586
|
try:
|
598
|
-
with ServiceDataPublisher(
|
587
|
+
with ServiceDataPublisher() as publisher:
|
599
588
|
# Call the publish_all_models method
|
600
589
|
all_results = publisher.publish_all_models(data_path)
|
601
590
|
|
@@ -678,37 +667,19 @@ def publish_providers(
|
|
678
667
|
console.print(f"[red]✗[/red] Path not found: {data_path}", style="bold red")
|
679
668
|
raise typer.Exit(code=1)
|
680
669
|
|
681
|
-
# Get backend URL from environment
|
682
|
-
backend_url = os.getenv("UNITYSVC_BASE_URL")
|
683
|
-
if not backend_url:
|
684
|
-
console.print(
|
685
|
-
"[red]✗[/red] UNITYSVC_BASE_URL environment variable not set.",
|
686
|
-
style="bold red",
|
687
|
-
)
|
688
|
-
raise typer.Exit(code=1)
|
689
|
-
|
690
|
-
# Get API key from environment
|
691
|
-
api_key = os.getenv("UNITYSVC_API_KEY")
|
692
|
-
if not api_key:
|
693
|
-
console.print(
|
694
|
-
"[red]✗[/red] UNITYSVC_API_KEY environment variable not set.",
|
695
|
-
style="bold red",
|
696
|
-
)
|
697
|
-
raise typer.Exit(code=1)
|
698
|
-
|
699
670
|
try:
|
700
|
-
with ServiceDataPublisher(
|
671
|
+
with ServiceDataPublisher() as publisher:
|
701
672
|
# Handle single file
|
702
673
|
if data_path.is_file():
|
703
674
|
console.print(f"[blue]Publishing provider:[/blue] {data_path}")
|
704
|
-
console.print(f"[blue]Backend URL:[/blue] {
|
675
|
+
console.print(f"[blue]Backend URL:[/blue] {os.getenv('UNITYSVC_BASE_URL', 'N/A')}\n")
|
705
676
|
result = publisher.post_provider(data_path)
|
706
677
|
console.print("[green]✓[/green] Provider published successfully!")
|
707
678
|
console.print(f"[cyan]Response:[/cyan] {json.dumps(result, indent=2)}")
|
708
679
|
# Handle directory
|
709
680
|
else:
|
710
681
|
console.print(f"[blue]Scanning for providers in:[/blue] {data_path}")
|
711
|
-
console.print(f"[blue]Backend URL:[/blue] {
|
682
|
+
console.print(f"[blue]Backend URL:[/blue] {os.getenv('UNITYSVC_BASE_URL', 'N/A')}\n")
|
712
683
|
results = publisher.publish_all_providers(data_path)
|
713
684
|
|
714
685
|
# Display summary
|
@@ -755,37 +726,19 @@ def publish_sellers(
|
|
755
726
|
console.print(f"[red]✗[/red] Path not found: {data_path}", style="bold red")
|
756
727
|
raise typer.Exit(code=1)
|
757
728
|
|
758
|
-
# Get backend URL from environment
|
759
|
-
backend_url = os.getenv("UNITYSVC_BASE_URL")
|
760
|
-
if not backend_url:
|
761
|
-
console.print(
|
762
|
-
"[red]✗[/red] UNITYSVC_BASE_URL environment variable not set.",
|
763
|
-
style="bold red",
|
764
|
-
)
|
765
|
-
raise typer.Exit(code=1)
|
766
|
-
|
767
|
-
# Get API key from environment
|
768
|
-
api_key = os.getenv("UNITYSVC_API_KEY")
|
769
|
-
if not api_key:
|
770
|
-
console.print(
|
771
|
-
"[red]✗[/red] UNITYSVC_API_KEY environment variable not set.",
|
772
|
-
style="bold red",
|
773
|
-
)
|
774
|
-
raise typer.Exit(code=1)
|
775
|
-
|
776
729
|
try:
|
777
|
-
with ServiceDataPublisher(
|
730
|
+
with ServiceDataPublisher() as publisher:
|
778
731
|
# Handle single file
|
779
732
|
if data_path.is_file():
|
780
733
|
console.print(f"[blue]Publishing seller:[/blue] {data_path}")
|
781
|
-
console.print(f"[blue]Backend URL:[/blue] {
|
734
|
+
console.print(f"[blue]Backend URL:[/blue] {os.getenv('UNITYSVC_BASE_URL', 'N/A')}\n")
|
782
735
|
result = publisher.post_seller(data_path)
|
783
736
|
console.print("[green]✓[/green] Seller published successfully!")
|
784
737
|
console.print(f"[cyan]Response:[/cyan] {json.dumps(result, indent=2)}")
|
785
738
|
# Handle directory
|
786
739
|
else:
|
787
740
|
console.print(f"[blue]Scanning for sellers in:[/blue] {data_path}")
|
788
|
-
console.print(f"[blue]Backend URL:[/blue] {
|
741
|
+
console.print(f"[blue]Backend URL:[/blue] {os.getenv('UNITYSVC_BASE_URL', 'N/A')}\n")
|
789
742
|
results = publisher.publish_all_sellers(data_path)
|
790
743
|
|
791
744
|
console.print("\n[bold]Publishing Summary:[/bold]")
|
@@ -830,37 +783,19 @@ def publish_offerings(
|
|
830
783
|
console.print(f"[red]✗[/red] Path not found: {data_path}", style="bold red")
|
831
784
|
raise typer.Exit(code=1)
|
832
785
|
|
833
|
-
# Get backend URL from environment
|
834
|
-
backend_url = os.getenv("UNITYSVC_BASE_URL")
|
835
|
-
if not backend_url:
|
836
|
-
console.print(
|
837
|
-
"[red]✗[/red] UNITYSVC_BASE_URL environment variable not set.",
|
838
|
-
style="bold red",
|
839
|
-
)
|
840
|
-
raise typer.Exit(code=1)
|
841
|
-
|
842
|
-
# Get API key from environment
|
843
|
-
api_key = os.getenv("UNITYSVC_API_KEY")
|
844
|
-
if not api_key:
|
845
|
-
console.print(
|
846
|
-
"[red]✗[/red] UNITYSVC_API_KEY environment variable not set.",
|
847
|
-
style="bold red",
|
848
|
-
)
|
849
|
-
raise typer.Exit(code=1)
|
850
|
-
|
851
786
|
try:
|
852
|
-
with ServiceDataPublisher(
|
787
|
+
with ServiceDataPublisher() as publisher:
|
853
788
|
# Handle single file
|
854
789
|
if data_path.is_file():
|
855
790
|
console.print(f"[blue]Publishing service offering:[/blue] {data_path}")
|
856
|
-
console.print(f"[blue]Backend URL:[/blue] {
|
791
|
+
console.print(f"[blue]Backend URL:[/blue] {os.getenv('UNITYSVC_BASE_URL', 'N/A')}\n")
|
857
792
|
result = publisher.post_service_offering(data_path)
|
858
793
|
console.print("[green]✓[/green] Service offering published successfully!")
|
859
794
|
console.print(f"[cyan]Response:[/cyan] {json.dumps(result, indent=2)}")
|
860
795
|
# Handle directory
|
861
796
|
else:
|
862
797
|
console.print(f"[blue]Scanning for service offerings in:[/blue] {data_path}")
|
863
|
-
console.print(f"[blue]Backend URL:[/blue] {
|
798
|
+
console.print(f"[blue]Backend URL:[/blue] {os.getenv('UNITYSVC_BASE_URL', 'N/A')}\n")
|
864
799
|
results = publisher.publish_all_offerings(data_path)
|
865
800
|
|
866
801
|
console.print("\n[bold]Publishing Summary:[/bold]")
|
@@ -906,37 +841,19 @@ def publish_listings(
|
|
906
841
|
console.print(f"[red]✗[/red] Path not found: {data_path}", style="bold red")
|
907
842
|
raise typer.Exit(code=1)
|
908
843
|
|
909
|
-
# Get backend URL from environment
|
910
|
-
backend_url = os.getenv("UNITYSVC_BASE_URL")
|
911
|
-
if not backend_url:
|
912
|
-
console.print(
|
913
|
-
"[red]✗[/red] UNITYSVC_BASE_URL environment variable not set.",
|
914
|
-
style="bold red",
|
915
|
-
)
|
916
|
-
raise typer.Exit(code=1)
|
917
|
-
|
918
|
-
# Get API key from environment
|
919
|
-
api_key = os.getenv("UNITYSVC_API_KEY")
|
920
|
-
if not api_key:
|
921
|
-
console.print(
|
922
|
-
"[red]✗[/red] UNITYSVC_API_KEY environment variable not set.",
|
923
|
-
style="bold red",
|
924
|
-
)
|
925
|
-
raise typer.Exit(code=1)
|
926
|
-
|
927
844
|
try:
|
928
|
-
with ServiceDataPublisher(
|
845
|
+
with ServiceDataPublisher() as publisher:
|
929
846
|
# Handle single file
|
930
847
|
if data_path.is_file():
|
931
848
|
console.print(f"[blue]Publishing service listing:[/blue] {data_path}")
|
932
|
-
console.print(f"[blue]Backend URL:[/blue] {
|
849
|
+
console.print(f"[blue]Backend URL:[/blue] {os.getenv('UNITYSVC_BASE_URL', 'N/A')}\n")
|
933
850
|
result = publisher.post_service_listing(data_path)
|
934
851
|
console.print("[green]✓[/green] Service listing published successfully!")
|
935
852
|
console.print(f"[cyan]Response:[/cyan] {json.dumps(result, indent=2)}")
|
936
853
|
# Handle directory
|
937
854
|
else:
|
938
855
|
console.print(f"[blue]Scanning for service listings in:[/blue] {data_path}")
|
939
|
-
console.print(f"[blue]Backend URL:[/blue] {
|
856
|
+
console.print(f"[blue]Backend URL:[/blue] {os.getenv('UNITYSVC_BASE_URL', 'N/A')}\n")
|
940
857
|
results = publisher.publish_all_listings(data_path)
|
941
858
|
|
942
859
|
console.print("\n[bold]Publishing Summary:[/bold]")
|
File without changes
|
unitysvc_services/query.py
CHANGED
@@ -16,26 +16,24 @@ console = Console()
|
|
16
16
|
class ServiceDataQuery:
|
17
17
|
"""Query service data from UnitySVC backend endpoints."""
|
18
18
|
|
19
|
-
def __init__(self
|
20
|
-
"""Initialize query client
|
21
|
-
|
22
|
-
Args:
|
23
|
-
base_url: UnitySVC backend URL
|
24
|
-
api_key: API key for authentication
|
19
|
+
def __init__(self) -> None:
|
20
|
+
"""Initialize query client from environment variables.
|
25
21
|
|
26
22
|
Raises:
|
27
|
-
ValueError: If
|
23
|
+
ValueError: If required environment variables are not set
|
28
24
|
"""
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
self.base_url = os.environ.get("UNITYSVC_BASE_URL")
|
26
|
+
if not self.base_url:
|
27
|
+
raise ValueError("UNITYSVC_BASE_URL environment variable not set")
|
28
|
+
|
29
|
+
self.api_key = os.environ.get("UNITYSVC_API_KEY")
|
30
|
+
if not self.api_key:
|
31
|
+
raise ValueError("UNITYSVC_API_KEY environment variable not set")
|
33
32
|
|
34
|
-
self.base_url = base_url.rstrip("/")
|
35
|
-
self.api_key = api_key
|
33
|
+
self.base_url = self.base_url.rstrip("/")
|
36
34
|
self.client = httpx.Client(
|
37
35
|
headers={
|
38
|
-
"X-API-Key": api_key,
|
36
|
+
"X-API-Key": self.api_key,
|
39
37
|
"Content-Type": "application/json",
|
40
38
|
},
|
41
39
|
timeout=30.0,
|
@@ -93,20 +91,6 @@ class ServiceDataQuery:
|
|
93
91
|
"""Context manager exit."""
|
94
92
|
self.close()
|
95
93
|
|
96
|
-
@staticmethod
|
97
|
-
def from_env() -> "ServiceDataQuery":
|
98
|
-
"""Create ServiceDataQuery from environment variables.
|
99
|
-
|
100
|
-
Returns:
|
101
|
-
ServiceDataQuery instance
|
102
|
-
|
103
|
-
Raises:
|
104
|
-
ValueError: If required environment variables are not set
|
105
|
-
"""
|
106
|
-
backend_url = os.getenv("UNITYSVC_BASE_URL") or ""
|
107
|
-
api_key = os.getenv("UNITYSVC_API_KEY") or ""
|
108
|
-
return ServiceDataQuery(base_url=backend_url, api_key=api_key)
|
109
|
-
|
110
94
|
|
111
95
|
@app.command("sellers")
|
112
96
|
def query_sellers(
|
@@ -119,7 +103,7 @@ def query_sellers(
|
|
119
103
|
):
|
120
104
|
"""Query all sellers from the backend."""
|
121
105
|
try:
|
122
|
-
with ServiceDataQuery
|
106
|
+
with ServiceDataQuery() as query:
|
123
107
|
sellers = query.list_sellers()
|
124
108
|
|
125
109
|
if format == "json":
|
@@ -166,7 +150,7 @@ def query_providers(
|
|
166
150
|
):
|
167
151
|
"""Query all providers from the backend."""
|
168
152
|
try:
|
169
|
-
with ServiceDataQuery
|
153
|
+
with ServiceDataQuery() as query:
|
170
154
|
providers = query.list_providers()
|
171
155
|
|
172
156
|
if format == "json":
|
@@ -209,7 +193,7 @@ def query_offerings(
|
|
209
193
|
):
|
210
194
|
"""Query all service offerings from UnitySVC backend."""
|
211
195
|
try:
|
212
|
-
with ServiceDataQuery
|
196
|
+
with ServiceDataQuery() as query:
|
213
197
|
offerings = query.list_service_offerings()
|
214
198
|
|
215
199
|
if format == "json":
|
@@ -257,7 +241,7 @@ def query_listings(
|
|
257
241
|
):
|
258
242
|
"""Query all service listings from UnitySVC backend."""
|
259
243
|
try:
|
260
|
-
with ServiceDataQuery
|
244
|
+
with ServiceDataQuery() as query:
|
261
245
|
listings = query.list_service_listings()
|
262
246
|
|
263
247
|
if format == "json":
|
@@ -304,7 +288,7 @@ def query_interfaces(
|
|
304
288
|
):
|
305
289
|
"""Query all access interfaces from UnitySVC backend (private endpoint)."""
|
306
290
|
try:
|
307
|
-
with ServiceDataQuery
|
291
|
+
with ServiceDataQuery() as query:
|
308
292
|
data = query.list_access_interfaces()
|
309
293
|
|
310
294
|
if format == "json":
|
@@ -353,7 +337,7 @@ def query_documents(
|
|
353
337
|
):
|
354
338
|
"""Query all documents from UnitySVC backend (private endpoint)."""
|
355
339
|
try:
|
356
|
-
with ServiceDataQuery
|
340
|
+
with ServiceDataQuery() as query:
|
357
341
|
data = query.list_documents()
|
358
342
|
|
359
343
|
if format == "json":
|
@@ -3,8 +3,9 @@ unitysvc_services/cli.py,sha256=OK0IZyAckxP15jRWU_W49hl3t7XcNRtd8BoDMyRKqNM,682
|
|
3
3
|
unitysvc_services/format_data.py,sha256=Jl9Vj3fRX852fHSUa5DzO-oiFQwuQHC3WMCDNIlo1Lc,5460
|
4
4
|
unitysvc_services/list.py,sha256=QDp9BByaoeFeJxXJN9RQ-jU99mH9Guq9ampfXCbpZmI,7033
|
5
5
|
unitysvc_services/populate.py,sha256=zkcjIy8BWuQSO7JwiRNHKgGoxQvc3ujluUQdYixdBvY,6626
|
6
|
-
unitysvc_services/publisher.py,sha256=
|
7
|
-
unitysvc_services/
|
6
|
+
unitysvc_services/publisher.py,sha256=qLIEl2Ts_xCaCkIv8MC_8Up_fA6xIaK2aX4ZF_NVa8g,35383
|
7
|
+
unitysvc_services/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
+
unitysvc_services/query.py,sha256=VHMaLCWAF5TyYhSkRnVzjhAZornGpSdET_QMvAi-G8k,14561
|
8
9
|
unitysvc_services/scaffold.py,sha256=Y73IX8vskImxSvxDgR0mvEFuAMYnBKfttn3bjcz3jmQ,40331
|
9
10
|
unitysvc_services/update.py,sha256=K9swocTUnqqiSgARo6GmuzTzUySSpyqqPPW4xF7ZU-g,9659
|
10
11
|
unitysvc_services/utils.py,sha256=GN0gkVTU8fOx2G0EbqnWmx8w9eFsoPfRprPjwCyPYkE,11371
|
@@ -15,9 +16,9 @@ unitysvc_services/models/listing_v1.py,sha256=CC_GXoN3NHJFzEQ3cBHDQpdUaBNpvLdHAR
|
|
15
16
|
unitysvc_services/models/provider_v1.py,sha256=cYK5kDDmzQEnLvUC2C8dKz-ZXci7hVn3fjNrJkaSr10,2050
|
16
17
|
unitysvc_services/models/seller_v1.py,sha256=SU4rqYAh9hE4EeUrEkqaVrLwusenV7MotPF77VcsRKo,3263
|
17
18
|
unitysvc_services/models/service_v1.py,sha256=u16zqM3khrJoTw_v0d45tMcKXjko5k_v3w8xwUtZ6nM,2720
|
18
|
-
unitysvc_services-0.2.
|
19
|
-
unitysvc_services-0.2.
|
20
|
-
unitysvc_services-0.2.
|
21
|
-
unitysvc_services-0.2.
|
22
|
-
unitysvc_services-0.2.
|
23
|
-
unitysvc_services-0.2.
|
19
|
+
unitysvc_services-0.2.2.dist-info/licenses/LICENSE,sha256=_p8V6A8OMPu2HIztn3O01v0-urZFwk0Dd3Yk_PTIlL8,1065
|
20
|
+
unitysvc_services-0.2.2.dist-info/METADATA,sha256=pmJ6eY72bkhsOuiKzAKUGspW6C9vSS6UwgMVHLBJQVY,6515
|
21
|
+
unitysvc_services-0.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
22
|
+
unitysvc_services-0.2.2.dist-info/entry_points.txt,sha256=-vodnbPmo7QQmFu8jdG6sCyGRVM727w9Nhwp4Vwau_k,64
|
23
|
+
unitysvc_services-0.2.2.dist-info/top_level.txt,sha256=GIotQj-Ro2ruR7eupM1r58PWqIHTAq647ORL7E2kneo,18
|
24
|
+
unitysvc_services-0.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|