Skip to content

Commit 015c854

Browse files
committed
Add support for new endpoints + full rewrite
Version 4.0.0 !
1 parent 073ac6e commit 015c854

30 files changed

+2404
-359
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,8 @@ dmypy.json
129129
!/test.py
130130
test.py
131131
test.py
132+
133+
134+
# Visual Studio Code and other IDEs
135+
.idea/
136+
.vscode/*

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ An easy-to-use Python Wrapper for the AlexFlipnote API
1111
## Requirements
1212

1313
- Python 3.8 or above
14-
- aiohttp (python3 -m pip install -U aiohttp)
14+
- aiohttp (``python -m pip install -U aiohttp``)
1515

1616
## Installation
1717

@@ -37,10 +37,9 @@ for anything related to this wrapper.
3737

3838
Join AlexFlipnote's server [here][discord_alexflipnote] to suggest or report anything on the API.
3939

40-
[docs]: https://github.com/Soheab/alexflipnote.py/blob/master/docs.md
40+
[docs]: start-docs.md
4141
[changelog]: https://github.com/Soheab/alexflipnote.py/blob/master/changelog.md
42-
[examples]: https://github.com/Soheab/alexflipnote.py/blob/master/docs.md#examples
43-
[embed_example]: https://github.com/Soheab/alexflipnote.py/blob/master/docs.md#embed
42+
[examples]: start-docs.md#examples
4443
[base_url]: https://api.alexflipnote.dev
4544
[github]: https://github.com/Soheab/alexflipnote.py
4645
[pypi]: https://pypi.org/project/alexflipnote.py/

alexflipnote/__init__.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from .client import *
2-
from .colour import *
2+
from .models import *
33
from .errors import *
4+
from .enums import *
45

5-
__license__ = "MIT"
6-
__author__ = "Soheab_"
7-
__version__ = "3.0.0"
6+
__version__ = "4.0.0"
7+
__author__ = "Soheab"
8+
__license__ = "MPL-2.0"
9+
__description__ = "An easy to use Python Wrapper for the AlexFlipnote API"

alexflipnote/_types/colour.py

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
from typing import Optional, Tuple, TypedDict, List
2+
3+
__all__: Tuple[str, ...] = (
4+
"Colour",
5+
"ColourImages",
6+
"RGB",
7+
"Hex",
8+
"RGB",
9+
"CMYK",
10+
"HSL",
11+
"SafeTextColour",
12+
"SafeTextColourRGB",
13+
"HSLKeys",
14+
"CMYKKeys",
15+
"RGBKeys",
16+
)
17+
18+
19+
class RGBKeys(TypedDict):
20+
r: int
21+
g: int
22+
b: int
23+
24+
25+
class HSLKeys(TypedDict):
26+
h: int
27+
s: int
28+
l: int
29+
30+
31+
class CMYKKeys(TypedDict):
32+
c: int
33+
m: int
34+
y: int
35+
k: int
36+
37+
38+
class HasStringKey(TypedDict):
39+
string: str
40+
41+
42+
class StringWithValues(HasStringKey):
43+
values: List[int]
44+
45+
46+
class SafeTextColourRGB(RGBKeys):
47+
values: List[int]
48+
49+
50+
class SafeTextColour(TypedDict):
51+
name: str
52+
hex: str
53+
rgb: SafeTextColourRGB
54+
55+
56+
class Hex(HasStringKey):
57+
clean: str
58+
shorten: Optional[str]
59+
values: List[str]
60+
61+
62+
class RGB(StringWithValues, RGBKeys):
63+
...
64+
65+
66+
class HSL(StringWithValues, HSLKeys):
67+
...
68+
69+
70+
class CMYK(StringWithValues, CMYKKeys):
71+
...
72+
73+
74+
class ColourImages(TypedDict):
75+
square: str
76+
gradient: str
77+
78+
79+
class Colour(TypedDict):
80+
name: str
81+
images: ColourImages
82+
_int: int # actual name is int, but that's a reserved keyword
83+
brightness: int
84+
safe_text_color: SafeTextColour
85+
hex: Hex
86+
rgb: RGB
87+
hsl: HSL
88+
cmyk: CMYK
89+
shade: List[str]
90+
tint: List[str]
91+
92+
93+
class ColourWithWebsafe(Colour):
94+
websafe: Colour

alexflipnote/_types/http.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from typing import Any, Dict, Literal, List, TypedDict
2+
3+
4+
ImageTypes = Literal["cats", "dogs", "sadcat", "birb", "coffee"]
5+
6+
7+
class Wrapper(TypedDict):
8+
author: str
9+
url: str
10+
11+
12+
class Image(TypedDict):
13+
file: str
14+
15+
16+
class BaseDocs(TypedDict):
17+
_docs: List[str]
18+
_variables: Dict[str, Any]
19+
20+
21+
class Raw(TypedDict):
22+
support_server: str
23+
endpoints: List[str]
24+
wrappers: Dict[str, Dict[str, Wrapper]]

alexflipnote/_types/nft.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from typing import TypedDict, Literal, List
2+
3+
from .http import BaseDocs
4+
5+
NFTSeason = Literal["none", "april", "autumn", "christmas", "halloween", "norway", "spring", "summer", "winter"]
6+
7+
8+
class NFTVariables(TypedDict):
9+
HEX: str
10+
SESSION: List[NFTSeason]
11+
12+
13+
class NFT(BaseDocs):
14+
_variables: NFTVariables # type: ignore
15+
hex: str
16+
season: NFTSeason
17+
name: str
18+
image: str

alexflipnote/_types/sillycat.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from typing import TypedDict
2+
3+
from .http import BaseDocs
4+
5+
6+
class SillycatVariables(TypedDict):
7+
HEX: str
8+
9+
10+
class SillycatPosition(TypedDict):
11+
hex: str
12+
name: str
13+
14+
15+
class SillycatImages(TypedDict):
16+
simple: str
17+
complex: str
18+
19+
20+
class Sillycat(BaseDocs):
21+
_variables: SillycatVariables # type: ignore
22+
left: SillycatPosition
23+
right: SillycatPosition
24+
images: SillycatImages

0 commit comments

Comments
 (0)