apexdevkit 1.8.2__tar.gz → 1.8.4__tar.gz
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.
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/PKG-INFO +1 -1
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/http/httpx.py +22 -10
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/testing/rest.py +15 -15
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/pyproject.toml +1 -1
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/LICENSE +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/README.md +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/error.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.8.2 → apexdevkit-1.8.4}/apexdevkit/testing/fake.py +0 -0
|
@@ -8,6 +8,7 @@ from httpx import Client
|
|
|
8
8
|
|
|
9
9
|
from apexdevkit.http.fluent import HttpMethod, HttpResponse
|
|
10
10
|
from apexdevkit.http.json import JsonDict
|
|
11
|
+
from apexdevkit.http.url import HttpUrl
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
def default_config() -> HttpxConfig:
|
|
@@ -22,12 +23,10 @@ class Httpx:
|
|
|
22
23
|
|
|
23
24
|
@classmethod
|
|
24
25
|
def create_for(cls, url: str) -> Self:
|
|
25
|
-
return cls(Client(base_url=url)
|
|
26
|
+
return cls(Client(base_url=url))
|
|
26
27
|
|
|
27
28
|
def with_endpoint(self, value: str) -> Httpx:
|
|
28
|
-
self.client
|
|
29
|
-
|
|
30
|
-
return self
|
|
29
|
+
return Httpx(self.client, self.config.with_endpoint(value))
|
|
31
30
|
|
|
32
31
|
def with_header(self, key: str, value: str) -> Httpx:
|
|
33
32
|
return Httpx(self.client, self.config.with_header(key, value))
|
|
@@ -39,7 +38,12 @@ class Httpx:
|
|
|
39
38
|
return Httpx(self.client, self.config.with_json(value))
|
|
40
39
|
|
|
41
40
|
def request(self, method: HttpMethod, endpoint: str = "") -> HttpResponse:
|
|
42
|
-
return _HttpxResponse(
|
|
41
|
+
return _HttpxResponse(
|
|
42
|
+
self.client.request(
|
|
43
|
+
method.name,
|
|
44
|
+
**self.config.with_endpoint(endpoint),
|
|
45
|
+
)
|
|
46
|
+
)
|
|
43
47
|
|
|
44
48
|
|
|
45
49
|
@dataclass
|
|
@@ -58,14 +62,22 @@ class _HttpxResponse:
|
|
|
58
62
|
|
|
59
63
|
@dataclass(frozen=True)
|
|
60
64
|
class HttpxConfig(Mapping[str, Any]):
|
|
61
|
-
|
|
65
|
+
endpoint: str = ""
|
|
62
66
|
headers: JsonDict = field(default_factory=JsonDict)
|
|
63
67
|
params: JsonDict = field(default_factory=JsonDict)
|
|
64
68
|
json: JsonDict = field(default_factory=JsonDict)
|
|
65
69
|
|
|
70
|
+
def with_endpoint(self, endpoint: str) -> HttpxConfig:
|
|
71
|
+
return HttpxConfig(
|
|
72
|
+
endpoint=HttpUrl(self.endpoint) + endpoint,
|
|
73
|
+
headers=self.headers,
|
|
74
|
+
params=self.params,
|
|
75
|
+
json=self.json,
|
|
76
|
+
)
|
|
77
|
+
|
|
66
78
|
def with_header(self, key: str, value: str) -> HttpxConfig:
|
|
67
79
|
return HttpxConfig(
|
|
68
|
-
|
|
80
|
+
endpoint=self.endpoint,
|
|
69
81
|
headers=self.headers.merge(JsonDict({key: value})),
|
|
70
82
|
params=self.params,
|
|
71
83
|
json=self.json,
|
|
@@ -73,7 +85,7 @@ class HttpxConfig(Mapping[str, Any]):
|
|
|
73
85
|
|
|
74
86
|
def with_param(self, key: str, value: str) -> HttpxConfig:
|
|
75
87
|
return HttpxConfig(
|
|
76
|
-
|
|
88
|
+
endpoint=self.endpoint,
|
|
77
89
|
headers=self.headers,
|
|
78
90
|
params=self.params.merge(JsonDict({key: value})),
|
|
79
91
|
json=self.json,
|
|
@@ -81,7 +93,7 @@ class HttpxConfig(Mapping[str, Any]):
|
|
|
81
93
|
|
|
82
94
|
def with_json(self, value: JsonDict) -> HttpxConfig:
|
|
83
95
|
return HttpxConfig(
|
|
84
|
-
|
|
96
|
+
endpoint=self.endpoint,
|
|
85
97
|
headers=self.headers,
|
|
86
98
|
params=self.params,
|
|
87
99
|
json=value,
|
|
@@ -89,7 +101,7 @@ class HttpxConfig(Mapping[str, Any]):
|
|
|
89
101
|
|
|
90
102
|
def as_dict(self) -> dict[str, Any]:
|
|
91
103
|
return {
|
|
92
|
-
"
|
|
104
|
+
"url": self.endpoint,
|
|
93
105
|
"headers": dict(self.headers),
|
|
94
106
|
"params": dict(self.params),
|
|
95
107
|
"json": dict(self.json),
|
|
@@ -120,21 +120,21 @@ class RestfulName:
|
|
|
120
120
|
return HttpUrl(self.plural) + other
|
|
121
121
|
|
|
122
122
|
|
|
123
|
-
def as_plural(singular: str) -> str:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
123
|
+
def as_plural(singular: str) -> str:
|
|
124
|
+
suffixes = {
|
|
125
|
+
"y": "ies",
|
|
126
|
+
"ch": "ches",
|
|
127
|
+
"sh": "shes",
|
|
128
|
+
"s": "ses",
|
|
129
|
+
"z": "zes",
|
|
130
|
+
"x": "xes",
|
|
131
|
+
"fe": "ves",
|
|
132
|
+
"f": "ves",
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
for singular_suffix, plural_suffix in suffixes.items():
|
|
136
|
+
if singular.endswith(singular_suffix):
|
|
137
|
+
return singular.removesuffix(singular_suffix) + plural_suffix
|
|
138
138
|
|
|
139
139
|
return singular + "s"
|
|
140
140
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|