-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from CrazyProger1/dev
V0.0.3
- Loading branch information
Showing
25 changed files
with
395 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,7 @@ async def main(): | |
|
||
## Status | ||
|
||
``0.0.2`` - **RELEASED** | ||
``0.0.3`` - **RELEASED** | ||
|
||
## Licence | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from resty.serializers import Serializer | ||
|
||
from schemas import Product | ||
from schemas import ProductSchema | ||
|
||
|
||
class ProductSerializer(Serializer): | ||
schema = Product | ||
schema = ProductSchema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from resty.enums import ( | ||
Endpoint, | ||
Field | ||
) | ||
from resty.managers import Manager | ||
|
||
from serializers import ProductSerializer | ||
|
||
|
||
class UserProductManager(Manager): | ||
serializer = ProductSerializer | ||
endpoints = { | ||
Endpoint.CREATE: 'users/{user_pk}/products/', | ||
Endpoint.READ: 'users/{user_pk}/products/', | ||
Endpoint.READ_ONE: 'users/{user_pk}/products/{pk}/', | ||
Endpoint.UPDATE: 'users/{user_pk}/products/{pk}/', | ||
Endpoint.DELETE: 'users/{user_pk}/products/{pk}/', | ||
} | ||
fields = { | ||
Field.PRIMARY: 'id', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class ProductSchema(BaseModel): | ||
id: int | None = None | ||
name: str | ||
description: str | ||
code: str | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from resty.serializers import Serializer | ||
|
||
from schemas import ProductSchema | ||
|
||
|
||
class ProductSerializer(Serializer): | ||
schema = ProductSchema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from resty.enums import ( | ||
Endpoint, | ||
Field | ||
) | ||
from resty.managers import Manager | ||
|
||
from serializers import ProductSerializer | ||
|
||
|
||
class ProductManager(Manager): | ||
serializer = ProductSerializer | ||
endpoints = { | ||
Endpoint.CREATE: '/products/', | ||
Endpoint.READ: '/products/', | ||
Endpoint.READ_ONE: '/products/{pk}/', | ||
Endpoint.UPDATE: '/products/{pk}/', | ||
Endpoint.DELETE: '/products/{pk}/', | ||
} | ||
fields = { | ||
Field.PRIMARY: 'id', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class ProductCreateSchema(BaseModel): | ||
name: str | ||
description: str | ||
|
||
|
||
class ProductReadSchema(BaseModel): | ||
id: int | None = None | ||
name: str | ||
description: str | ||
code: str | ||
|
||
|
||
class ProductUpdateSchema(BaseModel): | ||
name: str = None | ||
description: str = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from resty.serializers import Serializer | ||
from resty.enums import Endpoint | ||
|
||
from schemas import ( | ||
ProductCreateSchema, | ||
ProductReadSchema, | ||
ProductUpdateSchema | ||
) | ||
|
||
|
||
class ProductSerializer(Serializer): | ||
schemas = { | ||
Endpoint.CREATE: ProductCreateSchema, | ||
Endpoint.READ: ProductReadSchema, | ||
Endpoint.READ_ONE: ProductReadSchema, | ||
Endpoint.UPDATE: ProductUpdateSchema | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "resty-client" | ||
version = "0.0.2" | ||
version = "0.0.3" | ||
description = "RestyClient is a simple, easy-to-use Python library for interacting with REST APIs using Pydantic's powerful data validation and deserialization tools." | ||
authors = ["CrazyProger1 <[email protected]>"] | ||
license = "MIT" | ||
|
@@ -18,6 +18,7 @@ mypy = "^1.8.0" | |
pytest = "^7.4.4" | ||
httpx = "^0.26.0" | ||
black = "^24.4.0" | ||
coverage = "^7.5.0" | ||
|
||
[tool.ruff] | ||
exclude = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .manager import Manager | ||
from resty.managers.manager import Manager | ||
|
||
__all__ = ["Manager"] |
Oops, something went wrong.